Systems - KitchenMods/KitchenLib GitHub Wiki
Registering Systems
Registering systems can be done one of two ways, either you can forcefully register it after everything else, or you can put it in a different namespace allowing it to be registered automatically.
Registering Systems Example
The first method (The recommended way) is to change the systems namespace to something that starts with Kitchen
, in this example we're using KitchenExampleMod
using Kitchen;
namespace KitchenExampleMod
{
public class MyCustomSystem : ApplianceInteractionSystem
{
protected override bool IsPossible(ref InteractionData data) { return false; }
protected override void Perform(ref InteractionData data) { }
}
}
The second method is to forcefully register your system after WorldBootstrapper
constructor using Harmony2
using Kitchen;
using HarmonyLib;
namespace ExampleMod
{
public class MyCustomSystem : ApplianceInteractionSystem
{
protected override bool IsPossible(ref InteractionData data) { return false; }
protected override void Perform(ref InteractionData data) { }
}
[HarmonyPatch(typeof(WorldBootstrapper))]
[HarmonyPatch(MethodType.Constructor)]
public class WorldBootstrapper_Patch
{
static void PostFix(WorldBootstrapper __instance)
{
__instance.CreatedWorld.GetOrCreateSystem<InteractionGroup>().AddSystemToUpdateList(__instance.CreatedWorld.GetOrCreateSystem<MyCustomSystem>());
}
}
}
Interaction Systems
The base game has two core interaction systems, ItemInteractionSystem
and ApplianceInteractionSystem
ItemInteractionSystem
- This system is run when an appliance is interacted with during the day (Gameplay Mode)
ApplianceInteractionSystem
- This system is run when an appliance is interaction with during the night (Editing Mode)
Some notable interaction systems are as follows:
RotateAppliances
OpenLetter
HandleDumbWaiters
UseOrderMachine