Esempio n. 1
0
        public static void PlayerAction_Build_SetCopyInfo_Postfix(ref PlayerAction_Build __instance, int objectId)
        {
            if (bpMode)
            {
                EndBpMode(true);
            }
            BlueprintManager.PrepareNew();
            if (objectId < 0)
            {
                return;
            }

            var itemProto = LDB.items.Select(__instance.factory.entityPool[objectId].protoId);

            if (itemProto.prefabDesc.insertPoses.Length > 0)
            {
                BlueprintManager.Copy(objectId);

                if (BlueprintManager.hasData)
                {
                    BlueprintManager.data.copiedBuildings[0].recipeId = __instance.copyRecipeId;
                    __instance.yaw = 0f;
                }
            }
        }
Esempio n. 2
0
        public static void UpdateCommandState_Prefix(PlayerController __instance)
        {
            if (__instance.cmd.type != ECommand.None && __instance.cmd.type != ECommand.Follow &&
                (__instance.cmd.mode != lastCmdMode || __instance.cmd.type != lastCmdType))
            {
                if (__instance.cmd.type != ECommand.Build || __instance.cmd.mode != 1)
                {
                    BuildLogic.ResetMultiBuild();
                }
                if (__instance.cmd.type != ECommand.Build || __instance.cmd.mode != 0)
                {
                    BlueprintCreator.EndBpMode();
                }

                // the preivous command might force us to stau in BuildMode (Even though we were leaving)
                if (__instance.cmd.type == ECommand.Build && lastCmdMode == 1 && __instance.cmd.mode != 1)
                {
                    BlueprintManager.PrepareNew();
                }

                if (__instance.cmd.type != ECommand.Build)
                {
                    BlueprintManager.PrepareNew();
                }

                lastCmdMode = __instance.cmd.mode;
                lastCmdType = __instance.cmd.type;
            }
        }
Esempio n. 3
0
 internal void OnDestroy()
 {
     // For ScriptEngine hot-reloading
     BlueprintCreator.EndBpMode(true);
     BlueprintManager.PrepareNew();
     foreach (var tooltip in tooltips.Values)
     {
         allTips.Remove(tooltip);
     }
     harmony.UnpatchSelf();
 }
Esempio n. 4
0
        public static void StartBpMode()
        {
            if (bpMode)
            {
                return;
            }

            bpMode = true;
            var actionBuild = GameMain.data.mainPlayer.controller.actionBuild;

            actionBuild.altitude = 0;
            actionBuild.player.SetHandItems(0, 0, 0);
            actionBuild.controller.cmd.type = ECommand.Build;
            actionBuild.controller.cmd.mode = 0;

            BuildLogic.lastPosition = Vector3.zero;
            BlueprintManager.PrepareNew();
        }