Пример #1
0
        public void SlotArmHeld()
        {
#if OUTSIDE_TEST_ENABLED
#else
            if (!Player.main.inSeamoth || !AvatarInputHandler.main.IsEnabled())
            {
                return;
            }
#endif
            if (!seamoth.IsPowered())
            {
                return;
            }

            if (currentSelectedArm == Arm.Left)
            {
                if (!leftButtonDownProcessed)
                {
                    return;
                }

                if (seamoth.GetSlotProgress(LeftArmSlotID) != 1f)
                {
                    return;
                }

                QuickSlotType quickSlotType = CraftData.GetQuickSlotType(currentLeftArmType);

                if (quickSlotType == QuickSlotType.Selectable && leftArm.OnUseHeld(out float coolDown))
                {
                    quickSlotTimeUsed[LeftArmSlotID] = Time.time;
                    quickSlotCooldown[LeftArmSlotID] = coolDown;
                }
            }
            else if (currentSelectedArm == Arm.Right)
            {
                if (!rightButtonDownProcessed)
                {
                    return;
                }

                if (seamoth.GetSlotProgress(RightArmSlotID) != 1f)
                {
                    return;
                }

                QuickSlotType quickSlotType = CraftData.GetQuickSlotType(currentRightArmType);

                if (quickSlotType == QuickSlotType.Selectable && rightArm.OnUseHeld(out float coolDown))
                {
                    quickSlotTimeUsed[RightArmSlotID] = Time.time;
                    quickSlotCooldown[RightArmSlotID] = coolDown;
                }
            }
        }
Пример #2
0
        protected ModPrefab_Craftable(
            string nameID,
            string iconFilePath,
            TechType iconTechType,
            string friendlyName,
            string description,
            TechType template,
            TabNode newTabNode,
            CraftTree.Type[] fabricatorTypes,
            string[][] fabricatorTabs,
            TechType requiredAnalysis,
            TechGroup groupForPDA,
            TechCategory categoryForPDA,
            EquipmentType equipmentType,
            QuickSlotType quickSlotType,
            CraftData.BackgroundType backgroundType,
            Vector2int itemSize,
            string gamerResourceFileName,
            ModPrefab_Fragment fragment
            )
            : base(nameID, $"{nameID}:Prefab")
        {
            NameID               = nameID;
            IconFilePath         = iconFilePath;
            IconTechType         = iconTechType;
            FriendlyName         = friendlyName;
            Description          = description;
            PrefabTemplate       = template;
            NewTabNode           = newTabNode;
            FabricatorTypes      = fabricatorTypes;
            FabricatorTabs       = fabricatorTabs;
            RequiredForUnlock    = requiredAnalysis;
            GroupForPDA          = groupForPDA;
            CategoryForPDA       = categoryForPDA;
            TypeForEquipment     = equipmentType;
            TypeForQuickslot     = quickSlotType;
            BackgroundType       = backgroundType;
            ItemSize             = itemSize;
            GameResourceFileName = gamerResourceFileName;
            _Fragment            = fragment;

            //IngameMenuHandler.Main.RegisterOnQuitEvent(OnQuitEvent);
        }
Пример #3
0
 protected CraftableModItem(
     string nameID,
     string iconFileName,
     TechType iconTechType,
     string friendlyName,
     string description,
     TechType template,
     CraftTree.Type fabricatorType,
     string[] fabricatorTab,
     TechType requiredAnalysis,
     TechGroup groupForPDA,
     TechCategory categoryForPDA,
     EquipmentType equipmentType,
     QuickSlotType quickSlotType,
     CraftData.BackgroundType backgroundType,
     Vector2int itemSize,
     string gamerResourceFileName
     )
     : base(nameID, $"{nameID}Prefab")
 {
     NameID               = nameID;
     IconFilename         = iconFileName;
     IconTechType         = iconTechType;
     FriendlyName         = friendlyName;
     Description          = description;
     PrefabTemplate       = template;
     FabricatorType       = fabricatorType;
     FabricatorTab        = fabricatorTab;
     RequiredForUnlock    = requiredAnalysis;
     GroupForPDA          = groupForPDA;
     CategoryForPDA       = categoryForPDA;
     TypeForEquipment     = equipmentType;
     TypeForQuickslot     = quickSlotType;
     BackgroundType       = backgroundType;
     ItemSize             = itemSize;
     GameResourceFileName = gamerResourceFileName;
 }
Пример #4
0
        /// <summary>
        /// <para>Allows you to edit QuickSlotType for TechTypes. Can be used for existing TechTypes too.</para>
        /// <para>Careful: This has to be called after <see cref="SetTechData(TechType, Crafting.TechData)"/> and <see cref="SetTechData(TechType, Crafting.TechData)"/>.</para>
        /// </summary>
        /// <param name="techType">The TechType whose QuickSlotType you want to edit.</param>
        /// <param name="slotType">The QuickSlotType for that TechType.</param>
#elif BELOWZERO
        /// <summary>
        /// <para>Allows you to edit QuickSlotType for TechTypes. Can be used for existing TechTypes too.</para>
        /// <para>Careful: This has to be called after <see cref="SetTechData(TechType, Crafting.RecipeData)"/>.</para>
        /// </summary>
        /// <param name="techType">The TechType whose QuickSlotType you want to edit.</param>
        /// <param name="slotType">The QuickSlotType for that TechType.</param>
