示例#1
0
        public static void Postfix(UpgradeConsole __instance)
        {
            if (ModuleDisplayIconCollection.IsRegistered(__instance))
            {
                return;
            }

            var rotation = Quaternion.Euler(0f, 155f, 90f);

            Equipment modules = __instance.modules;

            const float topRowX = -0.124f;
            const float botRowX = -0.271f;

            const float rigtColY = 0.151f;
            const float middColY = 0f;
            const float leftColY = -rigtColY;

            const float topRowZ = 1.18f;
            const float botRowZ = 1.1f;

            Canvas moduleDisplay1 = IconCreator.CreateModuleDisplay(__instance.gameObject, new Vector3(topRowX, leftColY, topRowZ), rotation, modules.GetTechTypeInSlot("Module1"));
            Canvas moduleDisplay2 = IconCreator.CreateModuleDisplay(__instance.gameObject, new Vector3(topRowX, middColY, topRowZ), rotation, modules.GetTechTypeInSlot("Module2"));
            Canvas moduleDisplay3 = IconCreator.CreateModuleDisplay(__instance.gameObject, new Vector3(topRowX, rigtColY, topRowZ), rotation, modules.GetTechTypeInSlot("Module3"));

            Canvas moduleDisplay4 = IconCreator.CreateModuleDisplay(__instance.gameObject, new Vector3(botRowX, leftColY, botRowZ), rotation, modules.GetTechTypeInSlot("Module4"));
            Canvas moduleDisplay5 = IconCreator.CreateModuleDisplay(__instance.gameObject, new Vector3(botRowX, middColY, botRowZ), rotation, modules.GetTechTypeInSlot("Module5"));
            Canvas moduleDisplay6 = IconCreator.CreateModuleDisplay(__instance.gameObject, new Vector3(botRowX, rigtColY, botRowZ), rotation, modules.GetTechTypeInSlot("Module6"));

            ModuleDisplayIconCollection.Register(__instance, moduleDisplay1, moduleDisplay2, moduleDisplay3, moduleDisplay4, moduleDisplay5, moduleDisplay6);

            QuickLogger.Debug("Added module display icons to Cyclops engine room");
        }
        // Forgive me father for I have sinned
        // someone replace this horrid code.... maybe loop through types and reflect them all OR circumvent the need for this

        public static Optional <Equipment> GetBasedOnOwnersType(GameObject owner)
        {
            Charger charger = owner.GetComponent <Charger>();

            if (charger != null)
            {
                return(Optional <Equipment> .Of((Equipment)charger.ReflectionGet("equipment")));
            }

            BaseNuclearReactor baseNuclearReactor = owner.GetComponent <BaseNuclearReactor>();

            if (baseNuclearReactor != null)
            {
                return(Optional <Equipment> .Of((Equipment)baseNuclearReactor.ReflectionGet("_equipment")));
            }

            CyclopsDecoyLoadingTube cyclopsDecoyLoadingTube = owner.GetComponent <CyclopsDecoyLoadingTube>();

            if (cyclopsDecoyLoadingTube != null)
            {
                return(Optional <Equipment> .Of(cyclopsDecoyLoadingTube.decoySlots));
            }

            Exosuit exosuit = owner.GetComponent <Exosuit>();

            if (exosuit != null)
            {
                return(Optional <Equipment> .Of(exosuit.modules));
            }

            SeaMoth seamoth = owner.GetComponent <SeaMoth>();

            if (seamoth != null)
            {
                return(Optional <Equipment> .Of(seamoth.modules));
            }

            UpgradeConsole upgradeConsole = owner.GetComponent <UpgradeConsole>();

            if (upgradeConsole != null)
            {
                return(Optional <Equipment> .Of(upgradeConsole.modules));
            }

            Vehicle vehicle = owner.GetComponent <Vehicle>();

            if (vehicle != null)
            {
                return(Optional <Equipment> .Of(vehicle.modules));
            }

            VehicleUpgradeConsoleInput vehicleUpgradeConsoleInput = owner.GetComponent <VehicleUpgradeConsoleInput>();

            if (vehicleUpgradeConsoleInput != null)
            {
                return(Optional <Equipment> .Of(vehicleUpgradeConsoleInput.equipment));
            }

            return(Optional <Equipment> .Empty());
        }
示例#3
0
        public static bool Prefix(UpgradeConsole __instance, string slot, InventoryItem item)
        {
            if (ModuleDisplayIconCollection.TryGetRegistered(__instance, out ModuleIconDisplay consoleIcons))
            {
                consoleIcons.DisableIcon(slot);

                GameObject modulePlug = ModuleDisplayIconCollection.GetModulePlug(__instance, slot);
                modulePlug.SetActive(false);

                return(false);
            }

            return(true);
        }
        public static void Postfix(ref CyclopsUpgradeConsoleHUDManager __instance)
        {
            UpgradeConsole upgradeConsole = __instance.subRoot.upgradeConsole;

            if (upgradeConsole == null)
            {
                return; // safety check
            }
            Equipment modules = upgradeConsole.modules;

            // This method was put here because it's hit much less often than UpdateThermalReactorCharge
            UpgradeConsoleCache.SyncUpgradeConsoles(__instance.subRoot, __instance.subRoot.GetAllComponentsInChildren <AuxUpgradeConsole>());

            PowerManager.UpdateConsoleHUD(__instance, modules, UpgradeConsoleCache.AuxUpgradeConsoles);
        }
示例#5
0
        public static void Postfix(ref CyclopsHelmHUDManager __instance)
        {
            if (!__instance.LOD.IsFull() ||         // can't see
                !__instance.subLiveMixin.IsAlive()) // dead
            {
                return;
            }

            UpgradeConsole upgradeConsole = __instance.subRoot.upgradeConsole;

            if (upgradeConsole == null)
            {
                return; // safety check
            }
            PowerManager.UpdateHelmHUD(ref __instance, upgradeConsole.modules, UpgradeConsoleCache.AuxUpgradeConsoles, ref lastReservePower);
        }
示例#6
0
        public static void Postfix(UpgradeConsole __instance)
        {
            PDA pda = Player.main.GetPDA();

            pda.onClose = new PDA.OnClose((PDA closingPda) => PdaOverlayManager.DisconnectFromPda());
        }
示例#7
0
 public static void Prefix(UpgradeConsole __instance)
 {
     PdaOverlayManager.StartConnectingToPda(__instance.modules);
 }