Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2023-10-15 09:52:07 -04:00
8 changed files with 106 additions and 42 deletions

View File

@@ -160,7 +160,7 @@ public class Blocks{
//logic
message, switchBlock, microProcessor, logicProcessor, hyperProcessor, largeLogicDisplay, logicDisplay, memoryCell, memoryBank,
canvas, reinforcedMessage,
worldProcessor, worldCell, worldMessage,
worldProcessor, worldCell, worldMessage, worldSwitch,
//campaign
launchPad, interplanetaryAccelerator
@@ -5944,6 +5944,13 @@ public class Blocks{
privileged = true;
}};
worldSwitch = new SwitchBlock("world-switch"){{
requirements(Category.logic, BuildVisibility.editorOnly, with());
targetable = false;
privileged = true;
}};
//endregion
}
}

View File

@@ -8,6 +8,8 @@ import mindustry.gen.*;
import mindustry.world.*;
import mindustry.world.meta.*;
import static mindustry.Vars.state;
public class SwitchBlock extends Block{
public Sound clickSound = Sounds.click;
@@ -25,7 +27,26 @@ public class SwitchBlock extends Block{
config(Boolean.class, (SwitchBuild entity, Boolean b) -> entity.enabled = b);
}
public boolean accessible(){
return !privileged || state.rules.editor;
}
@Override
public boolean canBreak(Tile tile){
return accessible();
}
public class SwitchBuild extends Building{
@Override
public void damage(float damage){
if(privileged) return;
super.damage(damage);
}
@Override
public boolean collide(Bullet other){
return !privileged;
}
@Override
public boolean configTapped(){