Fixed infinite fire / Command center logic control

This commit is contained in:
Anuken
2021-06-05 15:10:34 -04:00
parent d0da46e715
commit ade313fc1b
7 changed files with 31 additions and 7 deletions

View File

@@ -20,6 +20,8 @@ import mindustry.world.*;
import mindustry.world.meta.*;
public class CommandCenter extends Block{
public final int timerEffect = timers ++;
public TextureRegionDrawable[] commandRegions = new TextureRegionDrawable[UnitCommand.all.length];
public Color topColor = null, bottomColor = Color.valueOf("5e5e5e");
public Effect effect = Fx.commandSend;
@@ -33,11 +35,17 @@ public class CommandCenter extends Block{
solid = true;
configurable = true;
drawDisabled = false;
logicConfigurable = true;
config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> {
build.team.data().command = command;
effect.at(build, effectSize);
Events.fire(new CommandIssueEvent(build, command));
if(build.team.data().command != command){
build.team.data().command = command;
//do not spam effect
if(build.timer(timerEffect, 60f)){
effect.at(build, effectSize);
}
Events.fire(new CommandIssueEvent(build, command));
}
});
}
@@ -52,6 +60,11 @@ public class CommandCenter extends Block{
}
}
@Override
public boolean configSenseable(){
return true;
}
public class CommandBuild extends Building{
@Override