This commit is contained in:
Lachlan Leone
2024-02-11 21:01:29 +11:00
parent a8282f67f1
commit ce776e4870
7 changed files with 94 additions and 9 deletions
+4
View File
@@ -0,0 +1,4 @@
# Release Notes v0.1.4
- Added a preference for pet interactions.
- Added Pandas.
+4
View File
@@ -0,0 +1,4 @@
[h1]Release Notes v0.1.4[/h1]
- Added a preference for pet interactions.
- Added Pandas.
+48
View File
@@ -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<GameObject>("Panda").AssignMaterialsByNames();
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("PandaIcon").AssignMaterialsByNames();
public override PetState DefaultState => PetState.Follow;
public override List<IPetProperty> Properties { get; protected set; } = new List<IPetProperty>()
{
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<PetBed>().ID
}
},
new CStandBackFromFood
{
Distance = 0.5f
}
};
}
}
+17
View File
@@ -14,18 +14,35 @@ namespace Pets.Menus
} }
private Option<bool> petsHaveColliders = new Option<bool>(new List<bool> { true, false }, Mod.manager.GetPreference<PreferenceBool>("petsHaveColliders").Value, new List<string> { "Enabled", "Disabled" }); private Option<bool> petsHaveColliders = new Option<bool>(new List<bool> { true, false }, Mod.manager.GetPreference<PreferenceBool>("petsHaveColliders").Value, new List<string> { "Enabled", "Disabled" });
private Option<int> petInteractionMode = new Option<int>(new List<int> { 0, 1, 2 }, Mod.manager.GetPreference<PreferenceInt>("petInteractionMode").Value, new List<string> { "Always", "Night Only", "Day Only" });
public override void Setup(int player_id) public override void Setup(int player_id)
{ {
AddLabel("Pet Colliders"); AddLabel("Pet Colliders");
New<SpacerElement>(true); New<SpacerElement>(true);
AddSelect(petsHaveColliders); AddSelect(petsHaveColliders);
petsHaveColliders.OnChanged += delegate (object _, bool result) petsHaveColliders.OnChanged += delegate (object _, bool result)
{ {
Mod.manager.GetPreference<PreferenceBool>("petsHaveColliders").Set(result); Mod.manager.GetPreference<PreferenceBool>("petsHaveColliders").Set(result);
}; };
New<SpacerElement>(true);
AddLabel("Pet Interaction ");
New<SpacerElement>(true);
AddSelect(petInteractionMode);
petInteractionMode.OnChanged += delegate (object _, int result)
{
Mod.manager.GetPreference<PreferenceInt>("petInteractionMode").Set(result);
};
New<SpacerElement>(true); New<SpacerElement>(true);
New<SpacerElement>(true); New<SpacerElement>(true);
AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate(int i) AddButton(base.Localisation["MENU_BACK_SETTINGS"], delegate(int i)
{ {
Mod.manager.Save(); Mod.manager.Save();
+3 -1
View File
@@ -22,7 +22,7 @@ namespace Pets
{ {
public const string MOD_GUID = "com.starfluxgames.pets"; public const string MOD_GUID = "com.starfluxgames.pets";
public const string MOD_NAME = "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_AUTHOR = "StarFluxGames";
public const string MOD_GAMEVERSION = ">=1.1.8"; public const string MOD_GAMEVERSION = ">=1.1.8";
@@ -53,6 +53,7 @@ namespace Pets
config.Pets.Add(GDOUtils.GetCustomGameDataObject<DogChihuahua>().ID); config.Pets.Add(GDOUtils.GetCustomGameDataObject<DogChihuahua>().ID);
config.Pets.Add(GDOUtils.GetCustomGameDataObject<Elephant>().ID); config.Pets.Add(GDOUtils.GetCustomGameDataObject<Elephant>().ID);
config.Pets.Add(GDOUtils.GetCustomGameDataObject<Seal>().ID); config.Pets.Add(GDOUtils.GetCustomGameDataObject<Seal>().ID);
config.Pets.Add(GDOUtils.GetCustomGameDataObject<Panda>().ID);
config.Icon = Bundle.LoadAsset<Texture2D>("PawPrint"); config.Icon = Bundle.LoadAsset<Texture2D>("PawPrint");
grid.Links.Add(config); grid.Links.Add(config);
} }
@@ -66,6 +67,7 @@ namespace Pets
manager = new PreferenceManager(MOD_GUID); manager = new PreferenceManager(MOD_GUID);
manager.RegisterPreference(new PreferenceBool("petsHaveColliders", true)); manager.RegisterPreference(new PreferenceBool("petsHaveColliders", true));
manager.RegisterPreference(new PreferenceInt("petInteractionMode", 0)); // 0 = Always, 1 = Night Only, 2 = Day Only
manager.Load(); manager.Load();
manager.Save(); manager.Save();
@@ -1,4 +1,5 @@
using Kitchen; using Kitchen;
using KitchenLib.Preferences;
using KitchenMods; using KitchenMods;
using Pets.Components; using Pets.Components;
using Pets.Components.Menu; using Pets.Components.Menu;
@@ -13,6 +14,9 @@ namespace Pets.Systems.EditorMenu
} }
protected override void Perform(ref InteractionData data) protected override void Perform(ref InteractionData data)
{
int petInteractionMode = Mod.manager.GetPreference<PreferenceInt>("petInteractionMode").Value;
if (petInteractionMode == 0 || petInteractionMode == 2)
{ {
EntityManager.AddComponentData(data.Target, new CTriggerPetEditor EntityManager.AddComponentData(data.Target, new CTriggerPetEditor
{ {
@@ -22,3 +26,4 @@ namespace Pets.Systems.EditorMenu
} }
} }
} }
}
@@ -1,4 +1,5 @@
using Kitchen; using Kitchen;
using KitchenLib.Preferences;
using KitchenMods; using KitchenMods;
using Pets.Components; using Pets.Components;
using Pets.Components.Menu; using Pets.Components.Menu;
@@ -13,6 +14,9 @@ namespace Pets.Systems.EditorMenu
} }
protected override void Perform(ref InteractionData data) protected override void Perform(ref InteractionData data)
{
int petInteractionMode = Mod.manager.GetPreference<PreferenceInt>("petInteractionMode").Value;
if (petInteractionMode == 0 || petInteractionMode == 1)
{ {
EntityManager.AddComponentData(data.Target, new CTriggerPetEditor EntityManager.AddComponentData(data.Target, new CTriggerPetEditor
{ {
@@ -22,3 +26,4 @@ namespace Pets.Systems.EditorMenu
} }
} }
} }
}