public static void ReportSpawn(MobileParty spawned, float chanceOfSpawnBeforeSpawn) { if (Singleton == null || spawned.Party.TotalStrength < Singleton.campaignConfig.MinimumSpawnLogValue || chanceOfSpawnBeforeSpawn > Singleton.campaignConfig.MinimumRarityToLog) { return; } string msg = "New Spawn: " + spawned.StringId + "\nTotal Strength:" + spawned.Party.TotalStrength.ToString() + "\nChance of Spawn: " + chanceOfSpawnBeforeSpawn.ToString(); var spawnData = DynamicSpawnData.GetDynamicSpawnData(spawned).spawnBaseData; if (spawnData.DynamicSpawnChanceEffect > 0) { msg += "\nDynamic Spawn Chance Effect: " + spawnData.DynamicSpawnChanceEffect; msg += "\nDynamic Spawn Chance Base Value During Spawn: " + DataUtils.GetCurrentDynamicSpawnCoeff(spawnData.DynamicSpawnChancePeriod); } var spawnSettlement = DynamicSpawnData.GetDynamicSpawnData(spawned).latestClosestSettlement; if (spawnSettlement.IsVillage) { msg += "\nDevestation at spawn settlement: " + DevestationMetricData.Singleton.GetDevestation(spawnSettlement); } msg += "\n"; Singleton.WriteString(msg); }
private void HourlyPartyBehaviour(MobileParty mb) { if (DynamicSpawnData.GetDynamicSpawnData(mb) == null) //check if it is a custom spawns party { return; } UpdateDynamicData(mb); if (lastRedundantDataUpdate >= CsSettings.UpdatePartyRedundantDataPerHour) { UpdateRedundantDynamicData(mb); } //for now for all Economics.PartyEconomicUtils.PartyReplenishFood(mb); }
//deal with our parties being removed! Also this is more efficient ;) private void OnPartyRemoved(PartyBase p) { MobileParty mb = p.MobileParty; if (mb == null) { return; } CSPartyData partyData = DynamicSpawnData.GetDynamicSpawnData(mb); if (partyData != null) { partyData.spawnBaseData.DecrementNumberSpawned(); //this is a custom spawns party!! OnPartyDeath(mb, partyData); ModDebug.ShowMessage(mb.StringId + " has died at " + partyData.latestClosestSettlement + ", reducing the total number to: " + partyData.spawnBaseData.GetNumberSpawned(), DebugMessageType.DeathTrack); DynamicSpawnData.RemoveDynamicSpawnData(mb); } }
public void UpdateRedundantDynamicData(MobileParty mb) { DynamicSpawnData.GetDynamicSpawnData(mb).latestClosestSettlement = CampaignUtils.GetClosestHabitedSettlement(mb); }