WIP Turret field rename / More JSON consume support
This commit is contained in:
@@ -1052,7 +1052,8 @@ public class Blocks{
|
|||||||
requirements(Category.crafting, with(Items.copper, 30, Items.lead, 35, Items.graphite, 45));
|
requirements(Category.crafting, with(Items.copper, 30, Items.lead, 35, Items.graphite, 45));
|
||||||
health = 200;
|
health = 200;
|
||||||
outputLiquid = new LiquidStack(Liquids.slag, 12f / 60f);
|
outputLiquid = new LiquidStack(Liquids.slag, 12f / 60f);
|
||||||
craftTime = 1f;
|
|
||||||
|
craftTime = 10f;
|
||||||
hasLiquids = hasPower = true;
|
hasLiquids = hasPower = true;
|
||||||
drawer = new DrawMulti(new DrawDefault(), new DrawLiquidRegion());
|
drawer = new DrawMulti(new DrawDefault(), new DrawLiquidRegion());
|
||||||
|
|
||||||
@@ -2877,7 +2878,7 @@ public class Blocks{
|
|||||||
shoot.shotDelay = 5f;
|
shoot.shotDelay = 5f;
|
||||||
shoot.shots = 2;
|
shoot.shots = 2;
|
||||||
|
|
||||||
recoilAmount = 2f;
|
recoil = 2f;
|
||||||
rotateSpeed = 15f;
|
rotateSpeed = 15f;
|
||||||
inaccuracy = 17f;
|
inaccuracy = 17f;
|
||||||
shootCone = 35f;
|
shootCone = 35f;
|
||||||
@@ -2920,7 +2921,7 @@ public class Blocks{
|
|||||||
hittable = false;
|
hittable = false;
|
||||||
}}
|
}}
|
||||||
);
|
);
|
||||||
recoilAmount = 0f;
|
recoil = 0f;
|
||||||
reload = 6f;
|
reload = 6f;
|
||||||
coolantMultiplier = 1.5f;
|
coolantMultiplier = 1.5f;
|
||||||
range = 60f;
|
range = 60f;
|
||||||
@@ -2974,7 +2975,7 @@ public class Blocks{
|
|||||||
);
|
);
|
||||||
targetAir = false;
|
targetAir = false;
|
||||||
reload = 60f;
|
reload = 60f;
|
||||||
recoilAmount = 2f;
|
recoil = 2f;
|
||||||
range = 235f;
|
range = 235f;
|
||||||
inaccuracy = 1f;
|
inaccuracy = 1f;
|
||||||
shootCone = 10f;
|
shootCone = 10f;
|
||||||
@@ -3003,7 +3004,7 @@ public class Blocks{
|
|||||||
}}
|
}}
|
||||||
);
|
);
|
||||||
size = 2;
|
size = 2;
|
||||||
recoilAmount = 0f;
|
recoil = 0f;
|
||||||
reload = 3f;
|
reload = 3f;
|
||||||
inaccuracy = 5f;
|
inaccuracy = 5f;
|
||||||
shootCone = 50f;
|
shootCone = 50f;
|
||||||
@@ -3021,10 +3022,10 @@ public class Blocks{
|
|||||||
|
|
||||||
shoot.firstShotDelay = 40f;
|
shoot.firstShotDelay = 40f;
|
||||||
|
|
||||||
recoilAmount = 2f;
|
recoil = 2f;
|
||||||
reload = 80f;
|
reload = 80f;
|
||||||
cooldown = 0.03f;
|
cooldown = 0.03f;
|
||||||
shootShake = 2f;
|
shake = 2f;
|
||||||
shootEffect = Fx.lancerLaserShoot;
|
shootEffect = Fx.lancerLaserShoot;
|
||||||
smokeEffect = Fx.none;
|
smokeEffect = Fx.none;
|
||||||
heatColor = Color.red;
|
heatColor = Color.red;
|
||||||
@@ -3085,7 +3086,7 @@ public class Blocks{
|
|||||||
range = 90f;
|
range = 90f;
|
||||||
shootEffect = Fx.lightningShoot;
|
shootEffect = Fx.lightningShoot;
|
||||||
heatColor = Color.red;
|
heatColor = Color.red;
|
||||||
recoilAmount = 1f;
|
recoil = 1f;
|
||||||
size = 1;
|
size = 1;
|
||||||
health = 260;
|
health = 260;
|
||||||
shootSound = Sounds.spark;
|
shootSound = Sounds.spark;
|
||||||
@@ -3229,8 +3230,8 @@ public class Blocks{
|
|||||||
restitution = 0.03f;
|
restitution = 0.03f;
|
||||||
ammoEjectBack = 3f;
|
ammoEjectBack = 3f;
|
||||||
cooldown = 0.03f;
|
cooldown = 0.03f;
|
||||||
recoilAmount = 3f;
|
recoil = 3f;
|
||||||
shootShake = 1f;
|
shake = 1f;
|
||||||
shoot.shots = 4;
|
shoot.shots = 4;
|
||||||
shoot.shotDelay = 3f;
|
shoot.shotDelay = 3f;
|
||||||
|
|
||||||
@@ -3309,7 +3310,7 @@ public class Blocks{
|
|||||||
shoot.shots = 2;
|
shoot.shots = 2;
|
||||||
velocityRnd = 0.1f;
|
velocityRnd = 0.1f;
|
||||||
inaccuracy = 4f;
|
inaccuracy = 4f;
|
||||||
recoilAmount = 1f;
|
recoil = 1f;
|
||||||
restitution = 0.04f;
|
restitution = 0.04f;
|
||||||
shootCone = 45f;
|
shootCone = 45f;
|
||||||
liquidCapacity = 40f;
|
liquidCapacity = 40f;
|
||||||
@@ -3323,9 +3324,9 @@ public class Blocks{
|
|||||||
requirements(Category.turret, with(Items.copper, 225, Items.graphite, 225, Items.thorium, 100));
|
requirements(Category.turret, with(Items.copper, 225, Items.graphite, 225, Items.thorium, 100));
|
||||||
|
|
||||||
reload = 35f;
|
reload = 35f;
|
||||||
shootShake = 4f;
|
shake = 4f;
|
||||||
range = 90f;
|
range = 90f;
|
||||||
recoilAmount = 5f;
|
recoil = 5f;
|
||||||
|
|
||||||
shoot = new ShootSpread(3, 20f);
|
shoot = new ShootSpread(3, 20f);
|
||||||
|
|
||||||
@@ -3446,8 +3447,8 @@ public class Blocks{
|
|||||||
cooldown = 0.03f;
|
cooldown = 0.03f;
|
||||||
velocityRnd = 0.2f;
|
velocityRnd = 0.2f;
|
||||||
restitution = 0.02f;
|
restitution = 0.02f;
|
||||||
recoilAmount = 6f;
|
recoil = 6f;
|
||||||
shootShake = 2f;
|
shake = 2f;
|
||||||
range = 290f;
|
range = 290f;
|
||||||
minRange = 50f;
|
minRange = 50f;
|
||||||
coolant = consumeCoolant(0.3f);
|
coolant = consumeCoolant(0.3f);
|
||||||
@@ -3533,7 +3534,7 @@ public class Blocks{
|
|||||||
reload = 8f;
|
reload = 8f;
|
||||||
range = 200f;
|
range = 200f;
|
||||||
size = 3;
|
size = 3;
|
||||||
recoilAmount = 3f;
|
recoil = 3f;
|
||||||
rotateSpeed = 10f;
|
rotateSpeed = 10f;
|
||||||
inaccuracy = 10f;
|
inaccuracy = 10f;
|
||||||
shootCone = 30f;
|
shootCone = 30f;
|
||||||
@@ -3569,10 +3570,10 @@ public class Blocks{
|
|||||||
rotateSpeed = 2f;
|
rotateSpeed = 2f;
|
||||||
reload = 200f;
|
reload = 200f;
|
||||||
ammoUseEffect = Fx.casing3Double;
|
ammoUseEffect = Fx.casing3Double;
|
||||||
recoilAmount = 5f;
|
recoil = 5f;
|
||||||
restitution = 0.009f;
|
restitution = 0.009f;
|
||||||
cooldown = 0.009f;
|
cooldown = 0.009f;
|
||||||
shootShake = 4f;
|
shake = 4f;
|
||||||
size = 4;
|
size = 4;
|
||||||
shootCone = 2f;
|
shootCone = 2f;
|
||||||
shootSound = Sounds.railgun;
|
shootSound = Sounds.railgun;
|
||||||
@@ -3631,11 +3632,11 @@ public class Blocks{
|
|||||||
ammoUseEffect = Fx.casing3;
|
ammoUseEffect = Fx.casing3;
|
||||||
range = 260f;
|
range = 260f;
|
||||||
inaccuracy = 3f;
|
inaccuracy = 3f;
|
||||||
recoilAmount = 3f;
|
recoil = 3f;
|
||||||
shoot = new ShootAlternate(){{
|
shoot = new ShootAlternate(){{
|
||||||
spread = 8f;
|
spread = 8f;
|
||||||
}};
|
}};
|
||||||
shootShake = 2f;
|
shake = 2f;
|
||||||
size = 4;
|
size = 4;
|
||||||
shootCone = 24f;
|
shootCone = 24f;
|
||||||
shootSound = Sounds.shootBig;
|
shootSound = Sounds.shootBig;
|
||||||
@@ -3650,9 +3651,9 @@ public class Blocks{
|
|||||||
requirements(Category.turret, with(Items.copper, 1200, Items.lead, 350, Items.graphite, 300, Items.surgeAlloy, 325, Items.silicon, 325));
|
requirements(Category.turret, with(Items.copper, 1200, Items.lead, 350, Items.graphite, 300, Items.surgeAlloy, 325, Items.silicon, 325));
|
||||||
shootEffect = Fx.shootBigSmoke2;
|
shootEffect = Fx.shootBigSmoke2;
|
||||||
shootCone = 40f;
|
shootCone = 40f;
|
||||||
recoilAmount = 4f;
|
recoil = 4f;
|
||||||
size = 4;
|
size = 4;
|
||||||
shootShake = 2f;
|
shake = 2f;
|
||||||
range = 195f;
|
range = 195f;
|
||||||
reload = 90f;
|
reload = 90f;
|
||||||
firingMoveFract = 0.5f;
|
firingMoveFract = 0.5f;
|
||||||
@@ -3726,7 +3727,7 @@ public class Blocks{
|
|||||||
|
|
||||||
coolantMultiplier = 6f;
|
coolantMultiplier = 6f;
|
||||||
|
|
||||||
shootShake = 1f;
|
shake = 1f;
|
||||||
ammoPerShot = 2;
|
ammoPerShot = 2;
|
||||||
drawer = new DrawTurret("reinforced-");
|
drawer = new DrawTurret("reinforced-");
|
||||||
shootY = -2;
|
shootY = -2;
|
||||||
@@ -3734,7 +3735,7 @@ public class Blocks{
|
|||||||
size = 3;
|
size = 3;
|
||||||
envEnabled |= Env.space;
|
envEnabled |= Env.space;
|
||||||
reload = 40f;
|
reload = 40f;
|
||||||
recoilAmount = 2f;
|
recoil = 2f;
|
||||||
restitution = 0.03f;
|
restitution = 0.03f;
|
||||||
range = 190;
|
range = 190;
|
||||||
shootCone = 3f;
|
shootCone = 3f;
|
||||||
@@ -3773,7 +3774,7 @@ public class Blocks{
|
|||||||
|
|
||||||
inaccuracy = 0.2f;
|
inaccuracy = 0.2f;
|
||||||
velocityRnd = 0.17f;
|
velocityRnd = 0.17f;
|
||||||
shootShake = 1f;
|
shake = 1f;
|
||||||
ammoPerShot = 3;
|
ammoPerShot = 3;
|
||||||
maxAmmo = 30;
|
maxAmmo = 30;
|
||||||
consumeAmmoOnce = true;
|
consumeAmmoOnce = true;
|
||||||
@@ -3792,7 +3793,7 @@ public class Blocks{
|
|||||||
size = 3;
|
size = 3;
|
||||||
envEnabled |= Env.space;
|
envEnabled |= Env.space;
|
||||||
reload = 30f;
|
reload = 30f;
|
||||||
recoilAmount = 2f;
|
recoil = 2f;
|
||||||
restitution = 0.03f;
|
restitution = 0.03f;
|
||||||
range = 125;
|
range = 125;
|
||||||
shootCone = 40f;
|
shootCone = 40f;
|
||||||
@@ -3920,8 +3921,8 @@ public class Blocks{
|
|||||||
ammoPerShot = 4;
|
ammoPerShot = 4;
|
||||||
maxAmmo = ammoPerShot * 3;
|
maxAmmo = ammoPerShot * 3;
|
||||||
targetAir = false;
|
targetAir = false;
|
||||||
shootShake = 4f;
|
shake = 4f;
|
||||||
recoilAmount = 1f;
|
recoil = 1f;
|
||||||
reload = 60f * 2.3f;
|
reload = 60f * 2.3f;
|
||||||
shootY = 7f;
|
shootY = 7f;
|
||||||
rotateSpeed = 1.4f;
|
rotateSpeed = 1.4f;
|
||||||
|
|||||||
@@ -395,7 +395,12 @@ public class ContentParser{
|
|||||||
for(JsonValue child : value.get("consumes")){
|
for(JsonValue child : value.get("consumes")){
|
||||||
switch(child.name){
|
switch(child.name){
|
||||||
case "item" -> block.consumeItem(find(ContentType.item, child.asString()));
|
case "item" -> block.consumeItem(find(ContentType.item, child.asString()));
|
||||||
|
case "itemCharged" -> block.consume((Consume)parser.readValue(ConsumeItemCharged.class, child));
|
||||||
|
case "itemFlammable" -> block.consume((Consume)parser.readValue(ConsumeItemFlammable.class, child));
|
||||||
|
case "itemRadioactive" -> block.consume((Consume)parser.readValue(ConsumeItemRadioactive.class, child));
|
||||||
|
case "itemExplosive" -> block.consume((Consume)parser.readValue(ConsumeItemExplosive.class, child));
|
||||||
case "items" -> block.consume((Consume)parser.readValue(ConsumeItems.class, child));
|
case "items" -> block.consume((Consume)parser.readValue(ConsumeItems.class, child));
|
||||||
|
case "liquidFlammable" -> block.consume((Consume)parser.readValue(ConsumeLiquidFlammable.class, child));
|
||||||
case "liquid" -> block.consume((Consume)parser.readValue(ConsumeLiquid.class, child));
|
case "liquid" -> block.consume((Consume)parser.readValue(ConsumeLiquid.class, child));
|
||||||
case "liquids" -> block.consume((Consume)parser.readValue(ConsumeLiquids.class, child));
|
case "liquids" -> block.consume((Consume)parser.readValue(ConsumeLiquids.class, child));
|
||||||
case "coolant" -> block.consume((Consume)parser.readValue(ConsumeCoolant.class, child));
|
case "coolant" -> block.consume((Consume)parser.readValue(ConsumeCoolant.class, child));
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ public class Weapon implements Cloneable{
|
|||||||
public float recoil = 1.5f;
|
public float recoil = 1.5f;
|
||||||
/** the time it returns back to its original position in ticks. uses reload time by default */
|
/** the time it returns back to its original position in ticks. uses reload time by default */
|
||||||
public float recoilTime = -1f;
|
public float recoilTime = -1f;
|
||||||
|
/** ticks to cool down the heat region */
|
||||||
|
public float cooldownTime = 20f;
|
||||||
/** projectile/effect offsets from center of weapon */
|
/** projectile/effect offsets from center of weapon */
|
||||||
public float shootX = 0f, shootY = 3f;
|
public float shootX = 0f, shootY = 3f;
|
||||||
/** offsets of weapon position on unit */
|
/** offsets of weapon position on unit */
|
||||||
@@ -82,8 +84,6 @@ public class Weapon implements Cloneable{
|
|||||||
public float shootCone = 5f;
|
public float shootCone = 5f;
|
||||||
/** Cone in which the weapon can rotate relative to its mount. */
|
/** Cone in which the weapon can rotate relative to its mount. */
|
||||||
public float rotationLimit = 361f;
|
public float rotationLimit = 361f;
|
||||||
/** ticks to cool down the heat region */
|
|
||||||
public float cooldownTime = 20f;
|
|
||||||
/** minimum weapon warmup before firing (this is not linear, do NOT use 1!) */
|
/** minimum weapon warmup before firing (this is not linear, do NOT use 1!) */
|
||||||
public float minWarmup = 0f;
|
public float minWarmup = 0f;
|
||||||
/** lerp speed for shoot warmup, only used for parts */
|
/** lerp speed for shoot warmup, only used for parts */
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class ContinuousTurret extends Turret{
|
|||||||
|
|
||||||
wasShooting = true;
|
wasShooting = true;
|
||||||
heat = 1f;
|
heat = 1f;
|
||||||
recoil = recoilAmount;
|
curRecoil = recoil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class LaserTurret extends PowerTurret{
|
|||||||
|
|
||||||
wasShooting = true;
|
wasShooting = true;
|
||||||
heat = 1f;
|
heat = 1f;
|
||||||
recoil = recoilAmount;
|
curRecoil = recoil;
|
||||||
}else if(reloadCounter > 0){
|
}else if(reloadCounter > 0){
|
||||||
wasShooting = true;
|
wasShooting = true;
|
||||||
|
|
||||||
|
|||||||
@@ -34,35 +34,20 @@ public class Turret extends ReloadTurret{
|
|||||||
public final static float logicControlCooldown = 60 * 2;
|
public final static float logicControlCooldown = 60 * 2;
|
||||||
|
|
||||||
public final int timerTarget = timers++;
|
public final int timerTarget = timers++;
|
||||||
public int targetInterval = 20;
|
/** Ticks between attempt at finding a target. */
|
||||||
|
public float targetInterval = 20;
|
||||||
public Color heatColor = Pal.turretHeat;
|
|
||||||
public Effect shootEffect = Fx.none;
|
|
||||||
public Effect smokeEffect = Fx.none;
|
|
||||||
public Effect ammoUseEffect = Fx.none;
|
|
||||||
public Sound shootSound = Sounds.shoot;
|
|
||||||
public Sound chargeSound = Sounds.none;
|
|
||||||
public float soundPitchMin = 0.9f, soundPitchMax = 1.1f;
|
|
||||||
|
|
||||||
//visuals TODO document
|
|
||||||
public float ammoEjectBack = 1f;
|
|
||||||
public float shootWarmupSpeed = 0.1f;
|
|
||||||
public boolean linearWarmup = false;
|
|
||||||
public float recoilAmount = 1f;
|
|
||||||
public float restitution = 0.02f;
|
|
||||||
public float cooldown = 0.02f;
|
|
||||||
public float elevation = -1f;
|
|
||||||
public float shootShake = 0f;
|
|
||||||
|
|
||||||
|
/** Maximum ammo units stored. */
|
||||||
public int maxAmmo = 30;
|
public int maxAmmo = 30;
|
||||||
|
/** Ammo units used per shot. */
|
||||||
public int ammoPerShot = 1;
|
public int ammoPerShot = 1;
|
||||||
/** If true, ammo is only consumed once per shot regardless of bullet count. */
|
/** If true, ammo is only consumed once per shot regardless of bullet count. */
|
||||||
public boolean consumeAmmoOnce = false;
|
public boolean consumeAmmoOnce = false;
|
||||||
|
/** Minimum input heat required to fire. */
|
||||||
public float heatRequirement = -1f;
|
public float heatRequirement = -1f;
|
||||||
|
/** Maximum efficiency possible, if this turret uses heat. */
|
||||||
public float maxHeatEfficiency = 3f;
|
public float maxHeatEfficiency = 3f;
|
||||||
|
|
||||||
//TODO clean all of this up + weapon consistency
|
|
||||||
|
|
||||||
/** Bullet angle randomness in degrees. */
|
/** Bullet angle randomness in degrees. */
|
||||||
public float inaccuracy = 0f;
|
public float inaccuracy = 0f;
|
||||||
/** Fraction of bullet velocity that is random. */
|
/** Fraction of bullet velocity that is random. */
|
||||||
@@ -71,7 +56,7 @@ public class Turret extends ReloadTurret{
|
|||||||
public float shootCone = 8f;
|
public float shootCone = 8f;
|
||||||
/** Turret shoot point. */
|
/** Turret shoot point. */
|
||||||
public float shootX = 0f, shootY = Float.NEGATIVE_INFINITY;
|
public float shootX = 0f, shootY = Float.NEGATIVE_INFINITY;
|
||||||
/** Currently used for artillery only. */
|
/** Minimum bullet range. Used for artillery only. */
|
||||||
public float minRange = 0f;
|
public float minRange = 0f;
|
||||||
/** Minimum warmup needed to fire. */
|
/** Minimum warmup needed to fire. */
|
||||||
public float minWarmup = 0f;
|
public float minWarmup = 0f;
|
||||||
@@ -82,15 +67,55 @@ public class Turret extends ReloadTurret{
|
|||||||
/** pattern used for bullets */
|
/** pattern used for bullets */
|
||||||
public ShootPattern shoot = new ShootPattern();
|
public ShootPattern shoot = new ShootPattern();
|
||||||
|
|
||||||
|
/** If true, this block targets air units. */
|
||||||
public boolean targetAir = true;
|
public boolean targetAir = true;
|
||||||
|
/** If true, this block targets ground units and structures. */
|
||||||
public boolean targetGround = true;
|
public boolean targetGround = true;
|
||||||
|
/** If true, this block targets friend blocks, to heal them. */
|
||||||
public boolean targetHealing = false;
|
public boolean targetHealing = false;
|
||||||
|
/** If true, this turret can be controlled by players. */
|
||||||
public boolean playerControllable = true;
|
public boolean playerControllable = true;
|
||||||
|
/** If true, this block will display ammo multipliers in its stats (irrelevant for certain types of turrets). */
|
||||||
public boolean displayAmmoMultiplier = true;
|
public boolean displayAmmoMultiplier = true;
|
||||||
|
/** Function for choosing which unit to target. */
|
||||||
public Sortf unitSort = UnitSorts.closest;
|
public Sortf unitSort = UnitSorts.closest;
|
||||||
|
/** Filter for types of units to attack. */
|
||||||
public Boolf<Unit> unitFilter = u -> true;
|
public Boolf<Unit> unitFilter = u -> true;
|
||||||
|
/** Filter for types of buildings to attack. */
|
||||||
public Boolf<Building> buildingFilter = b -> !b.block.underBullets;
|
public Boolf<Building> buildingFilter = b -> !b.block.underBullets;
|
||||||
|
|
||||||
|
/** Color of heat region drawn on top (if found) */
|
||||||
|
public Color heatColor = Pal.turretHeat;
|
||||||
|
/** Optional override for all shoot effects. */
|
||||||
|
public @Nullable Effect shootEffect;
|
||||||
|
/** Optional override for all smoke effects. */
|
||||||
|
public @Nullable Effect smokeEffect;
|
||||||
|
/** Optional override for all ammo use effects. */
|
||||||
|
public @Nullable Effect ammoUseEffect;
|
||||||
|
/** Sound emitted when a single bullet is shot. */
|
||||||
|
public Sound shootSound = Sounds.shoot;
|
||||||
|
/** Sound emitted when shoot.firstShotDelay is >0 and shooting begins. */
|
||||||
|
public Sound chargeSound = Sounds.none;
|
||||||
|
/** Range for pitch of shoot sound. */
|
||||||
|
public float soundPitchMin = 0.9f, soundPitchMax = 1.1f;
|
||||||
|
/** Backwards Y offset of ammo eject effect. */
|
||||||
|
public float ammoEjectBack = 1f;
|
||||||
|
/** Lerp speed of turret warmup. */
|
||||||
|
public float shootWarmupSpeed = 0.1f;
|
||||||
|
/** If true, turret warmup is linear instead of a curve. */
|
||||||
|
public boolean linearWarmup = false;
|
||||||
|
/** Visual amount by which the turret recoils back per shot. */
|
||||||
|
public float recoil = 1f;
|
||||||
|
/** TODO rename */
|
||||||
|
public float restitution = 0.02f;
|
||||||
|
/** TODO rename */
|
||||||
|
public float cooldown = 0.02f;
|
||||||
|
/** Visual elevation of turret shadow, -1 to use defaults. */
|
||||||
|
public float elevation = -1f;
|
||||||
|
/** How much the screen shakes per shot. */
|
||||||
|
public float shake = 0f;
|
||||||
|
|
||||||
|
/** Defines drawing behavior for this turret. */
|
||||||
public DrawBlock drawer = new DrawTurret();
|
public DrawBlock drawer = new DrawTurret();
|
||||||
|
|
||||||
public Turret(String name){
|
public Turret(String name){
|
||||||
@@ -168,7 +193,7 @@ public class Turret extends ReloadTurret{
|
|||||||
|
|
||||||
public Seq<AmmoEntry> ammo = new Seq<>();
|
public Seq<AmmoEntry> ammo = new Seq<>();
|
||||||
public int totalAmmo;
|
public int totalAmmo;
|
||||||
public float recoil, heat, logicControlTime = -1;
|
public float curRecoil, heat, logicControlTime = -1;
|
||||||
public float shootWarmup;
|
public float shootWarmup;
|
||||||
public int totalShots;
|
public int totalShots;
|
||||||
public boolean logicShooting = false;
|
public boolean logicShooting = false;
|
||||||
@@ -315,13 +340,13 @@ public class Turret extends ReloadTurret{
|
|||||||
wasShooting = false;
|
wasShooting = false;
|
||||||
|
|
||||||
//TODO do not lerp
|
//TODO do not lerp
|
||||||
recoil = Mathf.lerpDelta(recoil, 0f, restitution);
|
curRecoil = Mathf.lerpDelta(curRecoil, 0f, restitution);
|
||||||
heat = Mathf.lerpDelta(heat, 0f, cooldown);
|
heat = Mathf.lerpDelta(heat, 0f, cooldown);
|
||||||
|
|
||||||
unit.tile(this);
|
unit.tile(this);
|
||||||
unit.rotation(rotation);
|
unit.rotation(rotation);
|
||||||
unit.team(team);
|
unit.team(team);
|
||||||
recoilOffset.trns(rotation, -recoil);
|
recoilOffset.trns(rotation, -curRecoil);
|
||||||
|
|
||||||
if(logicControlTime > 0){
|
if(logicControlTime > 0){
|
||||||
logicControlTime -= Time.delta;
|
logicControlTime -= Time.delta;
|
||||||
@@ -511,8 +536,8 @@ public class Turret extends ReloadTurret{
|
|||||||
//TODO aimX / aimY for multi shot turrets?
|
//TODO aimX / aimY for multi shot turrets?
|
||||||
handleBullet(type.create(this, team, bulletX, bulletY, shootAngle, -1f, (1f - velocityRnd) + Mathf.random(velocityRnd), lifeScl, null, mover, targetPos.x, targetPos.y), xOffset, yOffset, angleOffset);
|
handleBullet(type.create(this, team, bulletX, bulletY, shootAngle, -1f, (1f - velocityRnd) + Mathf.random(velocityRnd), lifeScl, null, mover, targetPos.x, targetPos.y), xOffset, yOffset, angleOffset);
|
||||||
|
|
||||||
(shootEffect == Fx.none ? type.shootEffect : shootEffect).at(bulletX, bulletY, rotation + angleOffset, type.hitColor);
|
(shootEffect == null ? type.shootEffect : shootEffect).at(bulletX, bulletY, rotation + angleOffset, type.hitColor);
|
||||||
(smokeEffect == Fx.none ? type.smokeEffect : smokeEffect).at(bulletX, bulletY, rotation + angleOffset, type.hitColor);
|
(smokeEffect == null ? type.smokeEffect : smokeEffect).at(bulletX, bulletY, rotation + angleOffset, type.hitColor);
|
||||||
shootSound.at(bulletX, bulletY, Mathf.random(soundPitchMin, soundPitchMax));
|
shootSound.at(bulletX, bulletY, Mathf.random(soundPitchMin, soundPitchMax));
|
||||||
|
|
||||||
ammoUseEffect.at(
|
ammoUseEffect.at(
|
||||||
@@ -521,11 +546,11 @@ public class Turret extends ReloadTurret{
|
|||||||
rotation * Mathf.sign(xOffset)
|
rotation * Mathf.sign(xOffset)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(shootShake > 0){
|
if(shake > 0){
|
||||||
Effect.shake(shootShake, shootShake, this);
|
Effect.shake(shake, shake, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
recoil = recoilAmount;
|
curRecoil = recoil;
|
||||||
heat = 1f;
|
heat = 1f;
|
||||||
|
|
||||||
if(!consumeAmmoOnce){
|
if(!consumeAmmoOnce){
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public class Conveyor extends Block implements Autotiler{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
int frame = enabled && clogHeat <= 0.5f ? (int)(((Time.time * speed * 8f * timeScale)) % 4) : 0;
|
int frame = enabled && clogHeat <= 0.5f ? (int)(((Time.time * speed * 8f * timeScale * efficiency)) % 4) : 0;
|
||||||
|
|
||||||
//draw extra conveyors facing this one for non-square tiling purposes
|
//draw extra conveyors facing this one for non-square tiling purposes
|
||||||
Draw.z(Layer.blockUnder);
|
Draw.z(Layer.blockUnder);
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import mindustry.gen.*;
|
|||||||
|
|
||||||
/** For mods. I don't use this (yet). */
|
/** For mods. I don't use this (yet). */
|
||||||
public class ConsumeItemCharged extends ConsumeItemFilter{
|
public class ConsumeItemCharged extends ConsumeItemFilter{
|
||||||
|
public float minCharge;
|
||||||
|
|
||||||
public ConsumeItemCharged(float minCharge){
|
public ConsumeItemCharged(float minCharge){
|
||||||
super(item -> item.charge >= minCharge);
|
this.minCharge = minCharge;
|
||||||
|
filter = item -> item.charge >= this.minCharge;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConsumeItemCharged(){
|
public ConsumeItemCharged(){
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ package mindustry.world.consumers;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
public class ConsumeItemExplosive extends ConsumeItemFilter{
|
public class ConsumeItemExplosive extends ConsumeItemFilter{
|
||||||
|
public float minExplosiveness;
|
||||||
|
|
||||||
public ConsumeItemExplosive(float minExplosiveness){
|
public ConsumeItemExplosive(float minCharge){
|
||||||
super(item -> item.explosiveness >= minExplosiveness);
|
this.minExplosiveness = minCharge;
|
||||||
|
filter = item -> item.explosiveness >= this.minExplosiveness;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConsumeItemExplosive(){
|
public ConsumeItemExplosive(){
|
||||||
|
|||||||
@@ -12,12 +12,15 @@ import mindustry.world.meta.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class ConsumeItemFilter extends Consume{
|
public class ConsumeItemFilter extends Consume{
|
||||||
public final Boolf<Item> filter;
|
public Boolf<Item> filter = i -> false;
|
||||||
|
|
||||||
public ConsumeItemFilter(Boolf<Item> item){
|
public ConsumeItemFilter(Boolf<Item> item){
|
||||||
this.filter = item;
|
this.filter = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConsumeItemFilter(){
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Block block){
|
public void apply(Block block){
|
||||||
block.hasItems = true;
|
block.hasItems = true;
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ package mindustry.world.consumers;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
public class ConsumeItemFlammable extends ConsumeItemFilter{
|
public class ConsumeItemFlammable extends ConsumeItemFilter{
|
||||||
|
public float minFlammability;
|
||||||
|
|
||||||
public ConsumeItemFlammable(float minFlammability){
|
public ConsumeItemFlammable(float minFlammability){
|
||||||
super(item -> item.flammability >= minFlammability);
|
this.minFlammability = minFlammability;
|
||||||
|
filter = item -> item.flammability >= this.minFlammability;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConsumeItemFlammable(){
|
public ConsumeItemFlammable(){
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ package mindustry.world.consumers;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
public class ConsumeItemRadioactive extends ConsumeItemFilter{
|
public class ConsumeItemRadioactive extends ConsumeItemFilter{
|
||||||
|
public float minRadioactivity;
|
||||||
|
|
||||||
public ConsumeItemRadioactive(float minRadioactivity){
|
public ConsumeItemRadioactive(float minRadioactivity){
|
||||||
super(item -> item.radioactivity >= minRadioactivity);
|
this.minRadioactivity = minRadioactivity;
|
||||||
|
filter = item -> item.radioactivity >= this.minRadioactivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConsumeItemRadioactive(){
|
public ConsumeItemRadioactive(){
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import mindustry.world.meta.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class ConsumeLiquidFilter extends ConsumeLiquidBase{
|
public class ConsumeLiquidFilter extends ConsumeLiquidBase{
|
||||||
public Boolf<Liquid> filter;
|
public Boolf<Liquid> filter = l -> false;
|
||||||
|
|
||||||
public ConsumeLiquidFilter(Boolf<Liquid> liquid, float amount){
|
public ConsumeLiquidFilter(Boolf<Liquid> liquid, float amount){
|
||||||
super(amount);
|
super(amount);
|
||||||
@@ -21,7 +21,6 @@ public class ConsumeLiquidFilter extends ConsumeLiquidBase{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ConsumeLiquidFilter(){
|
public ConsumeLiquidFilter(){
|
||||||
this.filter = l -> false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,13 +3,15 @@ package mindustry.world.consumers;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
public class ConsumeLiquidFlammable extends ConsumeLiquidFilter{
|
public class ConsumeLiquidFlammable extends ConsumeLiquidFilter{
|
||||||
|
public float minFlammability;
|
||||||
|
|
||||||
public ConsumeLiquidFlammable(float minFlammability, float amount){
|
public ConsumeLiquidFlammable(float minFlammability){
|
||||||
super(item -> item.flammability >= minFlammability, amount);
|
this.minFlammability = minFlammability;
|
||||||
|
filter = liquid -> liquid.flammability >= this.minFlammability;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConsumeLiquidFlammable(float amount){
|
public ConsumeLiquidFlammable(){
|
||||||
this(0.2f, amount);
|
this(0.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class DrawTurret extends DrawBlock{
|
|||||||
protected static final Rand rand = new Rand();
|
protected static final Rand rand = new Rand();
|
||||||
|
|
||||||
public Seq<DrawPart> parts = new Seq<>();
|
public Seq<DrawPart> parts = new Seq<>();
|
||||||
|
/** Prefix to use when loading base region. */
|
||||||
public String basePrefix = "";
|
public String basePrefix = "";
|
||||||
/** Overrides the liquid to draw in the liquid region. */
|
/** Overrides the liquid to draw in the liquid region. */
|
||||||
public @Nullable Liquid liquidDraw;
|
public @Nullable Liquid liquidDraw;
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ org.gradle.caching=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
archash=075789c973
|
archash=401f4edcce
|
||||||
|
|||||||
Reference in New Issue
Block a user