From cd6b076efe0ec22b89b7b374f80265248dd026fa Mon Sep 17 00:00:00 2001 From: SquidDev Date: Sat, 16 Sep 2017 20:09:51 +0100 Subject: [PATCH] Turn on ServerComputer instances if they have timed out --- .../shared/computer/blocks/TileComputerBase.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java b/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java index 8e3c999e0..f24988f27 100644 --- a/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java +++ b/src/main/java/dan200/computercraft/shared/computer/blocks/TileComputerBase.java @@ -37,6 +37,7 @@ public abstract class TileComputerBase extends TileGeneric protected String m_label; protected boolean m_on; protected boolean m_startOn; + protected boolean m_fresh; protected TileComputerBase() { @@ -45,6 +46,7 @@ public abstract class TileComputerBase extends TileGeneric m_label = null; m_on = false; m_startOn = false; + m_fresh = false; } @Override @@ -213,7 +215,7 @@ public abstract class TileComputerBase extends TileGeneric ServerComputer computer = createServerComputer(); if( computer != null ) { - if( m_startOn ) + if( m_startOn || (m_fresh && m_on) ) { computer.turnOn(); m_startOn = false; @@ -223,6 +225,7 @@ public abstract class TileComputerBase extends TileGeneric { updateOutput(); } + m_fresh = false; m_computerID = computer.getID(); m_label = computer.getLabel(); m_on = computer.isOn(); @@ -471,6 +474,7 @@ public abstract class TileComputerBase extends TileGeneric { ServerComputer computer = createComputer( m_instanceID, m_computerID ); ComputerCraft.serverComputerRegistry.add( m_instanceID, computer ); + m_fresh = true; changed = true; } if( changed )