Permalink
Browse files

Mark computers as changed when changing on state

Previously they were not marked as such, meaning computer state was not
broadcast to the client until blinking state changed.
  • Loading branch information...
SquidDev committed Nov 19, 2017
1 parent 53f1678 commit 7b1d29bf227778bd121d0151d03c452b79de5938
@@ -420,14 +420,14 @@ public void advance( double _dt )
}
}
public boolean pollChanged()
public boolean pollAndResetChanged()
{
return m_externalOutputChanged;
}
public void clearChanged()
{
m_externalOutputChanged = false;
synchronized( this )
{
boolean changed = m_externalOutputChanged;
m_externalOutputChanged = false;
return changed;
}
}
public boolean isBlinking()
@@ -688,6 +688,7 @@ private void startComputer()
return;
}
m_state = State.Starting;
m_externalOutputChanged = true;
m_ticksSinceStart = 0;
}
@@ -747,6 +748,7 @@ public void execute()
// Start a new state
m_state = State.Running;
m_externalOutputChanged = true;
synchronized( m_machine )
{
m_machine.handleEvent( null, null );
@@ -765,6 +767,7 @@ private void stopComputer( final boolean reboot )
return;
}
m_state = State.Stopping;
m_externalOutputChanged = true;
}
// Turn the computercraft off
@@ -828,6 +831,7 @@ public void execute()
}
m_state = State.Off;
m_externalOutputChanged = true;
if( reboot )
{
m_startRequested = true;
@@ -94,8 +94,7 @@ public void update()
super.update();
m_computer.advance( 0.05 );
m_changedLastFrame = m_changed || m_computer.pollChanged();
m_computer.clearChanged();
m_changedLastFrame = m_computer.pollAndResetChanged() || m_changed;
m_changed = false;
m_ticksSincePing++;

0 comments on commit 7b1d29b

Please sign in to comment.