qud-mods/AutoDropBedding/HarmonyPatches/Patch_Survival_Camp.cs

26 lines
768 B
C#

using HarmonyLib;
using XRL.World;
using XRL.World.Parts.Skill;
namespace AutoDropBedding.HarmonyPatches
{
[HarmonyPatch(typeof(Survival_Camp), nameof(Survival_Camp.AttemptCamp))]
public static class Patch_Survival_Camp
{
public static void Postfix(ref bool __result, GameObject Actor)
{
if (__result && Actor.IsPlayer() && Config.AutoDrop)
{
Helpers.PutDownBedroll(who: Actor, first: true);
if (Config.CompanionDrop)
{
foreach (var companion in Actor.GetCompanions())
{
Helpers.PutDownBedroll(who: companion, first: true);
}
}
}
}
}
}