Example #1
0
        private void Update()
        {
            //Save the old status.
            GameStatus oldStatus = api.Status;

            if (oldStatus == null)
            {
                oldStatus = new GameStatus();
            }

            GameStatus newStatus = GameStatus.FromFile(new FileInfo(api.JournalDirectory + "//Status.json"), api);

            if (newStatus == null || !File.Exists(api.JournalDirectory + "//Status.json"))
            {
                api.Logger.LogWarning("Could not update Status.json file."); return;
            }

            newStatus.InNoFireZone = InNoFireZone;
            newStatus.JumpRange    = JumpRange;
            newStatus.Fuel.MaxFuel = MaxFuel;
            newStatus.GameMode     = GameMode;
            newStatus.InMainMenu   = InMainMenu;
            newStatus.MusicTrack   = MusicTrack;

            if (newStatus.Docked)
            {
                newStatus.InNoFireZone = true;
            }

            //Set the new status.
            api.Status = newStatus;

            if (oldStatus == null)
            {
                return;
            }

            TriggerIfDifferent(oldStatus, newStatus);
        }