Example #1
0
        public static void OnClickBuilt(BuildTool_Click __instance)
        {
            if (UndoManager.IgnoreAllEvents.Value)
            {
                return;
            }
            if (NebulaModAPI.IsMultiplayerActive)
            {
                if (NebulaModAPI.MultiplayerSession.LocalPlayer.IsClient)
                {
                    return;
                }
            }

            IEnumerable <int> objectIds = __instance.buildPreviews.Select(preview => preview.objId);

            PlayerUndo data = UndoManager.GetCurrentPlayerData();

            data.AddUndoItem(new UndoBuild(data, objectIds));
        }
Example #2
0
        public static void OnUpgradePost(BuildTool_Upgrade __instance)
        {
            if (UndoManager.IgnoreAllEvents.Value)
            {
                return;
            }

            if (NebulaModAPI.IsMultiplayerActive)
            {
                if (NebulaModAPI.MultiplayerSession.LocalPlayer.IsClient)
                {
                    return;
                }
            }

            RecordUpgrades = false;

            if (upgradeList.Count > 0)
            {
                PlayerUndo data = UndoManager.GetCurrentPlayerData();
                data.AddUndoItem(new UndoUpgrade(data, upgradeList));
            }
        }