Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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}"); }
        }
Esempio n. 3
0
        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");
                }
            }
        }
Esempio n. 4
0
 private void CreateUi()
 {
     ModUi.CreateUi(Modulator);
 }