Exemple #1
0
        public LordJob_JoinableShow(Building_Carn venue, Pawn entertainer)
        {
            this.info = CarnUtils.Info;

            spot = venue.AudienceCentre;

            this.entertainer = entertainer;

            var rotation = venue.Rotation;

            audienceRect = CellRect.CenteredOn(spot, 2);

            switch (rotation.AsByte)
            {
            case 0:
                audienceRect.maxZ--;
                entertainerSpot = spot + IntVec3.North * 2;
                break;

            case 1:
                audienceRect.maxX--;
                entertainerSpot = spot + IntVec3.East * 2;
                break;

            case 2:
                audienceRect.minZ++;
                entertainerSpot = spot + IntVec3.South * 2;
                break;

            case 3:
                audienceRect.minX++;
                entertainerSpot = spot + IntVec3.West * 2;
                break;
            }
        }
Exemple #2
0
 public static void Cleanup()
 {
     cachedRoles.Clear();
     cachedInfo = null;
     CellsUtil.Cleanup();
 }
        public static IEnumerable <Blueprint> PlaceCarnivalBlueprints(CarnivalInfo info)
        {
            // Assign necessary values to this singleton (is this technically a singleton, or just static?)
            AIBlueprintsUtility.info = info;

            if (info.currentLord.CurLordToil.data is LordToilData_SetupCarnival)
            {
                availableCrates = ((LordToilData_SetupCarnival)info.currentLord.CurLordToil.data).availableCrates;
                stallUsers      = ((List <Pawn>)info.pawnsWithRole[CarnivalRole.Vendor]).ListFullCopyOrNull();
            }
            else
            {
                Log.Error("Tried to place carnival blueprints while not in setup toil.");
                yield break;
            }

            cachedPos.Clear();



            // Do the blueprint thing

            if (!availableCrates.NullOrEmpty())
            {
                foreach (var tent in PlaceTentBlueprints())
                {
                    cachedPos.Add(tent.Position);
                    yield return(tent);
                }

                if (!stallUsers.NullOrEmpty())
                {
                    foreach (var stall in PlaceStallBlueprints())
                    {
                        cachedPos.Add(stall.Position);
                        yield return(stall);
                    }
                }

                var entrance = PlaceEntranceBlueprint();

                if (entrance != null)
                {
                    cachedPos.Add(entrance.Position);
                    yield return(entrance);
                }

                foreach (var game in PlaceGameBlueprints())
                {
                    cachedPos.Add(game.Position);
                    yield return(game);
                }

                var trashSign = PlaceTrashBlueprint();

                if (trashSign != null)
                {
                    yield return(trashSign);
                }
            }

            cachedPos.Clear();
        }