/// <summary>
        /// INTERNAL ARM SPAWNING METHOD, DON'T OVERRIDE! Use ModifyGameObject() instead!
        /// Initializes the visual appearance of the arm in the open world or in the inventory.
        /// </summary>
        public override IEnumerator GetGameObjectAsync(IOut <GameObject> gameObject)
        {
            CoroutineTask <GameObject> request = CraftData.GetPrefabForTechTypeAsync(PrefabForClone);

            yield return(request);

            GameObject result = request.GetResult();

            if (result == null)
            {
                BZLogger.Warn("API message: Cannot instantiate prefab from TechType!");
                yield break;
            }

            PrefabClone = Object.Instantiate(result);

            PrefabClone.name = TechTypeName;

            if (ArmTemplate == ArmTemplate.ClawArm)
            {
                OverrideClawArm();
            }

            PrefabClone.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);

            PostModify();

            gameObject.Set(PrefabClone);

            yield break;
        }
Esempio n. 2
0
        internal static void SetKeyBindings()
        {
            KEYBINDINGS = new Dictionary <string, KeyCode>();

            bool sync = false;

            foreach (KeyValuePair <string, string> kvp in Section_hotkeys)
            {
                try
                {
                    KEYBINDINGS.Add(kvp.Key, InputHelper.StringToKeyCode(kvp.Value));
                }
                catch (ArgumentException)
                {
                    BZLogger.Warn($"({kvp.Value}) is not a valid KeyCode! Setting default value!");

                    for (int i = 0; i < DEFAULT_CONFIG.Count; i++)
                    {
                        if (DEFAULT_CONFIG[i].Key.Equals(kvp.Key))
                        {
                            KEYBINDINGS.Add(kvp.Key, InputHelper.StringToKeyCode(DEFAULT_CONFIG[i].Value));
                            sync = true;
                        }
                    }
                }
            }

            if (sync)
            {
                SyncConfig();
            }
        }
        internal static void SetKeyBindings()
        {
            KEYBINDINGS = new Dictionary <string, KeyCode>();

            bool sync = false;

            foreach (KeyValuePair <string, string> kvp in Section_hotkeys)
            {
                try
                {
                    KeyCode keyCode = (KeyCode)Enum.Parse(typeof(KeyCode), kvp.Value);
                    KEYBINDINGS.Add(kvp.Key, keyCode);
                }
                catch (ArgumentException)
                {
                    BZLogger.Warn(PROGRAM_NAME, $"({kvp.Value}) is not a valid KeyCode! Setting default value!");

                    for (int i = 0; i < DEFAULT_CONFIG.Count; i++)
                    {
                        if (DEFAULT_CONFIG[i].Key.Equals(kvp.Key))
                        {
                            KEYBINDINGS.Add(kvp.Key, (KeyCode)Enum.Parse(typeof(KeyCode), DEFAULT_CONFIG[i].Value, true));
                            sync = true;
                        }
                    }
                }
            }

            if (sync)
            {
                SyncConfig();
            }
        }
Esempio n. 4
0
        internal static void KEYBINDINGS_Set()
        {
            BZLogger.Debug("Method call: SEConfig.KEYBINDINGS_Set()");

            KEYBINDINGS = new Dictionary <string, KeyCode>();

            bool sync = false;

            foreach (KeyValuePair <string, string> kvp in Hotkeys_Config)
            {
                try
                {
                    KEYBINDINGS.Add(kvp.Key, InputHelper.StringToKeyCode(kvp.Value));
                }
                catch (ArgumentException)
                {
                    BZLogger.Warn($"[{kvp.Value}] is not a valid KeyCode! Setting default value!");

                    for (int i = 0; i < DEFAULT_CONFIG.Count; i++)
                    {
                        if (DEFAULT_CONFIG[i].Key.Equals(kvp.Key))
                        {
                            KEYBINDINGS.Add(kvp.Key, InputHelper.StringToKeyCode(DEFAULT_CONFIG[i].Value));
                            sync = true;
                        }
                    }
                }
            }

            if (sync)
            {
                KEYBINDINGS_ToConfig();
            }
        }
        private IEnumerator AssignKey(object keyName)
        {
            waitingForKey = true;

            yield return(WaitForKey());

            int isFirst  = 0;
            int keyCount = 0;

            for (int i = 0; i < hotkeyButtons.Count; i++)
            {
                if (hotkeyButtons[i].Equals(newKey))
                {
                    if (keyCount == 0)
                    {
                        isFirst = i;
                    }

                    keyCount++;
                }
            }

            if (keyCount > 0 && isFirst != selected)
            {
                BZLogger.Warn("Duplicate keybind found, swapping keys...");
                hotkeyButtons[isFirst]        = hotkeyButtons[selected];
                guiItem_Buttons[isFirst].Name = hotkeyButtons[selected];
            }

            hotkeyButtons[selected]        = newKey;
            guiItem_Buttons[selected].Name = hotkeyButtons[selected];
            selected = -1;

            yield return(null);
        }
