Save unit variables in processors
This commit is contained in:
@@ -22,7 +22,7 @@ public class LAssembler{
|
||||
public LAssembler(){
|
||||
//instruction counter
|
||||
putVar("@counter").value = 0;
|
||||
//unix timestamp
|
||||
//timestamp
|
||||
putConst("@time", 0);
|
||||
//currently controlled unit
|
||||
putConst("@unit", null);
|
||||
|
||||
@@ -208,7 +208,7 @@ public class LExecutor{
|
||||
}
|
||||
|
||||
//binding to `null` was previously possible, but was too powerful and exploitable
|
||||
if(exec.obj(type) instanceof UnitType type){
|
||||
if(exec.obj(type) instanceof UnitType type && type.logicControllable){
|
||||
Seq<Unit> seq = exec.team.data().unitCache(type);
|
||||
|
||||
if(seq != null && seq.any()){
|
||||
@@ -222,7 +222,7 @@ public class LExecutor{
|
||||
//no units of this type found
|
||||
exec.setconst(varUnit, null);
|
||||
}
|
||||
}else if(exec.obj(type) instanceof Unit u && u.team == exec.team){
|
||||
}else if(exec.obj(type) instanceof Unit u && u.team == exec.team && u.type.logicControllable){
|
||||
//bind to specific unit object
|
||||
exec.setconst(varUnit, u);
|
||||
}else{
|
||||
|
||||
@@ -836,7 +836,7 @@ public class LStatements{
|
||||
i.left();
|
||||
int c = 0;
|
||||
for(UnitType item : Vars.content.units()){
|
||||
if(!item.unlockedNow() || item.isHidden()) continue;
|
||||
if(!item.unlockedNow() || item.isHidden() || !item.logicControllable) continue;
|
||||
i.button(new TextureRegionDrawable(item.uiIcon), Styles.cleari, iconSmall, () -> {
|
||||
type = "@" + item.name;
|
||||
field.setText(type);
|
||||
|
||||
Reference in New Issue
Block a user