mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 06:22:17 -08:00
recoil as part progress
This commit is contained in:
parent
39f32af500
commit
b010e9d720
7 changed files with 15 additions and 12 deletions
|
|
@ -3787,7 +3787,7 @@ public class Blocks{
|
|||
progress = PartProgress.warmup;
|
||||
moveRot = -10f;
|
||||
mirror = true;
|
||||
moves.add(new PartMove(PartProgress.reload, 0f, -3f, -5f));
|
||||
moves.add(new PartMove(PartProgress.recoil, 0f, -3f, -5f));
|
||||
heatColor = Color.red;
|
||||
}});
|
||||
}};
|
||||
|
|
@ -3937,7 +3937,7 @@ public class Blocks{
|
|||
drawer = new DrawTurret("reinforced-"){{
|
||||
parts.addAll(
|
||||
new RegionPart("-barrel"){{
|
||||
progress = PartProgress.reload.curve(Interp.pow2In);
|
||||
progress = PartProgress.recoil.curve(Interp.pow2In);
|
||||
moveY = -5f * 4f / 3f;
|
||||
heatColor = Color.valueOf("f03b0e");
|
||||
mirror = false;
|
||||
|
|
@ -4011,8 +4011,8 @@ public class Blocks{
|
|||
parts.add(new RegionPart("-mid"){{
|
||||
under = true;
|
||||
moveY = -1.5f;
|
||||
progress = PartProgress.reload;
|
||||
heatProgress = PartProgress.reload.add(0.25f).min(PartProgress.warmup);
|
||||
progress = PartProgress.recoil;
|
||||
heatProgress = PartProgress.recoil.add(0.25f).min(PartProgress.warmup);
|
||||
heatColor = Color.sky.cpy().a(0.9f);
|
||||
}});
|
||||
parts.add(new RegionPart("-blade"){{
|
||||
|
|
|
|||
|
|
@ -22,14 +22,15 @@ public abstract class DrawPart{
|
|||
/** Parameters for drawing a part in draw(). */
|
||||
public static class PartParams{
|
||||
//TODO document
|
||||
public float warmup, reload, smoothReload, heat, life;
|
||||
public float warmup, reload, smoothReload, heat, recoil, life;
|
||||
public float x, y, rotation;
|
||||
public int sideOverride = -1, sideMultiplier = 1;
|
||||
|
||||
public PartParams set(float warmup, float reload, float smoothReload, float heat, float x, float y, float rotation){
|
||||
public PartParams set(float warmup, float reload, float smoothReload, float heat, float recoil, float x, float y, float rotation){
|
||||
this.warmup = warmup;
|
||||
this.reload = reload;
|
||||
this.heat = heat;
|
||||
this.recoil = recoil;
|
||||
this.smoothReload = smoothReload;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
|
@ -64,6 +65,8 @@ public abstract class DrawPart{
|
|||
smoothReload = p -> p.smoothReload,
|
||||
/** Weapon warmup, 0 when not firing, 1 when actively shooting. Not equivalent to heat. */
|
||||
warmup = p -> p.warmup,
|
||||
/** Weapon recoil with no curve applied. */
|
||||
recoil = p -> p.recoil,
|
||||
/** Weapon heat, 1 when just fired, 0, when it has cooled down (duration depends on weapon) */
|
||||
heat = p -> p.heat,
|
||||
/** Lifetime fraction, 0 to 1. Only for missiles. */
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ public class RegionPart extends DrawPart{
|
|||
float sign = (i == 1 ? -1 : 1) * params.sideMultiplier;
|
||||
Tmp.v1.set((x + mx) * sign, y + my).rotate(params.rotation - 90);
|
||||
|
||||
childParam.set(params.warmup, params.reload, params.smoothReload, params.heat, params.x + Tmp.v1.x, params.y + Tmp.v1.y, i * sign + mr * sign + params.rotation);
|
||||
childParam.set(params.warmup, params.reload, params.smoothReload, params.heat, params.recoil, params.x + Tmp.v1.x, params.y + Tmp.v1.y, i * sign + mr * sign + params.rotation);
|
||||
childParam.sideMultiplier = params.sideMultiplier;
|
||||
childParam.life = params.life;
|
||||
childParam.sideOverride = i;
|
||||
|
|
|
|||
|
|
@ -1106,9 +1106,9 @@ public class UnitType extends UnlockableContent{
|
|||
|
||||
WeaponMount first = unit.mounts.length > part.weaponIndex ? unit.mounts[part.weaponIndex] : null;
|
||||
if(first != null){
|
||||
DrawPart.params.set(first.warmup, first.reload / weapons.first().reload, first.smoothReload, first.heat, unit.x, unit.y, unit.rotation);
|
||||
DrawPart.params.set(first.warmup, first.reload / weapons.first().reload, first.smoothReload, first.heat, first.recoil, unit.x, unit.y, unit.rotation);
|
||||
}else{
|
||||
DrawPart.params.set(0f, 0f, 0f, 0f, unit.x, unit.y, unit.rotation);
|
||||
DrawPart.params.set(0f, 0f, 0f, 0f, 0f, unit.x, unit.y, unit.rotation);
|
||||
}
|
||||
|
||||
if(unit instanceof Scaled s){
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ public class Weapon implements Cloneable{
|
|||
}
|
||||
|
||||
if(parts.size > 0){
|
||||
DrawPart.params.set(mount.warmup, mount.reload / reload, mount.smoothReload, mount.heat, wx, wy, weaponRotation + 90);
|
||||
DrawPart.params.set(mount.warmup, mount.reload / reload, mount.smoothReload, mount.heat, mount.recoil, wx, wy, weaponRotation + 90);
|
||||
DrawPart.params.sideMultiplier = flipSprite ? -1 : 1;
|
||||
|
||||
for(int i = 0; i < parts.size; i++){
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class DrawTurret extends DrawBlock{
|
|||
float progress = tb.visualReloadValid ? tb.progress() : 1f;
|
||||
|
||||
//TODO no smooth reload
|
||||
var params = DrawPart.params.set(build.warmup(), 1f - progress, 1f - progress, tb.heat, tb.x + tb.recoilOffset.x, tb.y + tb.recoilOffset.y, tb.rotation);
|
||||
var params = DrawPart.params.set(build.warmup(), 1f - progress, 1f - progress, tb.heat, tb.curRecoil, tb.x + tb.recoilOffset.x, tb.y + tb.recoilOffset.y, tb.rotation);
|
||||
|
||||
for(var part : parts){
|
||||
part.draw(params);
|
||||
|
|
|
|||
|
|
@ -25,4 +25,4 @@ org.gradle.caching=true
|
|||
#used for slow jitpack builds; TODO see if this actually works
|
||||
org.gradle.internal.http.socketTimeout=100000
|
||||
org.gradle.internal.http.connectionTimeout=100000
|
||||
archash=ef9d6ac655
|
||||
archash=e7c161da88
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue