PR: world-switch (#9167)
This commit is contained in:
BIN
core/assets-raw/sprites/blocks/logic/world-switch-on.png
Normal file
BIN
core/assets-raw/sprites/blocks/logic/world-switch-on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 164 B |
BIN
core/assets-raw/sprites/blocks/logic/world-switch.png
Normal file
BIN
core/assets-raw/sprites/blocks/logic/world-switch.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 389 B |
@@ -586,3 +586,4 @@
|
|||||||
63096=fast|status-fast-ui
|
63096=fast|status-fast-ui
|
||||||
63095=ranai|ranai
|
63095=ranai|ranai
|
||||||
63094=cat|cat
|
63094=cat|cat
|
||||||
|
63093=world-switch|block-world-switch-ui
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class Blocks{
|
|||||||
//logic
|
//logic
|
||||||
message, switchBlock, microProcessor, logicProcessor, hyperProcessor, largeLogicDisplay, logicDisplay, memoryCell, memoryBank,
|
message, switchBlock, microProcessor, logicProcessor, hyperProcessor, largeLogicDisplay, logicDisplay, memoryCell, memoryBank,
|
||||||
canvas, reinforcedMessage,
|
canvas, reinforcedMessage,
|
||||||
worldProcessor, worldCell, worldMessage,
|
worldProcessor, worldCell, worldMessage, worldSwitch,
|
||||||
|
|
||||||
//campaign
|
//campaign
|
||||||
launchPad, interplanetaryAccelerator
|
launchPad, interplanetaryAccelerator
|
||||||
@@ -5944,6 +5944,13 @@ public class Blocks{
|
|||||||
privileged = true;
|
privileged = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
worldSwitch = new SwitchBlock("world-switch"){{
|
||||||
|
requirements(Category.logic, BuildVisibility.editorOnly, with());
|
||||||
|
|
||||||
|
targetable = false;
|
||||||
|
privileged = true;
|
||||||
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import mindustry.gen.*;
|
|||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
|
import static mindustry.Vars.state;
|
||||||
|
|
||||||
public class SwitchBlock extends Block{
|
public class SwitchBlock extends Block{
|
||||||
public Sound clickSound = Sounds.click;
|
public Sound clickSound = Sounds.click;
|
||||||
|
|
||||||
@@ -25,7 +27,26 @@ public class SwitchBlock extends Block{
|
|||||||
config(Boolean.class, (SwitchBuild entity, Boolean b) -> entity.enabled = b);
|
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{
|
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
|
@Override
|
||||||
public boolean configTapped(){
|
public boolean configTapped(){
|
||||||
|
|||||||
Reference in New Issue
Block a user