public override float VoluntaryJoinPriorityFor(Pawn p)
        {
            float result;

            if (this.IsInvited(p))
            {
                if (!PartyUtility.ShouldPawnKeepPartying(p))
                {
                    result = 0f;
                }
                else if (this.spot.IsForbidden(p))
                {
                    result = 0f;
                }
                else
                {
                    if (!this.lord.ownedPawns.Contains(p))
                    {
                        if (this.IsPartyAboutToEnd())
                        {
                            return(0f);
                        }
                    }
                    result = VoluntarilyJoinableLordJobJoinPriorities.PartyGuest;
                }
            }
            else
            {
                result = 0f;
            }
            return(result);
        }
        public static bool EnoughPotentialGuestsToStartParty(Map map, IntVec3?partySpot = default(IntVec3?))
        {
            int value = Mathf.RoundToInt((float)((float)map.mapPawns.FreeColonistsSpawnedCount * 0.64999997615814209));

            value = Mathf.Clamp(value, 2, 10);
            int num = 0;

            foreach (Pawn item in map.mapPawns.FreeColonistsSpawned)
            {
                if (PartyUtility.ShouldPawnKeepPartying(item) && (!partySpot.HasValue || !partySpot.Value.IsForbidden(item)) && (!partySpot.HasValue || item.CanReach(partySpot.Value, PathEndMode.Touch, Danger.Some, false, TraverseMode.ByPawn)))
                {
                    num++;
                }
            }
            return(num >= value);
        }
Beispiel #3
0
 public override float VoluntaryJoinPriorityFor(Pawn p)
 {
     if (IsInvited(p))
     {
         if (!PartyUtility.ShouldPawnKeepPartying(p))
         {
             return(0f);
         }
         if (spot.IsForbidden(p))
         {
             return(0f);
         }
         if (!lord.ownedPawns.Contains(p) && IsPartyAboutToEnd())
         {
             return(0f);
         }
         return(VoluntarilyJoinableLordJobJoinPriorities.PartyGuest);
     }
     return(0f);
 }
Beispiel #4
0
        public static bool EnoughPotentialGuestsToStartParty(Map map, IntVec3?partySpot = null)
        {
            int num = Mathf.RoundToInt((float)map.mapPawns.FreeColonistsSpawnedCount * 0.65f);

            num = Mathf.Clamp(num, 2, 10);
            int num2 = 0;

            foreach (Pawn current in map.mapPawns.FreeColonistsSpawned)
            {
                if (PartyUtility.ShouldPawnKeepPartying(current))
                {
                    if (!partySpot.HasValue || !partySpot.Value.IsForbidden(current))
                    {
                        if (!partySpot.HasValue || current.CanReach(partySpot.Value, PathEndMode.Touch, Danger.Some, false, TraverseMode.ByPawn))
                        {
                            num2++;
                        }
                    }
                }
            }
            return(num2 >= num);
        }
        public static Pawn FindRandomPartyOrganizer(Faction faction, Map map)
        {
            Predicate <Pawn> validator = (Pawn x) => x.RaceProps.Humanlike && !x.InBed() && !x.InMentalState && x.GetLord() == null && PartyUtility.ShouldPawnKeepPartying(x);
            Pawn             result    = default(Pawn);

            if ((from x in map.mapPawns.SpawnedPawnsInFaction(faction)
                 where validator(x)
                 select x).TryRandomElement <Pawn>(out result))
            {
                return(result);
            }
            return(null);
        }
 private static bool <FindRandomPartyOrganizer> m__0(Pawn x)
 {
     return(x.RaceProps.Humanlike && !x.InBed() && !x.InMentalState && x.GetLord() == null && PartyUtility.ShouldPawnKeepPartying(x));
 }