Bugfixes / Logic category (no icon) / Switch block
Before Width: | Height: | Size: 237 B |
BIN
core/assets-raw/sprites/blocks/logic/button-pressed.png
Normal file
After Width: | Height: | Size: 739 B |
BIN
core/assets-raw/sprites/blocks/logic/message.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
core/assets-raw/sprites/blocks/logic/switch-on.png
Normal file
After Width: | Height: | Size: 546 B |
BIN
core/assets-raw/sprites/blocks/logic/switch.png
Normal file
After Width: | Height: | Size: 722 B |
@ -283,3 +283,4 @@
|
||||
63461=logic-processor|block-logic-processor-medium
|
||||
63460=micro-processor|block-micro-processor-medium
|
||||
63459=logic-display|block-logic-display-medium
|
||||
63458=switch|block-switch-medium
|
||||
|
Before Width: | Height: | Size: 784 B After Width: | Height: | Size: 789 B |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 184 KiB |
Before Width: | Height: | Size: 385 KiB After Width: | Height: | Size: 386 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 392 KiB After Width: | Height: | Size: 392 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
@ -19,6 +19,7 @@ import mindustry.world.blocks.experimental.*;
|
||||
import mindustry.world.blocks.legacy.*;
|
||||
import mindustry.world.blocks.liquid.*;
|
||||
import mindustry.world.blocks.logic.*;
|
||||
import mindustry.world.blocks.logic.MessageBlock;
|
||||
import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.blocks.sandbox.*;
|
||||
@ -49,7 +50,7 @@ public class Blocks implements ContentList{
|
||||
melter, separator, disassembler, sporePress, pulverizer, incinerator, coalCentrifuge,
|
||||
|
||||
//sandbox
|
||||
powerSource, powerVoid, itemSource, itemVoid, liquidSource, liquidVoid, message, illuminator,
|
||||
powerSource, powerVoid, itemSource, itemVoid, liquidSource, liquidVoid, illuminator,
|
||||
|
||||
//defense
|
||||
copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, plastaniumWall, plastaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
|
||||
@ -82,7 +83,7 @@ public class Blocks implements ContentList{
|
||||
repairPoint, resupplyPoint,
|
||||
|
||||
//logic
|
||||
microProcessor, logicProcessor, logicDisplay,
|
||||
message, switchBlock, microProcessor, logicProcessor, logicDisplay,
|
||||
|
||||
//campaign
|
||||
launchPad, launchPadLarge,
|
||||
@ -1847,10 +1848,6 @@ public class Blocks implements ContentList{
|
||||
alwaysUnlocked = true;
|
||||
}};
|
||||
|
||||
message = new MessageBlock("message"){{
|
||||
requirements(Category.effect, with(Items.graphite, 5));
|
||||
}};
|
||||
|
||||
illuminator = new LightBlock("illuminator"){{
|
||||
requirements(Category.effect, BuildVisibility.lightingOnly, with(Items.graphite, 12, Items.silicon, 8));
|
||||
brightness = 0.67f;
|
||||
@ -1891,8 +1888,16 @@ public class Blocks implements ContentList{
|
||||
//endregion campaign
|
||||
//region logic
|
||||
|
||||
message = new MessageBlock("message"){{
|
||||
requirements(Category.logic, with(Items.graphite, 5));
|
||||
}};
|
||||
|
||||
switchBlock = new SwitchBlock("switch"){{
|
||||
requirements(Category.logic, with(Items.graphite, 5));
|
||||
}};
|
||||
|
||||
microProcessor = new LogicBlock("micro-processor"){{
|
||||
requirements(Category.effect, with(Items.copper, 30, Items.lead, 50, Items.silicon, 30));
|
||||
requirements(Category.logic, with(Items.copper, 30, Items.lead, 50, Items.silicon, 30));
|
||||
|
||||
instructionsPerTick = 2;
|
||||
memory = 32;
|
||||
@ -1901,7 +1906,7 @@ public class Blocks implements ContentList{
|
||||
}};
|
||||
|
||||
logicProcessor = new LogicBlock("logic-processor"){{
|
||||
requirements(Category.effect, with(Items.copper, 200, Items.lead, 120, Items.silicon, 100, Items.metaglass, 50));
|
||||
requirements(Category.logic, with(Items.copper, 200, Items.lead, 120, Items.silicon, 100, Items.metaglass, 50));
|
||||
|
||||
instructionsPerTick = 5;
|
||||
memory = 128;
|
||||
@ -1910,7 +1915,7 @@ public class Blocks implements ContentList{
|
||||
}};
|
||||
|
||||
logicDisplay = new LogicDisplay("logic-display"){{
|
||||
requirements(Category.effect, with(Items.copper, 200, Items.lead, 120, Items.silicon, 100, Items.metaglass, 50));
|
||||
requirements(Category.logic, with(Items.copper, 200, Items.lead, 120, Items.silicon, 100, Items.metaglass, 50));
|
||||
|
||||
displaySize = 80;
|
||||
|
||||
|
@ -114,9 +114,13 @@ public class Control implements ApplicationListener, Loadable{
|
||||
Call.gameOver(event.winner);
|
||||
});
|
||||
|
||||
//add player when world loads regardless
|
||||
Events.on(WorldLoadEvent.class, e -> {
|
||||
player.add();
|
||||
});
|
||||
|
||||
//autohost for pvp maps
|
||||
Events.on(WorldLoadEvent.class, event -> app.post(() -> {
|
||||
player.add();
|
||||
if(state.rules.pvp && !net.active()){
|
||||
try{
|
||||
net.host(port);
|
||||
|
@ -7,7 +7,7 @@ import mindustry.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.blocks.logic.LogicDisplay.*;
|
||||
import mindustry.world.blocks.storage.MessageBlock.*;
|
||||
import mindustry.world.blocks.logic.MessageBlock.*;
|
||||
|
||||
public class LExecutor{
|
||||
//special variables
|
||||
|
@ -17,10 +17,10 @@ public enum Category{
|
||||
crafting,
|
||||
/** Blocks that create units. */
|
||||
units,
|
||||
/** Things that upgrade the player such as mech pads. */
|
||||
upgrade,
|
||||
/** Things for storage or passive effects. */
|
||||
effect;
|
||||
effect,
|
||||
/** Blocks related to logic. */
|
||||
logic;
|
||||
|
||||
public static final Category[] all = values();
|
||||
|
||||
|
@ -284,7 +284,7 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
protected boolean validateTarget(){
|
||||
return !Units.invalidateTarget(target, team, x, y) || isControlled();
|
||||
return !Units.invalidateTarget(target, team, x, y) || isControlled() || logicControlled();
|
||||
}
|
||||
|
||||
protected void findTarget(){
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mindustry.world.blocks.storage;
|
||||
package mindustry.world.blocks.logic;
|
||||
|
||||
import arc.*;
|
||||
import arc.Input.*;
|
45
core/src/mindustry/world/blocks/logic/SwitchBlock.java
Normal file
@ -0,0 +1,45 @@
|
||||
package mindustry.world.blocks.logic;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class SwitchBlock extends Block{
|
||||
public @Load("@-on") TextureRegion onRegion;
|
||||
|
||||
public SwitchBlock(String name){
|
||||
super(name);
|
||||
configurable = true;
|
||||
update = true;
|
||||
|
||||
config(Boolean.class, (ButtonEntity entity, Boolean b) -> entity.on = b);
|
||||
}
|
||||
|
||||
public class ButtonEntity extends Building{
|
||||
public boolean on;
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
if(sensor == LAccess.enabled) return on ? 1 : 0;
|
||||
return super.sense(sensor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configTapped(){
|
||||
configure(!on);
|
||||
Sounds.click.at(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
if(on){
|
||||
Draw.rect(onRegion, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|