mirror of
https://gitgud.io/Ed86/rjw-whoring.git
synced 2024-08-15 00:03:25 +00:00
Prevent automatc brothel bed claiming.
Pawns will now not automatically claim beds that use allow anyone to whore option. If the pawn is already assigned to bed - for example manually - it will still use the bed.
This commit is contained in:
parent
0daf0231a3
commit
a7ba8bed80
1 changed files with 26 additions and 2 deletions
|
@ -10,7 +10,7 @@ using rjw;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// patches Building_Bed to add stuff for WhoreBeds
|
/// patches Building_Bed to add stuff for WhoreBeds
|
||||||
///
|
///
|
||||||
/// Also contains smaller patches for RoomRoleWorker_Barracks (don't count whore beds) (disabled) and Toils_LayDown.ApplyBedThoughts (slept in brothel thought)
|
/// Also contains smaller patches for RoomRoleWorker_Barracks (don't count whore beds) (disabled), Toils_LayDown.ApplyBedThoughts (slept in brothel thought) and RestUtility (don't automatically claim brothel beds)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
namespace rjwwhoring
|
namespace rjwwhoring
|
||||||
|
@ -288,5 +288,29 @@ namespace rjwwhoring
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
///Prevents automatic claiming of brothel beds (beds that allow anyone to use for whoring)
|
||||||
|
///Note, that intent is not verified here, and this works because bed usage for actual whoring does not rely on IsValidBedFor call.
|
||||||
|
///Should above change in future, this patch needs to be removed or adjusted
|
||||||
|
///If the bed is already claimed (for example - assigned manually to pawn), it will still be used.
|
||||||
|
///<returns>Modifies __result to false, if bed is set to allow anyone for whroing AND is not already claimed.</returns>
|
||||||
|
/// </summary>
|
||||||
|
[HarmonyPatch(typeof(RestUtility), nameof(RestUtility.IsValidBedFor))]
|
||||||
|
public class RestUtility_IsValidBedFor_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
public static void Postfix(Pawn sleeper, Thing bedThing, ref bool __result)
|
||||||
|
{
|
||||||
|
if (!__result) return;
|
||||||
|
Building_Bed building_Bed = bedThing as Building_Bed;
|
||||||
|
bool isOwner = sleeper.ownership != null && sleeper.ownership.OwnedBed == bedThing;
|
||||||
|
if (building_Bed.IsAllowedForWhoringAll() && !isOwner ) __result = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue