Fixed infinite fire / Command center logic control
This commit is contained in:
@@ -451,6 +451,10 @@ public class Block extends UnlockableContent{
|
||||
|
||||
}
|
||||
|
||||
public boolean configSenseable(){
|
||||
return configurations.containsKey(Item.class) || configurations.containsKey(Liquid.class);
|
||||
}
|
||||
|
||||
public Object nextConfig(){
|
||||
if(saveConfig && lastConfig != null){
|
||||
return lastConfig;
|
||||
|
||||
@@ -119,11 +119,11 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
float result = 0f;
|
||||
|
||||
if(block.hasItems){
|
||||
result += build.items.sum((item, amount) -> item.flammability * amount) / block.itemCapacity * Mathf.clamp(block.itemCapacity / 2.4f, 1f, 3f);
|
||||
result += build.items.sum((item, amount) -> item.flammability * amount) / Math.max(block.itemCapacity, 1) * Mathf.clamp(block.itemCapacity / 2.4f, 1f, 3f);
|
||||
}
|
||||
|
||||
if(block.hasLiquids){
|
||||
result += build.liquids.sum((liquid, amount) -> liquid.flammability * amount / 1.6f) / block.liquidCapacity * Mathf.clamp(block.liquidCapacity / 30f, 1f, 2f);
|
||||
result += build.liquids.sum((liquid, amount) -> liquid.flammability * amount / 1.6f) / Math.max(block.liquidCapacity, 1) * Mathf.clamp(block.liquidCapacity / 30f, 1f, 2f);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user