Return 1 for sensing dead in null objects

This commit is contained in:
Anuken 2021-03-08 09:52:36 -05:00
parent b2d16f69da
commit e1b0e07f3c
2 changed files with 9 additions and 7 deletions

View File

@ -636,6 +636,11 @@ public class LExecutor{
Object target = exec.obj(from);
Object sense = exec.obj(type);
if(target == null && sense == LAccess.dead){
exec.setnum(to, 1);
return;
}
//note that remote units/buildings can be sensed as well
if(target instanceof Senseable se){
if(sense instanceof Content co){

View File

@ -197,7 +197,7 @@ public class LogicBlock extends Block{
public LExecutor executor = new LExecutor();
public float accumulator = 0;
public Seq<LogicLink> links = new Seq<>();
public boolean checkedDuplicates = false, unboxed = false;
public boolean checkedDuplicates = false;
public void readCompressed(byte[] data, boolean relative){
DataInputStream stream = new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(data)));
@ -254,13 +254,10 @@ public class LogicBlock extends Block{
super.onProximityAdded();
//unbox buildings after reading
if(!unboxed){
for(var v : executor.vars){
if(v.objval instanceof BuildingBox b){
v.objval = world.build(b.pos);
}
for(var v : executor.vars){
if(v.objval instanceof BuildingBox b){
v.objval = world.build(b.pos);
}
unboxed = true;
}
}