private void BeforeInit() { if (Modulator.CubeGrid.Physics == null) { return; } _isServer = Session.Instance.IsServer; _isDedicated = Session.Instance.DedicatedServer; ResetComp(); Session.Instance.Modulators.Add(this); CreateUi(); ModUi.ComputeDamage(this, ModUi.GetDamage(Modulator)); Entity.TryGetSubpart("Rotor", out _subpartRotor); PowerInit(); Modulator.RefreshCustomInfo(); StateChange(true); if (!Session.Instance.ModAction) { Session.Instance.ModAction = true; Session.AppendConditionToAction <IMyUpgradeModule>((a) => Session.Instance.ModActions.Contains(a.Id), (a, b) => b.GameLogic.GetAs <Modulators>() != null && Session.Instance.ModActions.Contains(a.Id)); } MainInit = true; NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME; _bTime = _isDedicated ? 10 : 1; _bInit = true; }
public override void UpdateOnceBeforeFrame() { base.UpdateOnceBeforeFrame(); try { if (Modulator.CubeGrid.Physics == null) { return; } _isServer = Session.Instance.IsServer; _isDedicated = Session.Instance.DedicatedServer; ResetComp(); Session.Instance.Modulators.Add(this); CreateUi(); ModUi.ComputeDamage(this, ModUi.GetDamage(Modulator)); Entity.TryGetSubpart("Rotor", out _subpartRotor); PowerInit(); Modulator.RefreshCustomInfo(); StateChange(true); if (!Session.Instance.ModAction) { Session.Instance.ModAction = true; Session.AppendConditionToAction <IMyUpgradeModule>((a) => Session.Instance.ModActions.Contains(a.Id), (a, b) => b.GameLogic.GetAs <Modulators>() != null && Session.Instance.ModActions.Contains(a.Id)); } MainInit = true; } catch (Exception ex) { Log.Line($"Exception in UpdateOnceBeforeFrame: {ex}"); } }
internal void UpdateSettings(ModulatorSettingsValues newSettings) { if (newSettings.MId > ModSet.Settings.MId) { SettingsUpdated = true; if (ModSet.Settings.ModulateDamage != newSettings.ModulateDamage) { ModUi.ComputeDamage(this, newSettings.ModulateDamage); } ModSet.Settings = newSettings; if (Session.Enforced.Debug == 3) { Log.Line("UpdateSettings for modulator"); } } }
private void CreateUi() { ModUi.CreateUi(Modulator); }