Add buildSpeedMultiplier status effect (#4816)
* Make disarmed status effect prevent building * Revert disarmed changes, add buildSpeedMultiplier status * Add buildSpeedMultiplier to StatusComp
This commit is contained in:
@@ -26,10 +26,10 @@ import java.util.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@Component
|
||||
abstract class BuilderComp implements Posc, Teamc, Rotc{
|
||||
abstract class BuilderComp implements Posc, Statusc, Teamc, Rotc{
|
||||
static final Vec2[] vecs = new Vec2[]{new Vec2(), new Vec2(), new Vec2(), new Vec2()};
|
||||
|
||||
@Import float x, y, rotation;
|
||||
@Import float x, y, rotation, buildSpeedMultiplier;
|
||||
@Import UnitType type;
|
||||
@Import Team team;
|
||||
|
||||
@@ -41,7 +41,7 @@ abstract class BuilderComp implements Posc, Teamc, Rotc{
|
||||
private transient float buildAlpha = 0f;
|
||||
|
||||
public boolean canBuild(){
|
||||
return type.buildSpeed > 0;
|
||||
return type.buildSpeed > 0 && buildSpeedMultiplier > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,9 +126,9 @@ abstract class BuilderComp implements Posc, Teamc, Rotc{
|
||||
|
||||
//otherwise, update it.
|
||||
if(current.breaking){
|
||||
entity.deconstruct(self(), core, 1f / entity.buildCost * Time.delta * type.buildSpeed * state.rules.buildSpeedMultiplier);
|
||||
entity.deconstruct(self(), core, 1f / entity.buildCost * Time.delta * type.buildSpeed * buildSpeedMultiplier * state.rules.buildSpeedMultiplier);
|
||||
}else{
|
||||
entity.construct(self(), core, 1f / entity.buildCost * Time.delta * type.buildSpeed * state.rules.buildSpeedMultiplier, current.config);
|
||||
entity.construct(self(), core, 1f / entity.buildCost * Time.delta * type.buildSpeed * buildSpeedMultiplier * state.rules.buildSpeedMultiplier, current.config);
|
||||
}
|
||||
|
||||
current.stuck = Mathf.equal(current.progress, entity.progress);
|
||||
|
||||
Reference in New Issue
Block a user