mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-13 09:17:28 +07:00
Object sense support / Bugfixes
This commit is contained in:
@ -8,8 +8,8 @@ public enum LogicOp{
|
||||
mul("*", (a, b) -> a * b),
|
||||
div("/", (a, b) -> a / b),
|
||||
mod("%", (a, b) -> a % b),
|
||||
equal("==", (a, b) -> Math.abs(a - b) < 0.000001 ? 1 : 0),
|
||||
notEqual("not", (a, b) -> Math.abs(a - b) < 0.000001 ? 0 : 1),
|
||||
equal("==", (a, b) -> Math.abs(a - b) < 0.000001 ? 1 : 0, (a, b) -> a == b ? 1 : 0),
|
||||
notEqual("not", (a, b) -> Math.abs(a - b) < 0.000001 ? 0 : 1, (a, b) -> a != b ? 1 : 0),
|
||||
lessThan("<", (a, b) -> a < b ? 1 : 0),
|
||||
lessThanEq("<=", (a, b) -> a <= b ? 1 : 0),
|
||||
greaterThan(">", (a, b) -> a > b ? 1 : 0),
|
||||
@ -41,16 +41,22 @@ public enum LogicOp{
|
||||
|
||||
public static final LogicOp[] all = values();
|
||||
|
||||
public final OpObjLambda2 objFunction2;
|
||||
public final OpLambda2 function2;
|
||||
public final OpLambda1 function1;
|
||||
public final boolean unary;
|
||||
public final String symbol;
|
||||
|
||||
LogicOp(String symbol, OpLambda2 function){
|
||||
this(symbol, function, null);
|
||||
}
|
||||
|
||||
LogicOp(String symbol, OpLambda2 function, OpObjLambda2 objFunction){
|
||||
this.symbol = symbol;
|
||||
this.function2 = function;
|
||||
this.function1 = null;
|
||||
this.unary = false;
|
||||
this.objFunction2 = objFunction;
|
||||
}
|
||||
|
||||
LogicOp(String symbol, OpLambda1 function){
|
||||
@ -58,6 +64,7 @@ public enum LogicOp{
|
||||
this.function1 = function;
|
||||
this.function2 = null;
|
||||
this.unary = true;
|
||||
this.objFunction2 = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -65,6 +72,10 @@ public enum LogicOp{
|
||||
return symbol;
|
||||
}
|
||||
|
||||
interface OpObjLambda2{
|
||||
double get(Object a, Object b);
|
||||
}
|
||||
|
||||
interface OpLambda2{
|
||||
double get(double a, double b);
|
||||
}
|
||||
|
Reference in New Issue
Block a user