Fixed #10280
This commit is contained in:
@@ -377,13 +377,15 @@ public class LogicBlock extends Block{
|
|||||||
asm.putConst("@links", executor.links.length);
|
asm.putConst("@links", executor.links.length);
|
||||||
asm.putConst("@ipt", instructionsPerTick);
|
asm.putConst("@ipt", instructionsPerTick);
|
||||||
|
|
||||||
|
Object oldUnit = null;
|
||||||
|
|
||||||
if(keep){
|
if(keep){
|
||||||
|
oldUnit = executor.unit.objval;
|
||||||
//store any older variables
|
//store any older variables
|
||||||
for(LVar var : executor.vars){
|
for(LVar var : executor.vars){
|
||||||
boolean unit = var.name.equals("@unit");
|
if(!var.constant){
|
||||||
if(!var.constant || unit){
|
|
||||||
LVar dest = asm.getVar(var.name);
|
LVar dest = asm.getVar(var.name);
|
||||||
if(dest != null && (!dest.constant || unit)){
|
if(dest != null && !dest.constant){
|
||||||
dest.isobj = var.isobj;
|
dest.isobj = var.isobj;
|
||||||
dest.objval = var.objval;
|
dest.objval = var.objval;
|
||||||
dest.numval = var.numval;
|
dest.numval = var.numval;
|
||||||
@@ -395,6 +397,10 @@ public class LogicBlock extends Block{
|
|||||||
//inject any extra variables
|
//inject any extra variables
|
||||||
if(assemble != null){
|
if(assemble != null){
|
||||||
assemble.get(asm);
|
assemble.get(asm);
|
||||||
|
|
||||||
|
if(oldUnit == null && asm.getVar("@unit") != null && asm.getVar("@unit").objval instanceof Unit u){
|
||||||
|
oldUnit = u;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
asm.getVar("@this").setconst(this);
|
asm.getVar("@this").setconst(this);
|
||||||
@@ -402,6 +408,8 @@ public class LogicBlock extends Block{
|
|||||||
asm.putConst("@thisy", World.conv(y));
|
asm.putConst("@thisy", World.conv(y));
|
||||||
|
|
||||||
executor.load(asm);
|
executor.load(asm);
|
||||||
|
executor.unit.objval = oldUnit;
|
||||||
|
executor.unit.isobj = true;
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
//handle malformed code and replace it with nothing
|
//handle malformed code and replace it with nothing
|
||||||
executor.load(LAssembler.assemble(code = "", privileged));
|
executor.load(LAssembler.assemble(code = "", privileged));
|
||||||
|
|||||||
Reference in New Issue
Block a user