diff --git a/Changelogs/Github/v0.1.4.MD b/Changelogs/Github/v0.1.4.MD new file mode 100644 index 0000000..086e69f --- /dev/null +++ b/Changelogs/Github/v0.1.4.MD @@ -0,0 +1,4 @@ +# Release Notes v0.1.4 + +- Added a preference for pet interactions. +- Added Pandas. \ No newline at end of file diff --git a/Changelogs/Workshop/v0.1.4.MD b/Changelogs/Workshop/v0.1.4.MD new file mode 100644 index 0000000..fdfd40e --- /dev/null +++ b/Changelogs/Workshop/v0.1.4.MD @@ -0,0 +1,4 @@ +[h1]Release Notes v0.1.4[/h1] + +- Added a preference for pet interactions. +- Added Pandas. \ No newline at end of file diff --git a/Customs/Panda.cs b/Customs/Panda.cs new file mode 100644 index 0000000..7e1d1e5 --- /dev/null +++ b/Customs/Panda.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using KitchenLib.Utils; +using Pets.Components.Properties; +using Pets.Customs.Types; +using Pets.Enums; +using Pets.Interfaces; +using Unity.Collections; +using UnityEngine; + +namespace Pets.Customs +{ + public class Panda : CustomPet + { + public override string UniqueNameID => "Panda"; + public override GameObject Prefab => Mod.Bundle.LoadAsset("Panda").AssignMaterialsByNames(); + public override GameObject IconPrefab => Mod.Bundle.LoadAsset("PandaIcon").AssignMaterialsByNames(); + public override PetState DefaultState => PetState.Follow; + + public override List Properties { get; protected set; } = new List() + { + new CActivities + { + Activities = new FixedListInt64 + { + (int)PetState.Follow, + (int)PetState.Eat, + (int)PetState.Sleep, + } + }, + new CSleepingPositionOffset + { + Offset = new Vector2(-0.785f, -0.36f) + }, + new CRoamNearOwner(), + new CStapleAppliances + { + Appliances = new FixedListInt64 + { + GDOUtils.GetCustomGameDataObject().ID + } + }, + new CStandBackFromFood + { + Distance = 0.5f + } + }; + } +} \ No newline at end of file diff --git a/Menus/PreferenceMenu.cs b/Menus/PreferenceMenu.cs index 625bc10..8927fee 100644 --- a/Menus/PreferenceMenu.cs +++ b/Menus/PreferenceMenu.cs @@ -14,18 +14,35 @@ namespace Pets.Menus } private Option petsHaveColliders = new Option(new List { true, false }, Mod.manager.GetPreference("petsHaveColliders").Value, new List { "Enabled", "Disabled" }); + private Option petInteractionMode = new Option(new List { 0, 1, 2 }, Mod.manager.GetPreference("petInteractionMode").Value, new List { "Always", "Night Only", "Day Only" }); public override void Setup(int player_id) { AddLabel("Pet Colliders"); + New(true); AddSelect(petsHaveColliders); + petsHaveColliders.OnChanged += delegate (object _, bool result) { Mod.manager.GetPreference("petsHaveColliders").Set(result); }; + + New(true); + + AddLabel("Pet Interaction "); + + New(true); + AddSelect(petInteractionMode); + + petInteractionMode.OnChanged += delegate (object _, int result) + { + Mod.manager.GetPreference("petInteractionMode").Set(result); + }; + New(true); New(true); + AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate(int i) { Mod.manager.Save(); diff --git a/Mod.cs b/Mod.cs index a7b6df6..a8ff833 100644 --- a/Mod.cs +++ b/Mod.cs @@ -22,7 +22,7 @@ namespace Pets { public const string MOD_GUID = "com.starfluxgames.pets"; public const string MOD_NAME = "Pets"; - public const string MOD_VERSION = "0.1.3"; + public const string MOD_VERSION = "0.1.4"; public const string MOD_AUTHOR = "StarFluxGames"; public const string MOD_GAMEVERSION = ">=1.1.8"; @@ -53,6 +53,7 @@ namespace Pets config.Pets.Add(GDOUtils.GetCustomGameDataObject().ID); config.Pets.Add(GDOUtils.GetCustomGameDataObject().ID); config.Pets.Add(GDOUtils.GetCustomGameDataObject().ID); + config.Pets.Add(GDOUtils.GetCustomGameDataObject().ID); config.Icon = Bundle.LoadAsset("PawPrint"); grid.Links.Add(config); } @@ -66,6 +67,7 @@ namespace Pets manager = new PreferenceManager(MOD_GUID); manager.RegisterPreference(new PreferenceBool("petsHaveColliders", true)); + manager.RegisterPreference(new PreferenceInt("petInteractionMode", 0)); // 0 = Always, 1 = Night Only, 2 = Day Only manager.Load(); manager.Save(); diff --git a/Systems/EditorMenu/ActivatePetEditorDuringDay.cs b/Systems/EditorMenu/ActivatePetEditorDuringDay.cs index 9991eeb..d8b8db1 100644 --- a/Systems/EditorMenu/ActivatePetEditorDuringDay.cs +++ b/Systems/EditorMenu/ActivatePetEditorDuringDay.cs @@ -1,4 +1,5 @@ using Kitchen; +using KitchenLib.Preferences; using KitchenMods; using Pets.Components; using Pets.Components.Menu; @@ -14,11 +15,15 @@ namespace Pets.Systems.EditorMenu protected override void Perform(ref InteractionData data) { - EntityManager.AddComponentData(data.Target, new CTriggerPetEditor + int petInteractionMode = Mod.manager.GetPreference("petInteractionMode").Value; + if (petInteractionMode == 0 || petInteractionMode == 2) { - IsTriggered = true, - TriggerEntity = data.Interactor - }); + EntityManager.AddComponentData(data.Target, new CTriggerPetEditor + { + IsTriggered = true, + TriggerEntity = data.Interactor + }); + } } } } diff --git a/Systems/EditorMenu/ActivatePetEditorDuringNight.cs b/Systems/EditorMenu/ActivatePetEditorDuringNight.cs index 6e54279..f116d0d 100644 --- a/Systems/EditorMenu/ActivatePetEditorDuringNight.cs +++ b/Systems/EditorMenu/ActivatePetEditorDuringNight.cs @@ -1,4 +1,5 @@ using Kitchen; +using KitchenLib.Preferences; using KitchenMods; using Pets.Components; using Pets.Components.Menu; @@ -14,11 +15,15 @@ namespace Pets.Systems.EditorMenu protected override void Perform(ref InteractionData data) { - EntityManager.AddComponentData(data.Target, new CTriggerPetEditor + int petInteractionMode = Mod.manager.GetPreference("petInteractionMode").Value; + if (petInteractionMode == 0 || petInteractionMode == 1) { - IsTriggered = true, - TriggerEntity = data.Interactor - }); + EntityManager.AddComponentData(data.Target, new CTriggerPetEditor + { + IsTriggered = true, + TriggerEntity = data.Interactor + }); + } } } }