1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-27 01:14:46 +00:00

Turn on ServerComputer instances if they have timed out

This commit is contained in:
SquidDev 2017-09-16 20:09:51 +01:00
parent 1c8480a329
commit cd6b076efe

View File

@ -37,6 +37,7 @@ public abstract class TileComputerBase extends TileGeneric
protected String m_label; protected String m_label;
protected boolean m_on; protected boolean m_on;
protected boolean m_startOn; protected boolean m_startOn;
protected boolean m_fresh;
protected TileComputerBase() protected TileComputerBase()
{ {
@ -45,6 +46,7 @@ public abstract class TileComputerBase extends TileGeneric
m_label = null; m_label = null;
m_on = false; m_on = false;
m_startOn = false; m_startOn = false;
m_fresh = false;
} }
@Override @Override
@ -213,7 +215,7 @@ public abstract class TileComputerBase extends TileGeneric
ServerComputer computer = createServerComputer(); ServerComputer computer = createServerComputer();
if( computer != null ) if( computer != null )
{ {
if( m_startOn ) if( m_startOn || (m_fresh && m_on) )
{ {
computer.turnOn(); computer.turnOn();
m_startOn = false; m_startOn = false;
@ -223,6 +225,7 @@ public abstract class TileComputerBase extends TileGeneric
{ {
updateOutput(); updateOutput();
} }
m_fresh = false;
m_computerID = computer.getID(); m_computerID = computer.getID();
m_label = computer.getLabel(); m_label = computer.getLabel();
m_on = computer.isOn(); m_on = computer.isOn();
@ -471,6 +474,7 @@ public abstract class TileComputerBase extends TileGeneric
{ {
ServerComputer computer = createComputer( m_instanceID, m_computerID ); ServerComputer computer = createComputer( m_instanceID, m_computerID );
ComputerCraft.serverComputerRegistry.add( m_instanceID, computer ); ComputerCraft.serverComputerRegistry.add( m_instanceID, computer );
m_fresh = true;
changed = true; changed = true;
} }
if( changed ) if( changed )