From eb52c6d61fd7e70d69868c473262107c40761ef1 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 9 May 2022 04:10:18 -0400 Subject: [PATCH] Status apply instruction / Bugfixes --- core/src/mindustry/input/Placement.java | 6 +- core/src/mindustry/logic/LExecutor.java | 29 +++++++++ core/src/mindustry/logic/LStatement.java | 10 ++- core/src/mindustry/logic/LStatements.java | 65 +++++++++++++++++++ .../blocks/defense/turrets/LaserTurret.java | 2 +- .../world/blocks/distribution/Duct.java | 2 +- .../world/blocks/liquid/Conduit.java | 2 +- 7 files changed, 107 insertions(+), 9 deletions(-) diff --git a/core/src/mindustry/input/Placement.java b/core/src/mindustry/input/Placement.java index 7425deeb53..bb87739a71 100644 --- a/core/src/mindustry/input/Placement.java +++ b/core/src/mindustry/input/Placement.java @@ -175,7 +175,7 @@ public class Placement{ plans.set(result); } - public static void calculateBridges(Seq plans, DirectionBridge bridge, boolean hasJunction){ + public static void calculateBridges(Seq plans, DirectionBridge bridge, boolean hasJunction, Boolf same){ if(isSidePlace(plans)) return; //check for orthogonal placement + unlocked state @@ -185,9 +185,9 @@ public class Placement{ //TODO for chains of ducts, do not count consecutives in a different rotation as 'placeable' Boolf placeable = plan -> - !(!hasJunction && plan.build() != null && plan.build().block == plan.block && plan.rotation != plan.build().rotation) && + !(!hasJunction && plan.build() != null && same.get(plan.build().block) && plan.rotation != plan.build().rotation) && (plan.placeable(player.team()) || - (plan.tile() != null && plan.tile().block() == plan.block)); //don't count the same block as inaccessible + (plan.tile() != null && same.get(plan.tile().block()))); //don't count the same block as inaccessible var result = plans1.clear(); diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 6dd703b97c..31cd13b87b 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -1320,6 +1320,35 @@ public class LExecutor{ } } + public static class ApplyEffectI implements LInstruction{ + public boolean clear; + public String effect; + public int unit, duration; + + public ApplyEffectI(boolean clear, String effect, int unit, int duration){ + this.clear = clear; + this.effect = effect; + this.unit = unit; + this.duration = duration; + } + + public ApplyEffectI(){ + } + + @Override + public void run(LExecutor exec){ + if(net.client()) return; + + if(exec.obj(unit) instanceof Unit unit && content.statusEffect(effect) != null){ + if(clear){ + unit.unapply(content.statusEffect(effect)); + }else{ + unit.apply(content.statusEffect(effect), exec.numf(duration) * 60f); + } + } + } + } + public static class SetRuleI implements LInstruction{ public LogicRule rule = LogicRule.waveSpacing; public int value, p1, p2, p3, p4; diff --git a/core/src/mindustry/logic/LStatement.java b/core/src/mindustry/logic/LStatement.java index bfb74be403..03ee5d2ea8 100644 --- a/core/src/mindustry/logic/LStatement.java +++ b/core/src/mindustry/logic/LStatement.java @@ -115,7 +115,7 @@ public abstract class LStatement{ } } - protected > void showSelect(Button b, T[] values, T current, Cons getter, int cols, Cons sizer){ + protected void showSelect(Button b, T[] values, T current, Cons getter, int cols, Cons sizer){ showSelectTable(b, (t, hide) -> { ButtonGroup