#endif
        public static void SetQuickSlotType(TechType techType, QuickSlotType slotType)
        {
            Main.SetQuickSlotType(techType, slotType);
        }
        public void SlotArmHeld()
        {
#if DEBUG
#else
            if (!Player.main.IsPilotingSeatruck() || !AvatarInputHandler.main.IsEnabled())
            {
                return;
            }
#endif
            if (!helper.IsPowered())
            {
                return;
            }

            if (currentSelectedArm == SeaTruckArm.Left)
            {
                if (!leftButtonDownProcessed)
                {
                    return;
                }

                if (helper.GetSlotProgress(LeftArmSlotID) != 1f)
                {
                    return;
                }

                QuickSlotType quickSlotType = TechData.GetSlotType(currentLeftArmType);

                if (quickSlotType == QuickSlotType.Selectable && leftArm.OnUseHeld(out float coolDown))
                {
                    if (helper.TruckPowerRelay)
                    {
                        helper.TruckPowerRelay.ConsumeEnergy(leftArm.GetEnergyCost(), out float amount);
                    }

                    helper.TruckQuickSlotTimeUsed[LeftArmSlotID] = Time.time;
                    helper.TruckQuickSlotCooldown[LeftArmSlotID] = coolDown;
                }
            }
            else if (currentSelectedArm == SeaTruckArm.Right)
            {
                if (!rightButtonDownProcessed)
                {
                    return;
                }

                if (helper.GetSlotProgress(RightArmSlotID) != 1f)
                {
                    return;
                }

                QuickSlotType quickSlotType = TechData.GetSlotType(currentRightArmType);

                if (quickSlotType == QuickSlotType.Selectable && rightArm.OnUseHeld(out float coolDown))
                {
                    if (helper.TruckPowerRelay)
                    {
                        helper.TruckPowerRelay.ConsumeEnergy(leftArm.GetEnergyCost(), out float amount);
                    }

                    helper.TruckQuickSlotTimeUsed[RightArmSlotID] = Time.time;
                    helper.TruckQuickSlotCooldown[RightArmSlotID] = coolDown;
                }
            }
        }
        public void SlotArmUp()
        {
#if DEBUG
#else
            if (!Player.main.IsPilotingSeatruck() || !AvatarInputHandler.main.IsEnabled())
            {
                return;
            }
#endif
            if (currentSelectedArm == SeaTruckArm.Left)
            {
                leftButtonDownProcessed = false;

                QuickSlotType quickSlotType = TechData.GetSlotType(currentLeftArmType);

                if (quickSlotType == QuickSlotType.Selectable)
                {
                    leftArm.OnUseUp(out float coolDown);
                }
                else if (quickSlotType == QuickSlotType.SelectableChargeable)
                {
                    if (!helper.IsPowered())
                    {
                        return;
                    }

                    if (helper.GetSlotProgress(LeftArmSlotID) != 1f)
                    {
                        return;
                    }

                    if (leftArm.OnUseUp(out float coolDown))
                    {
                        helper.TruckQuickSlotTimeUsed[LeftArmSlotID] = Time.time;
                        helper.TruckQuickSlotCooldown[LeftArmSlotID] = coolDown;
                    }

                    helper.TruckQuickSlotCharge[LeftArmSlotID] = 0f;
                }
            }
            else if (currentSelectedArm == SeaTruckArm.Right)
            {
                rightButtonDownProcessed = false;

                QuickSlotType quickSlotType = TechData.GetSlotType(currentRightArmType);

                if (quickSlotType == QuickSlotType.Selectable)
                {
                    rightArm.OnUseUp(out float coolDown);
                }
                else if (quickSlotType == QuickSlotType.SelectableChargeable)
                {
                    if (!helper.IsPowered())
                    {
                        return;
                    }

                    if (helper.GetSlotProgress(RightArmSlotID) != 1f)
                    {
                        return;
                    }

                    if (rightArm.OnUseUp(out float coolDown))
                    {
                        helper.TruckQuickSlotTimeUsed[RightArmSlotID] = Time.time;
                        helper.TruckQuickSlotCooldown[RightArmSlotID] = coolDown;
                    }

                    helper.TruckQuickSlotCharge[LeftArmSlotID] = 0f;
                }
            }
        }
Пример #7
0
 /// <summary>
 /// <para>Allows you to edit QuickSlotType for TechTypes. Can be used for existing TechTypes too.</para>
 /// <para>Careful: This has to be called after <see cref="SetTechData(TechType, ITechData)"/> and <see cref="SetTechData(TechType, TechData)"/>.</para>
 /// </summary>
 /// <param name="techType">The TechType whose QuickSlotType you want to edit.</param>
 /// <param name="slotType">The QuickSlotType for that TechType.</param>
 void ICraftDataHandler.SetQuickSlotType(TechType techType, QuickSlotType slotType)
 {
     CraftDataPatcher.CustomSlotTypes[techType] = slotType;
 }
Пример #8
0
 /// <summary>
 /// <para>Allows you to edit QuickSlotType for TechTypes. Can be used for existing TechTypes too.</para>
 /// <para>Careful: This has to be called after <see cref="SetTechData(TechType, RecipeData)"/>.</para>
 /// </summary>
 /// <param name="techType">The TechType whose QuickSlotType you want to edit.</param>
 /// <param name="slotType">The QuickSlotType for that TechType.</param>
 void ICraftDataHandler.SetQuickSlotType(TechType techType, QuickSlotType slotType)
 {
     AddJsonProperty(techType, "slotType", new JsonValue((int)slotType));
 }