Skip to content

Commit

Permalink
Blood vials/packs are no longer forbidden in prisoner rooms Fixes #18
Browse files Browse the repository at this point in the history
…-- Sleepers now are assigned coffins when sleeping in one #20   (needs further polish)
  • Loading branch information
jecrell committed Jan 28, 2018
1 parent 0114061 commit 5edef0f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 15 deletions.
Binary file modified Assemblies/Vampire.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Defs/ThingDefs_BloodItems/ROMV_Items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</graphicData>
<soundInteract>Standard_Drop</soundInteract>
<soundDrop>Standard_Drop</soundDrop>
<socialPropernessMatters>true</socialPropernessMatters>
<socialPropernessMatters>false</socialPropernessMatters>
<statBases>
<MaxHitPoints>60</MaxHitPoints>
<MarketValue>30</MarketValue>
Expand Down Expand Up @@ -62,7 +62,7 @@
</graphicData>
<soundInteract>Standard_Drop</soundInteract>
<soundDrop>Standard_Drop</soundDrop>
<socialPropernessMatters>true</socialPropernessMatters>
<socialPropernessMatters>false</socialPropernessMatters>
<statBases>
<MaxHitPoints>60</MaxHitPoints>
<MarketValue>60</MarketValue>
Expand Down
58 changes: 45 additions & 13 deletions Source/Vampires/Components/CompVampBed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,62 @@ private void SpawnBedAsNeeded()
}
}

private readonly bool harmonyPatchIsActiveForMultipleCharacters = false;

/// <summary>
/// Remove and add assignments to the bed as needed.
/// </summary>
/// <param name="g"></param>
/// <param name="bedPawns"></param>
private void AssignBedPawnsAsNeeded(Building_Grave g, List<Pawn> bedPawns)
{
if (g.AssignedPawns != null && g.AssignedPawns.Any())
if (g.PositionHeld.GetFirstPawn(g.MapHeld) is Pawn p && !p.Awake())
{
if (bedPawns.Any())
if (bedPawns.Contains(p))
return;
else
{
var tempBedPawns = new List<Pawn>(bedPawns);
foreach (var bedPawn in tempBedPawns)
{
if (!g.AssignedPawns.Contains(bedPawn))
bed.TryUnassignPawn(bedPawn);
}
bed.TryAssignPawn(p);
g.TryAssignPawn(p);
}
}
else
{
HashSet<Pawn> gravePawns = new HashSet<Pawn>(g.AssignedPawns);
HashSet<Pawn> bedPawnsSet = new HashSet<Pawn>(bedPawns);
if (gravePawns.SetEquals(bedPawnsSet)) return;
else if (gravePawns.Count() >= bedPawnsSet.Count())
{
if (bedPawnsSet.Any())
foreach (var bp in bedPawnsSet)
bed.TryUnassignPawn(bp);
foreach (var gp in gravePawns)
bed.TryAssignPawn(gp);
}
foreach (var gravePawn in g.AssignedPawns)
bed.TryAssignPawn(gravePawn);
else if (gravePawns.Count() < bedPawnsSet.Count() && harmonyPatchIsActiveForMultipleCharacters)
{
foreach (var bp in bedPawnsSet)
g.TryAssignPawn(bp);
}
}
else if (bed.AssignedPawns.Any())
foreach (var pawn in bedPawns)
bed.TryUnassignPawn(pawn);

// if (g.AssignedPawns != null && g.AssignedPawns.Count() > 0)
// {
// if (bedPawns.Any())
// {
// var tempBedPawns = new List<Pawn>(bedPawns);
// foreach (var bedPawn in tempBedPawns)
// {
// if (!g.AssignedPawns.Contains(bedPawn))
// bed.TryUnassignPawn(bedPawn);
// }
// }
// foreach (var gravePawn in g.AssignedPawns)
// bed.TryAssignPawn(gravePawn);
// }
// else if (bed.AssignedPawns.Any())
// foreach (var pawn in bedPawns)
// bed.TryUnassignPawn(pawn);
}


Expand Down

0 comments on commit 5edef0f

Please sign in to comment.