Configurable plans, taken from Foo's

This commit is contained in:
Anuken
2024-10-28 16:54:01 -04:00
parent fd88550b88
commit bbff564f96
10 changed files with 152 additions and 4 deletions

View File

@@ -783,6 +783,15 @@ public class DesktopInput extends InputHandler{
if(getPlan(splan.x, splan.y, splan.block.size, splan) != null){
player.unit().plans().remove(splan, true);
}
if(input.ctrl()){
inv.hide();
config.hideConfig();
planConfig.showConfig(splan);
}else{
planConfig.hide();
}
splan = null;
}

View File

@@ -116,6 +116,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
public final BlockInventoryFragment inv;
public final BlockConfigFragment config;
public final PlanConfigFragment planConfig;
private WidgetGroup group = new WidgetGroup();
@@ -136,6 +137,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
group.touchable = Touchable.childrenOnly;
inv = new BlockInventoryFragment();
config = new BlockConfigFragment();
planConfig = new PlanConfigFragment();
Events.on(UnitDestroyEvent.class, e -> {
if(e.unit != null && e.unit.isPlayer() && e.unit.getPlayer().isLocal() && e.unit.type.weapons.contains(w -> w.bullet.killShooter)){
@@ -1622,6 +1624,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
/** Handles tile tap events that are not platform specific. */
boolean tileTapped(@Nullable Building build){
planConfig.hide();
if(build == null){
inv.hide();
config.hideConfig();
@@ -1897,6 +1900,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
inv.build(group);
config.build(group);
planConfig.build(group);
}
}