Basic setProp implementation

This commit is contained in:
Anuken
2023-03-09 05:25:35 -05:00
parent a857eaed74
commit bae3884d96
9 changed files with 264 additions and 8 deletions
+32
View File
@@ -1695,5 +1695,37 @@ public class LExecutor{
}
}
public static class SetPropI implements LInstruction{
public int type, of, value;
public SetPropI(int type, int of, int value){
this.type = type;
this.of = of;
this.value = value;
}
public SetPropI(){
}
@Override
public void run(LExecutor exec){
Object target = exec.obj(of);
Object key = exec.obj(type);
if(target instanceof Settable sp){
if(key instanceof LAccess property){
Var var = exec.var(value);
if(var.isobj){
sp.setProp(property, var.objval);
}else{
sp.setProp(property, var.numval);
}
}else if(key instanceof UnlockableContent content){
sp.setProp(content, exec.num(value));
}
}
}
}
//endregion
}