Esempio n. 6
0
 private void ClearEquipment()
 {
     foreach (Battery battery in EquipmentRoot.GetComponentsInChildren <Battery>(true))
     {
         BZLogger.Warn($"Removing unassigned Battery: {battery.GetComponent<PrefabIdentifier>().Id}");
         DestroyImmediate(battery.gameObject);
     }
 }
        internal static void CreateDefaultConfigFile()
        {
            BZLogger.Warn("Configuration file is missing or wrong version. Creating a new one.");

            try
            {
                ParserHelper.CreateDefaultConfigFile(FILENAME, PROGRAM_NAME, PROGRAM_VERSION, DEFAULT_CONFIG);
            }
            catch
            {
                BZLogger.Error("Creating new configuration file has failed!");
            }
        }
Esempio n. 8
0
        internal static void CreateDefaultConfigFile()
        {
            BZLogger.Warn("Configuration file is missing or wrong version. Trying to create a new one.");

            try
            {
                ParserHelper.CreateDefaultConfigFile(FILENAME, "QuickSlotExtenderZero", PROGRAM_VERSION, DEFAULT_CONFIG);
                ParserHelper.AddInfoText(FILENAME, SECTIONS[1], "TextColor possible values: Red, Green, Blue, Yellow, White, Magenta, Cyan, Orange, Lime, Amethyst");

                BZLogger.Log("The new configuration file was successfully created.");
            }
            catch
            {
                BZLogger.Error("An error occured while creating the new configuration file!");
            }
        }
Esempio n. 9
0
        private IEnumerator LoadBiodomeRobotArmResourcesAsync()
        {
            IPrefabRequest request = PrefabDatabase.GetPrefabForFilenameAsync("WorldEntities/Alterra/Base/biodome_Robot_Arm.prefab");

            yield return(request);

            if (!request.TryGetPrefab(out robotArmResource))
            {
                BZLogger.Warn("Cannot load [biodome_robot_arm] prefab!");
                yield break;
            }

            BZLogger.Debug("Resource loaded: [biodome_robot_arm]");

            Utils.ZeroTransform(robotArmResource.transform);

            yield break;
        }
Esempio n. 10
0
        private IEnumerator LoadExosuitResourcesAsync()
        {
            IPrefabRequest request = PrefabDatabase.GetPrefabForFilenameAsync("WorldEntities/Tools/Exosuit.prefab");

            yield return(request);

            if (!request.TryGetPrefab(out GameObject prefab))
            {
                BZLogger.Warn("API message: Cannot load [Exosuit] prefab!");
                yield break;
            }

            exosuitResource = UWE.Utils.InstantiateDeactivated(prefab, GraphicsRoot.transform, Vector3.zero, Quaternion.identity);

            exosuitResource.GetComponent <Exosuit>().enabled       = false;
            exosuitResource.GetComponent <Rigidbody>().isKinematic = true;
            exosuitResource.GetComponent <WorldForces>().enabled   = false;
            UWE.Utils.ZeroTransform(exosuitResource.transform);

            yield break;
        }
Esempio n. 11
0
        internal static void Config_CreateDefault()
        {
            BZLogger.Debug("Method call: SEzConfig.Config_CreateDefault()");

            BZLogger.Warn("Configuration file is missing or wrong version. Trying to create a new one.");

            try
            {
                ParserHelper.CreateDefaultConfigFile(FILENAME, "SlotExtenderZero", PROGRAM_VERSION, DEFAULT_CONFIG);

                ParserHelper.AddInfoText(FILENAME, "MaxSlots possible values", "5 to 12");
                ParserHelper.AddInfoText(FILENAME, "TextColor possible values", "Red, Green, Blue, Yellow, White, Magenta, Cyan, Orange, Lime, Amethyst");
                ParserHelper.AddInfoText(FILENAME, "SlotLayout possible values", "Grid, Circle");

                BZLogger.Log("The new configuration file was successfully created.");
            }
            catch
            {
                BZLogger.Error("An error occured while creating the new configuration file!");
            }
        }
Esempio n. 12
0
        public override IEnumerator GetGameObjectAsync(IOut <GameObject> gameObject)
        {
            CoroutineTask <GameObject> request = CraftData.GetPrefabForTechTypeAsync(PrefabTemplate);

            yield return(request);

            GameObject result = request.GetResult();

            if (result == null)
            {
                BZLogger.Warn($"{TechTypeName} : Cannot instantiate prefab from TechType!");
                yield break;
            }

            GameObjectClone = Object.Instantiate(result);

            ModifyGameObject();

            gameObject.Set(GameObjectClone);

            yield break;
        }