private void processTick() { CurrentBlock = _train.CurrentBlock; if (CurrentBlock.hasStation()) { loadPassengers(); } if (AuthorityLimit <= 1) { SpeedInput = 0; } if (_distanceToStation > 0 && _distanceToStation < 3 && !_currentBlock.hasStation()) { SpeedInput = 0; } if (Train.CurrentVelocity < SpeedInput && Train.CurrentVelocity < SpeedLimit || Train.CurrentVelocity > SpeedInput && Train.CurrentVelocity > SpeedLimit) { if (SpeedInput > SpeedLimit) { sendPower(SpeedLimit); } if (SpeedInput <= SpeedLimit) { sendPower(SpeedInput); } } if (CurrentBlock != null && !CurrentBlock.Equals(Train.CurrentBlock)) { AuthorityLimit--; CurrentBlock = Train.CurrentBlock; checkLightsOn(); } }