Research cost overrides
This commit is contained in:
@@ -377,9 +377,7 @@ public class Weapon implements Cloneable{
|
|||||||
float lifeScl = bullet.scaleVelocity ? Mathf.clamp(Mathf.dst(shootX, shootY, aimX, aimY) / bullet.range()) : 1f;
|
float lifeScl = bullet.scaleVelocity ? Mathf.clamp(Mathf.dst(shootX, shootY, aimX, aimY) / bullet.range()) : 1f;
|
||||||
Unit parent = bullet.keepVelocity || parentizeEffects ? unit : null;
|
Unit parent = bullet.keepVelocity || parentizeEffects ? unit : null;
|
||||||
|
|
||||||
//TODO merge with Turret behavior
|
//TODO merge with Turret behavior if possible
|
||||||
|
|
||||||
//UnitTypes.eclipse.weapons.get(2).shotDelay = 4
|
|
||||||
|
|
||||||
if(delay){
|
if(delay){
|
||||||
chargeSound.at(shootX, shootY, Mathf.random(soundPitchMin, soundPitchMax));
|
chargeSound.at(shootX, shootY, Mathf.random(soundPitchMin, soundPitchMax));
|
||||||
@@ -422,7 +420,7 @@ public class Weapon implements Cloneable{
|
|||||||
Bullet result = null;
|
Bullet result = null;
|
||||||
|
|
||||||
if(unitSpawned == 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{
|
}else{
|
||||||
//don't spawn units clientside!
|
//don't spawn units clientside!
|
||||||
if(!net.client()){
|
if(!net.client()){
|
||||||
@@ -442,7 +440,6 @@ public class Weapon implements Cloneable{
|
|||||||
shootSound.at(shootX, shootY, Mathf.random(soundPitchMin, soundPitchMax));
|
shootSound.at(shootX, shootY, Mathf.random(soundPitchMin, soundPitchMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO mount pos is wrong
|
|
||||||
ejectEffect.at(mountX, mountY, angle * side);
|
ejectEffect.at(mountX, mountY, angle * side);
|
||||||
bullet.shootEffect.at(shootX, shootY, angle, bullet.hitColor, unit);
|
bullet.shootEffect.at(shootX, shootY, angle, bullet.hitColor, unit);
|
||||||
bullet.smokeEffect.at(shootX, shootY, angle, bullet.hitColor, unit);
|
bullet.smokeEffect.at(shootX, shootY, angle, bullet.hitColor, unit);
|
||||||
|
|||||||
@@ -286,6 +286,8 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
public float researchCostMultiplier = 1;
|
public float researchCostMultiplier = 1;
|
||||||
/** Cost multipliers per-item. */
|
/** Cost multipliers per-item. */
|
||||||
public ObjectFloatMap<Item> researchCostMultipliers = new ObjectFloatMap<>();
|
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.*/
|
/** Whether this block has instant transfer.*/
|
||||||
public boolean instantTransfer = false;
|
public boolean instantTransfer = false;
|
||||||
/** Whether you can rotate this block after it is placed. */
|
/** Whether you can rotate this block after it is placed. */
|
||||||
@@ -988,6 +990,7 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] researchRequirements(){
|
public ItemStack[] researchRequirements(){
|
||||||
|
if(researchCost != null) return researchCost;
|
||||||
if(researchCostMultiplier <= 0f) return ItemStack.empty;
|
if(researchCostMultiplier <= 0f) return ItemStack.empty;
|
||||||
ItemStack[] out = new ItemStack[requirements.length];
|
ItemStack[] out = new ItemStack[requirements.length];
|
||||||
for(int i = 0; i < out.length; i++){
|
for(int i = 0; i < out.length; i++){
|
||||||
|
|||||||
Reference in New Issue
Block a user