Initial Commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using KitchenData;
|
||||
using KitchenLib.Customs;
|
||||
using KitchenLib.Utils;
|
||||
using Pets.Components;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pets.Customs
|
||||
{
|
||||
public class PetBed : CustomAppliance
|
||||
{
|
||||
public override string UniqueNameID => "PetBed";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("PetBed").AssignMaterialsByNames();
|
||||
public override string Name => "Pet Bed";
|
||||
public override List<IApplianceProperty> Properties => new List<IApplianceProperty>
|
||||
{
|
||||
new CPetBed()
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using Kitchen;
|
||||
using KitchenData;
|
||||
using KitchenLib.Customs;
|
||||
using KitchenLib.References;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pets.Customs
|
||||
{
|
||||
public class PetLetter : CustomAppliance
|
||||
{
|
||||
public override string UniqueNameID => "PetLetter";
|
||||
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("PetLetter").AssignMaterialsByNames();
|
||||
|
||||
public override List<IApplianceProperty> Properties => new List<IApplianceProperty>
|
||||
{
|
||||
new CFixedRotation(),
|
||||
new CImmovable()
|
||||
};
|
||||
|
||||
public override void OnRegister(Appliance gameDataObject)
|
||||
{
|
||||
base.OnRegister(gameDataObject);
|
||||
LetterView view = gameDataObject.Prefab.AddComponent<LetterView>();
|
||||
Appliance Letter = GDOUtils.GetExistingGDO(ApplianceReferences.BlueprintLetter) as Appliance;
|
||||
view.Animator = gameDataObject.Prefab.GetComponent<Animator>();
|
||||
view.Letter = GameObjectUtils.GetChild(gameDataObject.Prefab, "Letter");
|
||||
view.MinDelay = 0;
|
||||
view.MaxDelay = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
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 Cat : CustomPet
|
||||
{
|
||||
public override string UniqueNameID => "Cat";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("Cat").AssignMaterialsByNames();
|
||||
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("CatIcon").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 CRoamNearOwner(),
|
||||
new CStapleAppliances
|
||||
{
|
||||
Appliances = new FixedListInt64
|
||||
{
|
||||
GDOUtils.GetCustomGameDataObject<PetBed>().ID
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
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 Chick : CustomPet
|
||||
{
|
||||
public override string UniqueNameID => "Chick";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("Chick").AssignMaterialsByNames();
|
||||
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("ChickIcon").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 CRoamNearOwner(),
|
||||
new CStapleAppliances
|
||||
{
|
||||
Appliances = new FixedListInt64
|
||||
{
|
||||
GDOUtils.GetCustomGameDataObject<PetBed>().ID
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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 DogChihuahua : CustomPet
|
||||
{
|
||||
public override string UniqueNameID => "DogChihuahua";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("DogChihuahua").AssignMaterialsByNames();
|
||||
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("DogChihuahuaIcon").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
|
||||
}
|
||||
},
|
||||
new CRoamNearOwner()
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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 Elephant : CustomPet
|
||||
{
|
||||
public override string UniqueNameID => "Elephant";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("Elephant").AssignMaterialsByNames();
|
||||
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("ElephantIcon").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
|
||||
}
|
||||
},
|
||||
new CRoamNearOwner(),
|
||||
new CStandBackFromFood
|
||||
{
|
||||
Distance = 0.75f
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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 Goose : CustomPet
|
||||
{
|
||||
public override string UniqueNameID => "Goose";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("Goose").AssignMaterialsByNames();
|
||||
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("GooseIcon").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.347f, 0.022f)
|
||||
},
|
||||
new CRoamNearOwner(),
|
||||
new CStapleAppliances
|
||||
{
|
||||
Appliances = new FixedListInt64
|
||||
{
|
||||
GDOUtils.GetCustomGameDataObject<PetBed>().ID
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
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 Penguin : CustomPet
|
||||
{
|
||||
public override string UniqueNameID => "Penguin";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("Penguin").AssignMaterialsByNames();
|
||||
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("PenguinIcon").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.Sleep,
|
||||
}
|
||||
},
|
||||
new CSleepingPositionOffset
|
||||
{
|
||||
Offset = new Vector2(0.445f, -0.236f)
|
||||
},
|
||||
new CRoamNearOwner(),
|
||||
new CStapleAppliances
|
||||
{
|
||||
Appliances = new FixedListInt64
|
||||
{
|
||||
GDOUtils.GetCustomGameDataObject<PetBed>().ID
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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 Rabbit : CustomPet
|
||||
{
|
||||
public override string UniqueNameID => "Rabbit";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("Rabbit").AssignMaterialsByNames();
|
||||
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("RabbitIcon").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.443f, -0.123f)
|
||||
},
|
||||
new CRoamNearOwner(),
|
||||
new CStapleAppliances
|
||||
{
|
||||
Appliances = new FixedListInt64
|
||||
{
|
||||
GDOUtils.GetCustomGameDataObject<PetBed>().ID
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
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 Seal : CustomPet
|
||||
{
|
||||
public override string UniqueNameID => "Seal";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("Seal").AssignMaterialsByNames();
|
||||
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("SealIcon").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 CRoamNearOwner(),
|
||||
new CStapleAppliances
|
||||
{
|
||||
Appliances = new FixedListInt64
|
||||
{
|
||||
GDOUtils.GetCustomGameDataObject<PetBed>().ID
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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 Squirrel : CustomPet
|
||||
{
|
||||
public override string UniqueNameID => "Squirrel";
|
||||
public override GameObject Prefab => Mod.Bundle.LoadAsset<GameObject>("Squirrel").AssignMaterialsByNames();
|
||||
public override GameObject IconPrefab => Mod.Bundle.LoadAsset<GameObject>("SquirrelIcon").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.458f, 0.041f)
|
||||
},
|
||||
new CRoamNearOwner(),
|
||||
new CStapleAppliances
|
||||
{
|
||||
Appliances = new FixedListInt64
|
||||
{
|
||||
GDOUtils.GetCustomGameDataObject<PetBed>().ID
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System.Collections.Generic;
|
||||
using Kitchen;
|
||||
using KitchenData;
|
||||
using KitchenLib.Customs;
|
||||
using KitchenLib.Utils;
|
||||
using Pets.Enums;
|
||||
using Pets.Interfaces;
|
||||
using Pets.Patches;
|
||||
using Pets.Views;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
using UnityEngine.VFX;
|
||||
|
||||
namespace Pets.Customs.Types
|
||||
{
|
||||
public class Pet : GameDataObject, IHasPrefab
|
||||
{
|
||||
protected override void InitialiseDefaults()
|
||||
{
|
||||
Properties = new List<IPetProperty>();
|
||||
}
|
||||
|
||||
GameObject IHasPrefab.Prefab => Prefab;
|
||||
public GameObject Prefab;
|
||||
public GameObject IconPrefab;
|
||||
public ViewType ViewType;
|
||||
public PetState DefaultState = PetState.Follow;
|
||||
public List<IPetProperty> Properties;
|
||||
|
||||
public override void SetupForGame()
|
||||
{
|
||||
base.SetupForGame();
|
||||
LocalViewRouter_Patch.registeredPetViews.Add(ViewType, Prefab);
|
||||
|
||||
PetView view = Prefab.AddComponent<PetView>();
|
||||
view.agent = Prefab.GetComponentInChildren<NavMeshAgent>();
|
||||
view.animator = Prefab.GetComponentInChildren<Animator>();
|
||||
view.vfx = Prefab.GetComponentInChildren<VisualEffect>();
|
||||
TextMeshPro tmp = Prefab.GetComponentInChildren<TextMeshPro>();
|
||||
if (tmp != null)
|
||||
{
|
||||
tmp.transform.parent.gameObject.AddComponent<FixedWorldRotation>();
|
||||
view.label = tmp;
|
||||
}
|
||||
|
||||
foreach (Transform transform in Prefab.transform)
|
||||
{
|
||||
if (transform.name != "Error") continue;
|
||||
view.warningIcon = transform.gameObject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class CustomPet : CustomGameDataObject<Pet>
|
||||
{
|
||||
public virtual GameObject Prefab { get; protected set; }
|
||||
public virtual GameObject IconPrefab { get; protected set; }
|
||||
public virtual PetState DefaultState { get; protected set; } = PetState.Follow;
|
||||
public virtual List<IPetProperty> Properties { get; protected set; } = new List<IPetProperty>();
|
||||
|
||||
public override void Convert(GameData gameData, out GameDataObject gameDataObject)
|
||||
{
|
||||
Pet result = ScriptableObject.CreateInstance<Pet>();
|
||||
|
||||
result.ID = ID;
|
||||
result.Prefab = Prefab;
|
||||
result.IconPrefab = IconPrefab;
|
||||
result.ViewType = (ViewType)VariousUtils.GetID(UniqueNameID);
|
||||
result.Properties = Properties;
|
||||
result.DefaultState = DefaultState;
|
||||
|
||||
gameDataObject = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user