From a6c9ce76125605e9aabf858ffc6ebfa295cf0b0e Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 23 Feb 2022 15:35:10 -0500 Subject: [PATCH] Research cost overrides --- core/src/mindustry/type/Weapon.java | 7 ++----- core/src/mindustry/world/Block.java | 3 +++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 96230d4ae5..00e8e3fee6 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -377,9 +377,7 @@ public class Weapon implements Cloneable{ float lifeScl = bullet.scaleVelocity ? Mathf.clamp(Mathf.dst(shootX, shootY, aimX, aimY) / bullet.range()) : 1f; Unit parent = bullet.keepVelocity || parentizeEffects ? unit : null; - //TODO merge with Turret behavior - - //UnitTypes.eclipse.weapons.get(2).shotDelay = 4 + //TODO merge with Turret behavior if possible if(delay){ chargeSound.at(shootX, shootY, Mathf.random(soundPitchMin, soundPitchMax)); @@ -422,7 +420,7 @@ public class Weapon implements Cloneable{ Bullet result = null; if(unitSpawned == null){ - result = bullet.create(unit, unit.team, x, y, angle, (1f - velocityRnd) + Mathf.random(velocityRnd), lifescl); + result = bullet.create(unit, unit.team, x, y, angle, (1f - velocityRnd) + Mathf.random(velocityRnd), lifescl); }else{ //don't spawn units clientside! if(!net.client()){ @@ -442,7 +440,6 @@ public class Weapon implements Cloneable{ shootSound.at(shootX, shootY, Mathf.random(soundPitchMin, soundPitchMax)); } - //TODO mount pos is wrong ejectEffect.at(mountX, mountY, angle * side); bullet.shootEffect.at(shootX, shootY, angle, bullet.hitColor, unit); bullet.smokeEffect.at(shootX, shootY, angle, bullet.hitColor, unit); diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 777a8f983c..12e8689944 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -286,6 +286,8 @@ public class Block extends UnlockableContent implements Senseable{ public float researchCostMultiplier = 1; /** Cost multipliers per-item. */ public ObjectFloatMap researchCostMultipliers = new ObjectFloatMap<>(); + /** Override for research cost. Uses multipliers above and building requirements if not set. */ + public @Nullable ItemStack[] researchCost; /** Whether this block has instant transfer.*/ public boolean instantTransfer = false; /** Whether you can rotate this block after it is placed. */ @@ -988,6 +990,7 @@ public class Block extends UnlockableContent implements Senseable{ @Override public ItemStack[] researchRequirements(){ + if(researchCost != null) return researchCost; if(researchCostMultiplier <= 0f) return ItemStack.empty; ItemStack[] out = new ItemStack[requirements.length]; for(int i = 0; i < out.length; i++){