CampfireParty.Building_Pyre.TryToStartCampfireParty C# (CSharp) Method

TryToStartCampfireParty() public method

public TryToStartCampfireParty ( ) : void
return void
        public void TryToStartCampfireParty()
        {
            // Check there are at least 2 revelers near the pyre.
            int revelersCount = 0;
            List<Pawn> revelers = new List<Pawn>();
            foreach (Pawn colonist in Find.MapPawns.FreeColonists)
            {
                List<IntVec3> partyAreaCells = GetPartyAreaCells(this.Position);
                if ((partyAreaCells.Contains(colonist.Position))
                    && colonist.Drafted)
                {
                    revelersCount++;
                    revelers.Add(colonist);
                }
            }
            if (revelersCount < 2)
            {
                Messages.Message("Not enough revelers near pyre to start party.", MessageSound.RejectInput);
                return;
            }

            this.campfirePartyIsStarted = true;
            
            // Start party with the available nearby colonists.
            foreach (Pawn reveler in revelers)
            {
                reveler.jobs.StopAll();
                reveler.drafter.Drafted = false;
                Job job = new Job(Util_CampfireParty.Job_StartCampfireParty, this);
                reveler.jobs.StartJob(job);
            }
            // Start music according to the party style.
            Find.MusicManagerMap.ForceStartSong(DefDatabase<SongDef>.GetNamed("Moon_Harvest"), false);
            
            // Spawn the heater/glower.
            this.pyreFire = GenSpawn.Spawn(Util_CampfireParty.Def_PyreFire, this.Position);
        }
    }