Object sense support / Bugfixes
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package mindustry.logic;
|
||||
|
||||
public enum ConditionOp{
|
||||
equal("==", (a, b) -> Math.abs(a - b) < 0.000001),
|
||||
notEqual("not", (a, b) -> Math.abs(a - b) >= 0.000001),
|
||||
equal("==", (a, b) -> Math.abs(a - b) < 0.000001, (a, b) -> a == b),
|
||||
notEqual("not", (a, b) -> Math.abs(a - b) >= 0.000001, (a, b) -> a != b),
|
||||
lessThan("<", (a, b) -> a < b),
|
||||
lessThanEq("<=", (a, b) -> a <= b),
|
||||
greaterThan(">", (a, b) -> a > b),
|
||||
@@ -10,12 +10,18 @@ public enum ConditionOp{
|
||||
|
||||
public static final ConditionOp[] all = values();
|
||||
|
||||
public final CondObjOpLambda objFunction;
|
||||
public final CondOpLambda function;
|
||||
public final String symbol;
|
||||
|
||||
ConditionOp(String symbol, CondOpLambda function){
|
||||
this(symbol, function, null);
|
||||
}
|
||||
|
||||
ConditionOp(String symbol, CondOpLambda function, CondObjOpLambda objFunction){
|
||||
this.symbol = symbol;
|
||||
this.function = function;
|
||||
this.objFunction = objFunction;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -23,6 +29,10 @@ public enum ConditionOp{
|
||||
return symbol;
|
||||
}
|
||||
|
||||
interface CondObjOpLambda{
|
||||
boolean get(Object a, Object b);
|
||||
}
|
||||
|
||||
interface CondOpLambda{
|
||||
boolean get(double a, double b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user