public override void UpdateBeforeSimulation() { try { if (!EntityAlive()) { return; } var shield = ShieldOn(); if (shield != State.Active) { if (NotFailed) { if (Session.Enforced.Debug >= 2) { Log.Line($"FailState: {shield} - ShieldId [{Shield.EntityId}]"); } var up = shield != State.Lowered; var awake = shield != State.Sleep; var clear = up && awake; OfflineShield(clear, up); } else if (DsState.State.Message) { ShieldChangeState(); } return; } if (!_isServer || !DsState.State.Online) { return; } if (_comingOnline) { ComingOnlineSetup(); } if (_mpActive && (_forceBufferSync || _count == 29)) { var newPercentColor = UtilsStatic.GetShieldColorFromFloat(DsState.State.ShieldPercent); if (_forceBufferSync || newPercentColor != _oldPercentColor) { ShieldChangeState(); _oldPercentColor = newPercentColor; _forceBufferSync = false; } else if (_tick180) { ShieldChangeState(); } } if (Session.Instance.EmpWork.EventRunning) { AbsorbEmp(); } } catch (Exception ex) { Log.Line($"Exception in UpdateBeforeSimulation: {ex}"); } }
public override void UpdateBeforeSimulation() { try { if (!EntityAlive()) { return; } if (!ShieldOn()) { //if (Session.Enforced.Debug == 3 && WasOnline) Log.Line($"Off: WasOn:{WasOnline} - Online:{DsState.State.Online}({_prevShieldActive}) - Lowered:{DsState.State.Lowered} - ShieldCharge:{DsState.State.Charge} - Sus:{DsState.State.Suspended} - EW:{DsState.State.EmitterWorking} - Perc:{DsState.State.ShieldPercent} - Wake:{DsState.State.Waking} - ShieldId [{Shield.EntityId}]"); if (WasOnline) { OfflineShield(); } else if (DsState.State.Message) { ShieldChangeState(); } return; } if (DsState.State.Online) { if (_comingOnline) { ComingOnlineSetup(); } if (_isServer) { var createHeTiming = _count == 6 && (_lCount == 1 || _lCount == 6); if (GridIsMobile && createHeTiming) { CreateHalfExtents(); } if (_syncEnts) { SyncThreadedEnts(); } if (_mpActive && (_forceBufferSync || _count == 29)) { var newPercentColor = UtilsStatic.GetShieldColorFromFloat(DsState.State.ShieldPercent); if (_forceBufferSync || newPercentColor != _oldPercentColor) { ShieldChangeState(); _oldPercentColor = newPercentColor; _forceBufferSync = false; } else if (_lCount == 7 && _eCount == 7) { ShieldChangeState(); } } } else if (_syncEnts) { SyncThreadedEnts(); } if (!_isDedicated && (_tick60 || Session.Instance.HudIconReset)) { HudCheck(); } } } catch (Exception ex) { Log.Line($"Exception in UpdateBeforeSimulation: {ex}"); } }
public override void UpdateBeforeSimulation() { try { if (!EntityAlive() || !_isServer && !ClientInitPacket) { return; } if (!_isDedicated && _clientMessageCount < DsState.State.MessageCount) { BroadcastMessage(); } var shield = ShieldOn(); if (shield != State.Active) { if (NotFailed) { if (Session.Enforced.Debug >= 2) { Log.Line($"FailState: {shield} - ShieldId [{Shield.EntityId}]"); } var up = shield != State.Lowered; var awake = shield != State.Sleep; var clear = up && awake; OfflineShield(clear, up); } else if (_isServer && _sendMessage) { ShieldChangeState(); } return; } if (!_isServer) { return; } if (!DsState.State.Online && DsState.State.ActiveEmitterId != 0 && _tick600) { ShieldChangeState(); return; } if (_comingOnline) { ComingOnlineSetup(); } if (_mpActive && (_forceBufferSync || _count == 29 || _tick180)) { var newPercentColor = UtilsStatic.GetShieldColorFromFloat(DsState.State.ShieldPercent); if (_forceBufferSync || newPercentColor != _oldPercentColor) { ShieldChangeState(); _oldPercentColor = newPercentColor; _forceBufferSync = false; } else if (_tick180) { ShieldChangeState(); } } } catch (Exception ex) { Log.Line($"Exception in UpdateBeforeSimulation: {ex}"); } }
private void BlockMoveAnimation() { var percent = ShieldComp.DefenseShields.DsState.State.ShieldPercent; if (EmiState.State.Compact) { if (_count == 0) { EmissiveIntensity = 2; } if (_count < 30) { EmissiveIntensity += 1; } else { EmissiveIntensity -= 1; } MyCube.SetEmissiveParts(PlasmaEmissive, UtilsStatic.GetShieldColorFromFloat(percent), 0.1f * EmissiveIntensity); return; } if (_subpartRotor.Closed.Equals(true)) { BlockMoveAnimationReset(false); } RotationTime -= 1; if (AnimationLoop == 0) { TranslationTime = 0; } if (AnimationLoop < 299) { TranslationTime += 1; } else { TranslationTime -= 1; } if (_count == 0) { EmissiveIntensity = 2; } if (_count < 30) { EmissiveIntensity += 1; } else { EmissiveIntensity -= 1; } var rotationMatrix = MatrixD.CreateRotationY(0.025f * RotationTime); var matrix = rotationMatrix * MatrixD.CreateTranslation(0, Definition.BlockMoveTranslation * TranslationTime, 0); _subpartRotor.PositionComp.LocalMatrix = matrix; _subpartRotor.SetEmissiveParts(PlasmaEmissive, UtilsStatic.GetShieldColorFromFloat(percent), 0.1f * EmissiveIntensity); if (AnimationLoop++ == 599) { AnimationLoop = 0; } }
private void BlockMoveAnimation() { _blockReset = false; var percent = ShieldComp.DefenseShields.DsState.State.ShieldPercent; if (_compact) { if (_count == 0) { EmissiveIntensity = 2; } if (_count < 30) { EmissiveIntensity += 1; } else { EmissiveIntensity -= 1; } MyCube.SetEmissiveParts(PlasmaEmissive, UtilsStatic.GetShieldColorFromFloat(percent), 0.1f * EmissiveIntensity); return; } if (!MyCube.NeedsWorldMatrix) { MyCube.NeedsWorldMatrix = true; } if (SubpartRotor.Closed) { BlockReset(false); } RotationTime -= 1; if (AnimationLoop == 0) { TranslationTime = 0; } if (AnimationLoop < 299) { TranslationTime += 1; } else { TranslationTime -= 1; } if (_count == 0) { EmissiveIntensity = 2; } if (_count < 30) { EmissiveIntensity += 1; } else { EmissiveIntensity -= 1; } var rotationMatrix = Matrix.CreateRotationY(0.025f * RotationTime); var matrix = rotationMatrix * Matrix.CreateTranslation(0, Definition.BlockMoveTranslation * TranslationTime, 0); SubpartRotor.PositionComp.SetLocalMatrix(ref matrix, null, true); SubpartRotor.SetEmissiveParts(PlasmaEmissive, UtilsStatic.GetShieldColorFromFloat(percent), 0.1f * EmissiveIntensity); if (AnimationLoop++ == 599) { AnimationLoop = 0; } }