public void NewCultistCheck() { if (CurrentSeedState < CultSeedState.FinishedWriting) { return; } if (ticksToCheckCultists == 0) { ticksToCheckCultists = Find.TickManager.TicksGame + 500; } if (ticksToCheckCultists < Find.TickManager.TicksGame) { ticksToCheckCultists = Find.TickManager.TicksGame + 500; IEnumerable <Pawn> spawnedColonyMembers = map.mapPawns.FreeColonistsAndPrisonersSpawned; Cult playerCult = CultTracker.Get.PlayerCult; if (spawnedColonyMembers != null) { if (spawnedColonyMembers.Count <Pawn>() > 0) { foreach (Pawn colonist in map.mapPawns.FreeColonistsAndPrisonersSpawned) { Need_CultMindedness cultMind = colonist.needs.TryGetNeed <Need_CultMindedness>(); if (cultMind != null) { if (cultMind.CurLevelPercentage > 0.7) { if (playerCult == null) { playerCult = new Cult(colonist); } playerCult.SetMember(colonist); } else if (cultMind.CurInstantLevelPercentage > 0.3 && cultMind.CurInstantLevelPercentage < 0.7) { if (playerCult != null) { playerCult.RemoveMember(colonist); CultTracker.Get.RemoveInquisitor(colonist); } } else if (cultMind.CurInstantLevelPercentage < 0.3) { CultTracker.Get.SetInquisitor(colonist); } } if (colonist.Dead) { playerCult.RemoveMember(colonist); //Log.Messag("9b"); CultTracker.Get.RemoveInquisitor(colonist); continue; } //Log.Messag("10"); } } } } }
public void NewCultistCheck() { if (CurrentSeedState < CultSeedState.FinishedWriting) { return; } //Cult Tick (500 ticks) if (ticksToCheckCultists == 0) { ticksToCheckCultists = Find.TickManager.TicksGame + 500; } if (ticksToCheckCultists >= Find.TickManager.TicksGame) { return; } ticksToCheckCultists = Find.TickManager.TicksGame + 500; List <Pawn> spawnedColonyMembers = new List <Pawn>(map.mapPawns.FreeColonistsAndPrisonersSpawned); Cult playerCult = CultTracker.Get.PlayerCult; if (spawnedColonyMembers == null || spawnedColonyMembers.Count == 0) { return; } foreach (Pawn colonist in spawnedColonyMembers) { if (colonist.needs.TryGetNeed <Need_CultMindedness>() is Need_CultMindedness cultMind) { //Cult-Mindedness Above 70%? You will join the cult. if (cultMind.CurLevelPercentage > 0.7) { if (playerCult == null) { playerCult = new Cult(colonist); } playerCult.SetMember(colonist); } //Otherwise, you will be removed from the cult. else if (cultMind.CurInstantLevelPercentage > 0.3 && cultMind.CurInstantLevelPercentage < 0.7) { if (playerCult != null) { playerCult.RemoveMember(colonist); CultTracker.Get.RemoveInquisitor(colonist); } } //Those with cult mindedness below 30% will be inquisitors. else if (cultMind.CurInstantLevelPercentage < 0.3) { CultTracker.Get.SetInquisitor(colonist); } } if (colonist.Dead) { playerCult.RemoveMember(colonist); //Log.Messag("9b"); CultTracker.Get.RemoveInquisitor(colonist); continue; } //Log.Messag("10"); } }