private static Boolean Prefix(Player __instance, bool flashGuardStone)
 {
     if (Settings.isEnabled("AdvancedBuildingMode"))
     {
         ABM.PlayerInstance = __instance;
         ABM.run();
     }
     return(!ABM.isActive);
 }
示例#2
0
 private static Boolean Prefix(Player __instance, bool flashGuardStone)
 {
     if (Configuration.Current.AdvancedBuildingMode.IsEnabled)
     {
         ABM.PlayerInstance = __instance;
         ABM.run();
     }
     if (ABM.isActive)
         return false;
     return true;
 }
示例#3
0
        private static void Postfix(Player __instance)
        {
            if (Configuration.Current.AdvancedEditingMode.IsEnabled)
            {
                AEM.PlayerInstance = __instance;
                AEM.run();
            }

            if (Configuration.Current.AdvancedBuildingMode.IsEnabled)
            {
                ABM.PlayerInstance = __instance;
                ABM.run();
            }
        }
        public static void run()
        {
            if (AEM.isActive)
            {
                if (isActive)
                {
                    exitMode();
                }
                return;
            }

            if (Input.GetKeyDown(Settings.getHotkey("exitAdvancedBuildingMode")))
            {
                if (isActive)
                {
                    exitMode();
                }
                return;
            }

            if (exitOnNextIteration)
            {
                isActive             = false;
                blockDefaultFunction = false;
                exitOnNextIteration  = false;
                component            = null;
            }

            if (isActive && component == null)
            {
                if (isActive)
                {
                    exitMode();
                }
                return;
            }

            // Check if prefab selected (build pieces) & ghost is ready
            if (selectedPrefab() == null || PlayerInstance.m_placementGhost == null || PlayerInstance.m_buildPieces == null)
            {
                if (isActive)
                {
                    exitMode();
                }
                return;
            }

            // Check if Build Mode && Correct build mode
            if (isInBuildMode() && IsHoeOrTerrainTool(selectedPrefab()))
            {
                if (isActive)
                {
                    exitMode();
                }
                return;
            }



            if (isActive)
            {
                // Maximum distance between player and placed piece
                if (Vector3.Distance(PlayerInstance.transform.position, component.transform.position) > PlayerInstance.m_maxPlaceDistance)
                {
                    exitMode();
                }
                ABM.isRunning();
                // DO WORK WHEN ALREADY STARTED
                listenToHotKeysAndDoWork();
            }
            else
            {
                if (Input.GetKeyDown(Settings.getHotkey("enterAdvancedBuildingMode")))
                {
                    startMode();
                }
            }
        }