Initial Commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Easter2025.Components;
|
||||
using Easter2025.Systems;
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using Unity.Entities;
|
||||
|
||||
namespace Easter2025.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(AcceptIntoBin), "AcceptTransfer")]
|
||||
public class AcceptIntoBinPatch
|
||||
{
|
||||
static void Prefix(Entity proposal_entity)
|
||||
{
|
||||
if (UtilitySystem._Require(proposal_entity, out CItemTransferProposal cItemTransferProposal))
|
||||
{
|
||||
if (UtilitySystem._Has<CCanTriggerOrbs>(cItemTransferProposal.Item))
|
||||
{
|
||||
if (!UtilitySystem._Has<CHasOrbs>(cItemTransferProposal.Destination))
|
||||
{
|
||||
UtilitySystem._Set(cItemTransferProposal.Destination, new CHasOrbs());
|
||||
}
|
||||
}
|
||||
if (UtilitySystem._Has<CCanTriggerOrangeOrbs>(cItemTransferProposal.Item))
|
||||
{
|
||||
if (UtilitySystem._Has<CHasOrbs>(cItemTransferProposal.Destination) && !UtilitySystem._Has<CHasOrangeOrbs>(cItemTransferProposal.Destination))
|
||||
{
|
||||
UtilitySystem._Set(cItemTransferProposal.Destination, new CHasOrangeOrbs());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Easter2025.Customs.LayoutProfiles;
|
||||
using Easter2025.Customs.LayoutProfiles.Decorators;
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using Kitchen.Layouts;
|
||||
using KitchenData;
|
||||
using KitchenLib.Utils;
|
||||
|
||||
namespace Easter2025.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(LayoutDecorator), "AttemptDecoration")]
|
||||
public class LayoutDecoratorPatch
|
||||
{
|
||||
static bool Prefix(LayoutDecorator __instance)
|
||||
{
|
||||
FieldInfo _Blueprint = ReflectionUtils.GetField<LayoutDecorator>("Blueprint");
|
||||
FieldInfo _Profile = ReflectionUtils.GetField<LayoutDecorator>("Profile");
|
||||
FieldInfo _Setting = ReflectionUtils.GetField<LayoutDecorator>("Setting");
|
||||
|
||||
LayoutBlueprint Blueprint = (LayoutBlueprint)_Blueprint.GetValue(__instance);
|
||||
LayoutProfile Profile = (LayoutProfile)_Profile.GetValue(__instance);
|
||||
RestaurantSetting Setting = (RestaurantSetting)_Setting.GetValue(__instance);
|
||||
|
||||
if (Profile.ID != GDOUtils.GetCustomGameDataObject<BunnyLayout>().ID && Profile.ID != GDOUtils.GetCustomGameDataObject<GardenBunnyLayout>().ID) return true;
|
||||
|
||||
|
||||
__instance.Decorations = new List<CLayoutAppliancePlacement>();
|
||||
Decorator eggHuntDecorator = new EasterDiningDecorator().Setup(Blueprint, Profile, null, __instance.Decorations);
|
||||
Decorator kitchenDecorator = new EasterKitchenDecorator().Setup(Blueprint, Profile, null, __instance.Decorations);
|
||||
|
||||
foreach (Room room in Blueprint.Rooms())
|
||||
{
|
||||
if (room.Type == RoomType.Dining || room.Type == RoomType.Garden)
|
||||
{
|
||||
int easterRoomAttemps = 5;
|
||||
while (easterRoomAttemps-- > 0 && !eggHuntDecorator.Decorate(room))
|
||||
{
|
||||
}
|
||||
if (easterRoomAttemps <= 0)
|
||||
{
|
||||
throw new LayoutFailureException("Failed to decorate dining room");
|
||||
}
|
||||
}
|
||||
if (room.Type == RoomType.Kitchen)
|
||||
{
|
||||
kitchenDecorator.Decorate(room);
|
||||
}
|
||||
}
|
||||
foreach (IDecorationConfiguration decorationConfiguration in Setting.Decorators)
|
||||
{
|
||||
try
|
||||
{
|
||||
Decorator decorator3 = (Decorator)decorationConfiguration.Decorator;
|
||||
decorator3.Setup(Blueprint, Profile, decorationConfiguration, __instance.Decorations);
|
||||
decorator3.Decorate(default(Room));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new LayoutFailureException(string.Format("Failed to apply decorator {0}: {1}", decorationConfiguration.Decorator, ex));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using Easter2025.Views;
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Easter2025.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(LocalViewRouter), "GetPrefab")]
|
||||
public class LocalViewRouter_Patch
|
||||
{
|
||||
public static GameObject result;
|
||||
public static GameObject container;
|
||||
|
||||
static bool Prefix(LocalViewRouter __instance, ViewType view_type, ref GameObject __result)
|
||||
{
|
||||
if (view_type != Mod.RED_BUNNY_VIEW) return true;
|
||||
|
||||
if (container == null)
|
||||
{
|
||||
container = new GameObject("temp");
|
||||
container.SetActive(false);
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result = GameObject.Instantiate(Mod.Bundle.LoadAsset<GameObject>("RedBunny").AssignMaterialsByNames(), container.transform);
|
||||
BunnyEasterEggView bunnyEasterEggView = result.AddComponent<BunnyEasterEggView>();
|
||||
bunnyEasterEggView.GenericAnimator = result.GetChild("Container/Bunny").GetComponent<Animator>();
|
||||
}
|
||||
|
||||
__result = result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using Easter2025.Views;
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Easter2025.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(LocalViewRouter), "GetPrefab")]
|
||||
public class LocalViewRouter_Patch2
|
||||
{
|
||||
public static GameObject result;
|
||||
public static GameObject container;
|
||||
|
||||
static bool Prefix(LocalViewRouter __instance, ViewType view_type, ref GameObject __result)
|
||||
{
|
||||
if (view_type != Mod.GREEN_BUNNY_VIEW) return true;
|
||||
|
||||
if (container == null)
|
||||
{
|
||||
container = new GameObject("temp");
|
||||
container.SetActive(false);
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result = GameObject.Instantiate(Mod.Bundle.LoadAsset<GameObject>("GreenBunny").AssignMaterialsByNames(), container.transform);
|
||||
BunnyEasterEggView bunnyEasterEggView = result.AddComponent<BunnyEasterEggView>();
|
||||
bunnyEasterEggView.GenericAnimator = result.GetChild("Container/Bunny").GetComponent<Animator>();
|
||||
}
|
||||
|
||||
__result = result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using Easter2025.Views;
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Easter2025.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(LocalViewRouter), "GetPrefab")]
|
||||
public class LocalViewRouter_Patch3
|
||||
{
|
||||
public static GameObject result;
|
||||
public static GameObject container;
|
||||
|
||||
static bool Prefix(LocalViewRouter __instance, ViewType view_type, ref GameObject __result)
|
||||
{
|
||||
if (view_type != Mod.BLUE_BUNNY_VIEW) return true;
|
||||
|
||||
if (container == null)
|
||||
{
|
||||
container = new GameObject("temp");
|
||||
container.SetActive(false);
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result = GameObject.Instantiate(Mod.Bundle.LoadAsset<GameObject>("BlueBunny").AssignMaterialsByNames(), container.transform);
|
||||
BunnyEasterEggView bunnyEasterEggView = result.AddComponent<BunnyEasterEggView>();
|
||||
bunnyEasterEggView.GenericAnimator = result.GetChild("Container/Bunny").GetComponent<Animator>();
|
||||
}
|
||||
|
||||
__result = result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Collections.Generic;
|
||||
using Easter2025.Views;
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
namespace Easter2025.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(LocalViewRouter), "GetPrefab")]
|
||||
public class LocalViewRouter_Patch4
|
||||
{
|
||||
public static GameObject result;
|
||||
public static GameObject container;
|
||||
|
||||
static bool Prefix(LocalViewRouter __instance, ViewType view_type, ref GameObject __result)
|
||||
{
|
||||
if (view_type != Mod.ROAMING_RED_BUNNY_VIEW) return true;
|
||||
|
||||
if (container == null)
|
||||
{
|
||||
container = new GameObject("temp");
|
||||
container.SetActive(false);
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result = GameObject.Instantiate(Mod.Bundle.LoadAsset<GameObject>("RoamingRedBunny").AssignMaterialsByNames(), container.transform);
|
||||
RoamingBunnyView bunnyEasterEggView = result.AddComponent<RoamingBunnyView>();
|
||||
bunnyEasterEggView.agent = result.GetComponent<NavMeshAgent>();
|
||||
bunnyEasterEggView.animator = result.GetComponent<Animator>();
|
||||
}
|
||||
|
||||
__result = result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Collections.Generic;
|
||||
using Easter2025.Views;
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
namespace Easter2025.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(LocalViewRouter), "GetPrefab")]
|
||||
public class LocalViewRouter_Patch5
|
||||
{
|
||||
public static GameObject result;
|
||||
public static GameObject container;
|
||||
|
||||
static bool Prefix(LocalViewRouter __instance, ViewType view_type, ref GameObject __result)
|
||||
{
|
||||
if (view_type != Mod.ROAMING_GREEN_BUNNY_VIEW) return true;
|
||||
|
||||
if (container == null)
|
||||
{
|
||||
container = new GameObject("temp");
|
||||
container.SetActive(false);
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result = GameObject.Instantiate(Mod.Bundle.LoadAsset<GameObject>("RoamingGreenBunny").AssignMaterialsByNames(), container.transform);
|
||||
RoamingBunnyView bunnyEasterEggView = result.AddComponent<RoamingBunnyView>();
|
||||
bunnyEasterEggView.agent = result.GetComponent<NavMeshAgent>();
|
||||
bunnyEasterEggView.animator = result.GetComponent<Animator>();
|
||||
}
|
||||
|
||||
__result = result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Collections.Generic;
|
||||
using Easter2025.Views;
|
||||
using HarmonyLib;
|
||||
using Kitchen;
|
||||
using KitchenLib.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
namespace Easter2025.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(LocalViewRouter), "GetPrefab")]
|
||||
public class LocalViewRouter_Patch6
|
||||
{
|
||||
public static GameObject result;
|
||||
public static GameObject container;
|
||||
|
||||
static bool Prefix(LocalViewRouter __instance, ViewType view_type, ref GameObject __result)
|
||||
{
|
||||
if (view_type != Mod.ROAMING_BLUE_BUNNY_VIEW) return true;
|
||||
|
||||
if (container == null)
|
||||
{
|
||||
container = new GameObject("temp");
|
||||
container.SetActive(false);
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result = GameObject.Instantiate(Mod.Bundle.LoadAsset<GameObject>("RoamingBlueBunny").AssignMaterialsByNames(), container.transform);
|
||||
RoamingBunnyView bunnyEasterEggView = result.AddComponent<RoamingBunnyView>();
|
||||
bunnyEasterEggView.agent = result.GetComponent<NavMeshAgent>();
|
||||
bunnyEasterEggView.animator = result.GetComponent<Animator>();
|
||||
}
|
||||
|
||||
__result = result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user