Research cost overrides

This commit is contained in:
Anuken
2022-02-23 15:35:10 -05:00
parent af8268241b
commit a6c9ce7612
2 changed files with 5 additions and 5 deletions

View File

@@ -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);

View File

@@ -286,6 +286,8 @@ public class Block extends UnlockableContent implements Senseable{
public float researchCostMultiplier = 1;
/** Cost multipliers per-item. */
public ObjectFloatMap<Item> 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++){