Пример #1
0
        public override void UpdateOnceBeforeFrame()
        {
            try
            {
                if (Drill.CubeGrid.Physics?.Enabled != true || !Networker.Inited)
                {
                    NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
                    if (!Networker.Inited)
                    {
                        Networker.Init(SessionCore.ModID);
                    }
                    return;
                }
                SyncHarvestEfficiency = new Syncer <float>(Drill, "HarvestEfficiency", 1, Checker: val => val >= 1 && val <= 4);
                SyncHarvestEfficiency.GotValueFromServer += Drill.UpdateVisual;
                Drill.PowerConsumptionMultiplier          = PowerConsumptionMultiplier();

                CheckInitControls();
                Load();

                SessionCore.SaveRegister(Save);
                NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
                DebugNote    = MyAPIGateway.Utilities.CreateNotification($"{Drill?.CustomName}", int.MaxValue, "Blue");
                Owner        = MyAPIGateway.Players.GetPlayer(Drill.OwnerId);
                if (SessionCore.Settings.Debug)
                {
                    DebugNote.Show();
                }
            }
            catch { }
        }
Пример #2
0
 public override void Init()
 {
     try
     {
         SessionCore.SaveRegister(Save);
     }
     catch (Exception Scrap)
     {
         SessionCore.LogError($"{Tool.CustomName}.Persistence.Init()", Scrap);
     }
 }
Пример #3
0
        public override void UpdateOnceBeforeFrame()
        {
            try
            {
                if (Tool.CubeGrid.Physics?.Enabled != true || !Networker.Inited)
                {
                    NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
                    if (!Networker.Inited)
                    {
                        Networker.Init(SessionCore.ModID);
                    }
                    return;
                }
                ToolCargo = Tool.GetInventory();

                SyncBeamLength      = new AutoSet <float>(Tool, "BeamLength", 1, Checker: val => val >= MinBeamLengthBlocks && val <= MaxBeamLengthBlocks);
                SyncDistanceMode    = new AutoSet <bool>(Tool, "DistanceBasedMode");
                SyncSpeedMultiplier = new AutoSet <float>(Tool, "SpeedMultiplier", 1, Checker: val => val >= 1 && val <= 4);
                SyncBeamLength.GotValueFromServer      += Tool.UpdateVisual;
                SyncDistanceMode.GotValueFromServer    += Tool.UpdateVisual;
                SyncSpeedMultiplier.GotValueFromServer += Tool.UpdateVisual;

                CheckInitControls();
                Load();

                Tool.AppendingCustomInfo += Tool_AppendingCustomInfo;
                SessionCore.SaveRegister(Save);
                NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME | MyEntityUpdateEnum.EACH_100TH_FRAME;
                DebugNote    = MyAPIGateway.Utilities.CreateNotification($"{Tool.CustomName}", int.MaxValue, (IsWelder ? "Blue" : "Red"));
                Owner        = MyAPIGateway.Players.GetPlayer(Tool.OwnerId);
                if (SessionCore.Debug)
                {
                    DebugNote.Show();
                }
            }
            catch { }
        }