This commit is contained in:
Anuken
2020-08-10 16:10:18 -04:00
parent c4e8fef8d0
commit c560de9c53
18 changed files with 13 additions and 3 deletions

View File

@@ -1169,6 +1169,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
@Override
public double sense(LAccess sensor){
if(sensor == LAccess.x) return x;
if(sensor == LAccess.y) return y;
if(sensor == LAccess.health) return health;
if(sensor == LAccess.efficiency) return efficiency();
if(sensor == LAccess.rotation) return rotation;

View File

@@ -73,6 +73,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
public double sense(LAccess sensor){
if(sensor == LAccess.totalItems) return stack().amount;
if(sensor == LAccess.health) return health;
if(sensor == LAccess.x) return x;
if(sensor == LAccess.y) return y;
return 0;
}

View File

@@ -18,6 +18,8 @@ public enum LAccess{
heat,
efficiency,
rotation,
x,
y,
//values with parameters are considered controllable
enabled("to"), //"to" is standard for single parameter access

View File

@@ -16,6 +16,7 @@ import arc.util.*;
import arc.util.ArcAnnotate.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.logic.LStatements.*;
import mindustry.ui.*;
import mindustry.ui.dialogs.*;
@@ -45,6 +46,7 @@ public class LCanvas extends Table{
int i = 0;
for(Prov<LStatement> prov : LogicIO.allStatements){
LStatement example = prov.get();
if(example instanceof InvalidStatement) continue;
t.button(example.name(), Styles.cleart, () -> {
add(prov.get());
dialog.hide();

View File

@@ -266,7 +266,7 @@ public class LStatements{
table.left();
table.add(" set ");
table.add("set ");
table.button(b -> {
b.label(() -> type.name());
@@ -274,8 +274,7 @@ public class LStatements{
type = t;
rebuild(table);
}, 2, cell -> cell.size(100, 50)));
}, Styles.logict, () -> {
}).size(90, 40).color(table.color).left().padLeft(2);
}, Styles.logict, () -> {}).size(90, 40).color(table.color).left().padLeft(2);
table.add(" of ");

View File

@@ -1,5 +1,7 @@
package mindustry.logic;
import arc.math.*;
public enum UnaryOp{
negate("-", a -> -a),
not("not", a -> ~(int)(a)),
@@ -12,6 +14,7 @@ public enum UnaryOp{
floor("floor", Math::floor),
ceil("ceil", Math::ceil),
sqrt("sqrt", Math::sqrt),
rand("rand", d -> Mathf.rand.nextDouble() * d),
;
public static final UnaryOp[] all = values();