Skip to content
Snippets Groups Projects
Commit b33a315f authored by Ed86's avatar Ed86
Browse files

added designators unset when guest/prisoner/slave leave map

parent e63095b7
No related branches found
No related tags found
No related merge requests found
using HarmonyLib;
using RimWorld;
using System;
using Verse;
namespace rjw
{
///<summary>
///unset designators on GuestRelease
///until pawn leaves map, pawn is still guest/slave/prisoner, so they can actually be changed back
///</summary>
[HarmonyPatch(typeof(GenGuest), "GuestRelease")]
[StaticConstructorOnStartup]
static class PATCH_GenGuest_GuestRelease
{
[HarmonyPrefix]
private static void GuestRelease_Update_Designators(Pawn p)
{
if (p != null)
{
//ModLog.Message("GenGuest GuestRelease");
//ModLog.Message("pawn: " + xxx.get_pawnname(p));
p.UnDesignateComfort();
p.UnDesignateService();
p.UnDesignateBreeding();
p.UnDesignateBreedingAnimal();
p.UnDesignateMilking();
p.UnDesignateHero();
//ModLog.Message(p.IsDesignatedComfort().ToString());
}
}
}
///<summary>
///unset designators on Pawn_ExitMap
///now pawn actually leaves map and get their factions reset
///</summary>
[HarmonyPatch(typeof(Pawn), "ExitMap")]
[StaticConstructorOnStartup]
static class PATCH_Pawn_ExitMap
{
[HarmonyPrefix]
private static void Pawn_ExitMap_Update_Designators(Pawn __instance, bool allowedToJoinOrCreateCaravan, Rot4 exitDir)
{
Pawn p = __instance;
if (p != null)
if (!p.IsColonist)
{
//ModLog.Message("Pawn ExitMap");
//ModLog.Message("pawn: " + xxx.get_pawnname(p));
p.UnDesignateComfort();
p.UnDesignateService();
p.UnDesignateBreeding();
p.UnDesignateBreedingAnimal();
p.UnDesignateMilking();
p.UnDesignateHero();
//ModLog.Message(p.IsDesignatedComfort().ToString());
}
}
}
}
\ No newline at end of file
......@@ -97,6 +97,7 @@
<Compile Include="Designators\Milking.cs" />
<Compile Include="Designators\Utility.cs" />
<Compile Include="Designators\Service.cs" />
<Compile Include="Harmony\DesignatorsUnset.cs" />
<Compile Include="Harmony\patch_meditate.cs" />
<Compile Include="Harmony\Patch_PawnGenerator.cs" />
<Compile Include="Harmony\Building_Bed_Patch.cs" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment