public override void UpdateBeforeSimulation() { try { _tick = Session.Instance.Tick; _tick60 = _tick % 60 == 0; var wait = _isServer && !_tick60 && EmiState.State.Backup; MyGrid = MyCube.CubeGrid; if (wait || MyGrid?.Physics == null) { return; } IsStatic = MyGrid.IsStatic; Timing(); if (!ControllerLink()) { return; } if (!_isDedicated && UtilsStatic.DistanceCheck(Emitter, 1000, EmiState.State.BoundingRange)) { var blockCam = MyCube.PositionComp.WorldVolume; if (MyAPIGateway.Session.Camera.IsInFrustum(ref blockCam)) { BlockMoveAnimation(); } } } catch (Exception ex) { Log.Line($"Exception in UpdateBeforeSimulation: {ex}"); } }
public override void UpdateBeforeSimulation() { try { _tick = Session.Instance.Tick; _tock33 = _tick % 33 == 0; _tock34 = _tick % 34 == 0; if (_count++ == 59) { _count = 0; _tock60 = true; } else { _tock60 = false; } var wait = _isServer && _count != 0 && ModState.State.Backup; MyGrid = MyCube.CubeGrid; if (wait || MyGrid?.Physics == null) { return; } Timing(); if (!ModulatorReady()) { ModulatorOff(); return; } ModulatorOn(); if (!_isDedicated && UtilsStatic.DistanceCheck(Modulator, 1000, 1)) { var blockCam = MyCube.PositionComp.WorldVolume; if (MyAPIGateway.Session.Camera.IsInFrustum(ref blockCam) && ModState.State.Online) { BlockMoveAnimation(); } } if (_isServer) { UpdateStates(); } _firstRun = false; } catch (Exception ex) { Log.Line($"Exception in UpdateBeforeSimulation: {ex}"); } }