Ejemplo n.º 1
0
        public override void UpdateAllDuties()
        {
            var     wanderRect      = CellRect.CenteredOn(Info.setupCentre, 8);
            int     numActiveGuards = Mathf.RoundToInt(Info.pawnsWithRole[CarnivalRole.Guard].Count / 2f);
            IntVec3 pos;

            foreach (var pawn in this.lord.ownedPawns)
            {
                CarnivalRole pawnRole = pawn.GetCarnivalRole();

                if (pawnRole.Is(CarnivalRole.Guard))
                {
                    if (numActiveGuards > 0 && pawn.needs.rest.CurCategory == RestCategory.Rested)
                    {
                        DutyUtility.GuardCircuit(pawn);
                        numActiveGuards--;
                    }
                    else
                    {
                        // rest on the off shift if not assigned a position
                        DutyUtility.ForceRest(pawn);
                    }
                }
                else if (pawnRole.IsAny(CarnivalRole.Vendor, CarnivalRole.Carrier))
                {
                    if (Info.rememberedPositions.TryGetValue(pawn, out pos))
                    {
                        DutyUtility.HitchToSpot(pawn, pos);
                    }
                    else
                    {
                        DutyUtility.HitchToSpot(pawn, pawn.Position);
                    }
                }
                else if (pawnRole.Is(CarnivalRole.Entertainer))
                {
                    if (Info.rememberedPositions.TryGetValue(pawn, out pos))
                    {
                        DutyUtility.HitchToSpot(pawn, pos);
                    }
                }
                else if (pawnRole.Is(CarnivalRole.Worker))
                {
                    DutyUtility.MeanderAndHelp(pawn, Info.AverageLodgeTentPos, 10f);
                }
                else
                {
                    DutyUtility.MeanderAndHelp(pawn, wanderRect.RandomCell, Info.baseRadius);
                }
            }
        }
Ejemplo n.º 2
0
        // OVERRIDE METHODS //

        public override void UpdateAllDuties()
        {
            int curHour         = GenLocalDate.HourInteger(Map);
            int numActiveGuards = Mathf.RoundToInt(Info.pawnsWithRole[CarnivalRole.Guard].Count / 2f);

            foreach (var pawn in lord.ownedPawns)
            {
                CarnivalRole role = pawn.GetCarnivalRole();

                if (role.Is(CarnivalRole.Guard))
                {
                    if (numActiveGuards > 0 && pawn.needs.rest.CurCategory == RestCategory.Rested)
                    {
                        DutyUtility.GuardCircuit(pawn);
                        numActiveGuards--;
                    }
                    else
                    {
                        // rest on the off shift if not assigned a position
                        DutyUtility.ForceRest(pawn);
                    }
                }
                else if (role.IsAny(CarnivalRole.Entertainer, CarnivalRole.Vendor) &&
                         curHour >= 22)
                {
                    DutyUtility.ForceRest(pawn);
                }
                else if (role.Is(CarnivalRole.Worker))
                {
                    DutyUtility.MeanderAndHelp(pawn, Info.setupCentre, Info.baseRadius);
                }
                else if (!role.Is(CarnivalRole.Carrier))
                {
                    DutyUtility.Meander(pawn, Info.setupCentre, Info.baseRadius);
                }
            }
        }