private string UsableNowStatus() { if (!this.AnyCoupleForWhichIsValid()) { StringBuilder stringBuilder = new StringBuilder(); Pair <Pawn, Pawn> pair; if (this.TryFindAnyFiancesCouple(out pair)) { if (!MarriageSpotUtility.IsValidMarriageSpotFor(base.Position, pair.First, pair.Second, stringBuilder)) { return("MarriageSpotNotUsable".Translate(new object[] { stringBuilder })); } } else if (!MarriageSpotUtility.IsValidMarriageSpot(base.Position, base.Map, stringBuilder)) { return("MarriageSpotNotUsable".Translate(new object[] { stringBuilder })); } } return("MarriageSpotUsable".Translate()); }
private string UsableNowStatus() { if (!AnyCoupleForWhichIsValid()) { StringBuilder stringBuilder = new StringBuilder(); if (TryFindAnyFiancesCouple(out var fiances)) { if (!MarriageSpotUtility.IsValidMarriageSpotFor(base.Position, fiances.First, fiances.Second, stringBuilder)) { return("MarriageSpotNotUsable".Translate(stringBuilder)); } } else if (!MarriageSpotUtility.IsValidMarriageSpot(base.Position, base.Map, stringBuilder)) { return("MarriageSpotNotUsable".Translate(stringBuilder)); } } return("MarriageSpotUsable".Translate()); }
public static bool IsValidMarriageSpotFor(IntVec3 cell, Pawn firstFiance, Pawn secondFiance, StringBuilder outFailReason = null) { if (!firstFiance.Spawned || !secondFiance.Spawned) { Log.Warning("Can't check if a marriage spot is valid because one of the fiances isn't spawned.", false); return(false); } if (firstFiance.Map != secondFiance.Map) { return(false); } if (!MarriageSpotUtility.IsValidMarriageSpot(cell, firstFiance.Map, outFailReason)) { return(false); } if (!cell.Roofed(firstFiance.Map)) { if (!JoyUtility.EnjoyableOutsideNow(firstFiance, outFailReason)) { return(false); } if (!JoyUtility.EnjoyableOutsideNow(secondFiance, outFailReason)) { return(false); } } if (cell.GetDangerFor(firstFiance, firstFiance.Map) != Danger.None) { if (outFailReason != null) { outFailReason.Append("MarriageSpotDangerous".Translate(new object[] { firstFiance.LabelShort })); } return(false); } if (cell.GetDangerFor(secondFiance, secondFiance.Map) != Danger.None) { if (outFailReason != null) { outFailReason.Append("MarriageSpotDangerous".Translate(new object[] { secondFiance.LabelShort })); } return(false); } if (cell.IsForbidden(firstFiance)) { if (outFailReason != null) { outFailReason.Append("MarriageSpotForbidden".Translate(new object[] { firstFiance.LabelShort })); } return(false); } if (cell.IsForbidden(secondFiance)) { if (outFailReason != null) { outFailReason.Append("MarriageSpotForbidden".Translate(new object[] { secondFiance.LabelShort })); } return(false); } if (!firstFiance.CanReserve(cell, 1, -1, null, false) || !secondFiance.CanReserve(cell, 1, -1, null, false)) { if (outFailReason != null) { outFailReason.Append("MarriageSpotReserved".Translate()); } return(false); } if (!firstFiance.CanReach(cell, PathEndMode.OnCell, Danger.None, false, TraverseMode.ByPawn)) { if (outFailReason != null) { outFailReason.Append("MarriageSpotUnreachable".Translate(new object[] { firstFiance.LabelShort })); } return(false); } if (!secondFiance.CanReach(cell, PathEndMode.OnCell, Danger.None, false, TraverseMode.ByPawn)) { if (outFailReason != null) { outFailReason.Append("MarriageSpotUnreachable".Translate(new object[] { secondFiance.LabelShort })); } return(false); } if (!firstFiance.IsPrisoner && !secondFiance.IsPrisoner) { Room room = cell.GetRoom(firstFiance.Map, RegionType.Set_Passable); if (room != null && room.isPrisonCell) { if (outFailReason != null) { outFailReason.Append("MarriageSpotInPrisonCell".Translate()); } return(false); } } return(true); }