public void Register(Building_DJStand stand) { if (!stand.DestroyedOrNull() && !allStands.Contains(stand)) { allStands.Add(stand); } }
public void UnRegister(Building_DJStand stand) { if (stand != null && allStands.Contains(stand)) { allStands.Remove(stand); } }
protected override LordJob CreateLordJob(IntVec3 spot, Pawn organizer) { if (tempStand == null) { Core.Error("Failed to find DJ table!"); return(null); } var job = new LordJob_Joinable_Disco(spot, organizer, this.def, tempStand); tempStand = null; return(job); }
public SequenceHandler CreateAndInitHandler(Building_DJStand stand) { if (handlerType == null) { return(null); } var instance = Activator.CreateInstance(handlerType, this, stand) as SequenceHandler; if (instance == null) { return(null); } instance.Init(); return(instance); }
public DiscoProgram MakeProgram(Building_DJStand stand, Dictionary <string, string> overrides = null) { if (programClass == null) { return(null); } var instance = Activator.CreateInstance(programClass, this) as DiscoProgram; if (instance == null) { return(null); } instance.DJStand = stand; this.overrides = (overrides?.Count ?? 0) > 0 ? overrides : null; instance.Init(); this.overrides = null; return(instance); }
protected override bool TryFindGatherSpot(Pawn organizer, out IntVec3 spot) { //return RCellFinder.TryFindGatheringSpot_NewTemp(organizer, this.def, false, out spot); var tracker = organizer.Map?.GetComponent <DiscoTracker>(); spot = default; if (tracker == null) { Core.Warn($"Organizer {organizer.LabelShortCap}'s map is null or does not have a DiscoTracker comp"); return(false); } var stands = tracker.GetAllValidDJStands(); if (stands.EnumerableNullOrEmpty()) { return(false); } tempStand = stands.RandomElementByWeight(dj => dj.FloorBounds.Area); spot = tempStand.GetGatherSpot(); return(true); }
protected override IEnumerable <Toil> MakeNewToils() { var reachPlatform = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell); reachPlatform.finishActions ??= new List <System.Action>(); reachPlatform.finishActions.Add(() => { LookTargets t = new LookTargets(reachPlatform.actor); Messages.Message("DSC.DJArrived".Translate(), t, MessageTypeDefOf.PositiveEvent); var lordJob = pawn.Map?.lordManager?.LordOf(pawn)?.LordJob; if (lordJob is LordJob_Joinable_Disco dl) { stand = dl.DJStand; stand.PickSequenceIfNull = true; } }); yield return(reachPlatform); Toil toil = new Toil(); toil.defaultCompleteMode = ToilCompleteMode.Never; toil.initAction = delegate() { Map.pawnDestinationReservationManager.Reserve(this.pawn, this.job, this.pawn.Position); pawn.pather.StopDead(); pawn.rotationTracker.FaceCell(TargetB.Cell); }; toil.finishActions ??= new List <System.Action>(); toil.finishActions.Add(() => { Core.Log("Finished standing at DJ platform. Shutting down platform."); stand.PickSequenceIfNull = false; }); yield return(toil); }
public LordJob_Joinable_Disco(IntVec3 spot, Pawn organizer, GatheringDef gatheringDef, Building_DJStand stand) : base(spot, organizer, gatheringDef) { this.durationTicks = Rand.RangeInclusive(10000, 15000); this.DJStand = stand; }
public SequenceHandler(SequenceDef def, Building_DJStand stand) { Def = def; Stand = stand; }