Extra mod field parsing (untested)

This commit is contained in:
Anuken
2020-10-07 11:00:02 -04:00
parent d4513fab19
commit be66a15287
10 changed files with 215 additions and 134 deletions

View File

@@ -182,20 +182,23 @@ public class LExecutor{
@Override
public void run(LExecutor exec){
Object typeObj = exec.obj(type);
UnitType type = typeObj instanceof UnitType t ? t : null;
Seq<Unit> seq = type == null ? exec.team.data().units : exec.team.data().unitCache(type);
//binding to `null` was previously possible, but was too powerful and exploitable
if(exec.obj(type) instanceof UnitType type){
Seq<Unit> seq = exec.team.data().unitCache(type);
if(seq != null && seq.any()){
index %= seq.size;
if(index < seq.size){
//bind to the next unit
exec.setconst(varUnit, seq.get(index));
if(seq != null && seq.any()){
index %= seq.size;
if(index < seq.size){
//bind to the next unit
exec.setconst(varUnit, seq.get(index));
}
index ++;
}else{
//no units of this type found
exec.setconst(varUnit, null);
}
index ++;
}else{
//no units of this type found
exec.setconst(varUnit, null);
}
}