Objective flag system
This commit is contained in:
@@ -1498,5 +1498,26 @@ public class LExecutor{
|
||||
}
|
||||
}
|
||||
|
||||
public static class GetFlagI implements LInstruction{
|
||||
public int result, flag;
|
||||
|
||||
public GetFlagI(int result, int flag){
|
||||
this.result = result;
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
public GetFlagI(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
if(exec.obj(flag) instanceof String str){
|
||||
exec.setbool(result, state.rules.objectiveFlags.contains(str));
|
||||
}else{
|
||||
exec.setobj(result, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
||||
@@ -1514,4 +1514,33 @@ public class LStatements{
|
||||
return new FetchI(type, builder.var(result), builder.var(team), builder.var(index));
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterStatement("getflag")
|
||||
public static class GetFlagStatement extends LStatement{
|
||||
public String result = "result", flag = "\"flag\"";
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
fields(table, result, str -> result = str);
|
||||
|
||||
table.add(" = flag ");
|
||||
|
||||
fields(table, flag, str -> flag = str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean privileged(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color color(){
|
||||
return Pal.logicWorld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LInstruction build(LAssembler builder){
|
||||
return new GetFlagI(builder.var(result), builder.var(flag));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user