public static bool TryGetCeremonySpot(Pawn pawn, Faction bestowingFaction, out LocalTargetInfo spot, out IntVec3 absoluteSpot) { Building_Throne throne; Room throneRoom; if (pawn != null) { RoyalTitleDef titleAwardedWhenUpdating = pawn.royalty.GetTitleAwardedWhenUpdating(bestowingFaction, pawn.royalty.GetFavor(bestowingFaction)); if (titleAwardedWhenUpdating != null && titleAwardedWhenUpdating.throneRoomRequirements != null && pawn.ownership.AssignedThrone != null) { throne = pawn.ownership.AssignedThrone; throneRoom = throne.GetRoom(); spot = throne; IntVec3 facingCell = spot.Thing.Rotation.FacingCell; absoluteSpot = spot.Thing.InteractionCell + facingCell * 3; bool flag = false; for (int i = 0; i < 3; i++) { if (ValidateSpot(absoluteSpot)) { flag = true; break; } absoluteSpot -= facingCell; } if (flag) { return(true); } absoluteSpot = spot.Thing.InteractionCell - facingCell * 3; for (int j = 0; j < 3; j++) { if (ValidateSpot(absoluteSpot)) { flag = true; break; } absoluteSpot += facingCell; } if (flag) { return(true); } if (throneRoom != null && throneRoom.Cells.Where((IntVec3 c) => ValidateSpot(c)).TryRandomElementByWeight((IntVec3 c) => c.DistanceTo(throne.Position), out absoluteSpot)) { return(true); } } if (pawn.Map != null && pawn.Map.IsPlayerHome && (RCellFinder.TryFindGatheringSpot_NewTemp(pawn, GatheringDefOf.Party, ignoreRequiredColonistCount: true, out var result) || RCellFinder.TryFindRandomSpotJustOutsideColony(pawn.Position, pawn.Map, out result))) { spot = (absoluteSpot = result); return(true); } } spot = LocalTargetInfo.Invalid; absoluteSpot = IntVec3.Invalid; return(false); bool ValidateSpot(IntVec3 s) { if (!s.InBounds(throne.Map)) { return(false); } if (!s.Standable(throne.Map)) { return(false); } if (s.GetRoom(throne.Map) != throneRoom) { return(false); } return(true); } }
protected override bool TryFindGatherSpot(Pawn organizer, out IntVec3 spot) { return(RCellFinder.TryFindGatheringSpot_NewTemp(organizer, def, ignoreRequiredColonistCount: false, out spot)); }