public override void PreMapGenerate() { var defaultSettlement = Find.WorldObjects.MapParentAt(Find.GameInitData.startingTile); Find.WorldObjects.Remove(defaultSettlement); var citadel = (Citadel)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed("City_Citadel")); citadel.SetFaction(Find.GameInitData.playerFaction); citadel.inhabitantFaction = GenCity.RandomCityFaction(f => !f.def.CanEverBeNonHostile); citadel.Tile = Find.GameInitData.startingTile; citadel.Name = citadel.ChooseName(); Find.WorldObjects.Add(citadel); }
public override void PreMapGenerate() { var defaultSettlement = Find.WorldObjects.MapParentAt(Find.GameInitData.startingTile); Find.WorldObjects.Remove(defaultSettlement); var city = (City)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed(GetObjectDefName())); city.SetFaction(Find.GameInitData.playerFaction); city.inhabitantFaction = GenCity.RandomCityFaction(IsValidFaction); city.Tile = Find.GameInitData.startingTile; city.Name = SettlementNameGenerator.GenerateSettlementName(city, city.inhabitantFaction?.def.factionNameMaker); Find.WorldObjects.Add(city); }
public override void Generate(Map map, GenStepParams parms) { base.Generate(map, parms); var faction = GenCity.RandomCityFaction(f => f.PlayerGoodwill > -50); for (var i = 0; i < innocentPawns; i++) { var pawn = GenCity.SpawnInhabitant(CellRect.WholeMap(map).RandomCell, map, new LordJob_ExitMapBest()); pawn.SetFactionDirect(faction); } // map.weatherManager.curWeather = DefDatabase<WeatherDef>.GetNamed("Fog"); }
void GenerateCity(WorldObjectDef def, bool abandoned, System.Predicate <Faction> factionFilter = null) { var city = (City)WorldObjectMaker.MakeWorldObject(def); city.SetFaction(GenCity.RandomCityFaction(factionFilter)); if (!abandoned) { city.inhabitantFaction = city.Faction; } city.Tile = TileFinder.RandomSettlementTileFor(city.Faction); city.Name = city.ChooseName(); if (!TileFinder.IsValidTileForNewSettlement(city.Tile)) { // (Faction Control) ensure valid tile for existing saves city.Tile = TileFinder.RandomStartingTile(); } Find.WorldObjects.Add(city); }
private void GeneratePawns() { var faction = city.Faction; hostages = new List <Pawn>(); for (var i = 0; i < hostageCount; i++) { var pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDefOf.Slave, faction, PawnGenerationContext.NonPlayer, city.Tile)); pawn.equipment?.DestroyAllEquipment(); hostages.Add(pawn); } var captorFaction = GenCity.RandomCityFaction(f => !faction.def.CanEverBeNonHostile) ?? GenCity.RandomCityFaction(f => f.HostileTo(Faction.OfPlayer)); captors = new List <Pawn>(); for (var i = 0; i < captorCount; i++) { var pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(faction.RandomPawnKind(), captorFaction, PawnGenerationContext.NonPlayer, city.Tile)); captors.Add(pawn); } }
void GenerateCities(int per100kTiles, bool abandoned) { int cityCount = GenMath.RoundRandom(Find.WorldGrid.TilesCount / 100000F * per100kTiles); for (int i = 0; i < cityCount; i++) { var city = (City)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed(abandoned ? "City_Abandoned" : "City_Faction")); city.SetFaction(GenCity.RandomCityFaction()); if (!abandoned) { city.inhabitantFaction = city.Faction; } city.Tile = TileFinder.RandomSettlementTileFor(city.Faction); city.Name = SettlementNameGenerator.GenerateSettlementName(city); if (!TileFinder.IsValidTileForNewSettlement(city.Tile)) { // (Faction Control) ensure valid tile for existing saves city.Tile = TileFinder.RandomStartingTile(); } Find.WorldObjects.Add(city); } }
public override void Tick() { var map = Find.CurrentMap; if (map != null && Find.TickManager.TicksGame == 20) { var faction = GenCity.RandomCityFaction(f => f.GoodwillWith(Faction.OfPlayer) >= 0 && !f.def.HasRoyalTitles); faction.TryAffectGoodwillWith(Faction.OfPlayer, 100, false, false); var storyComp = Find.Storyteller.storytellerComps.First(x => x is StorytellerComp_OnOffCycle || x is StorytellerComp_RandomMain); var parms = storyComp.GenerateParms(IncidentCategoryDefOf.ThreatBig, map); parms.faction = faction; parms.raidStrategy = RaidStrategyDefOf.ImmediateAttackFriendly; parms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeWalkIn; parms.raidArrivalModeForQuickMilitaryAid = true; parms.points = 2500; parms.biocodeWeaponsChance = 0; parms.raidNeverFleeIndividual = true; parms.dontUseSingleUseRocketLaunchers = true; IncidentDefOf.RaidFriendly.Worker.TryExecute(parms); } }
public virtual void PreMapGenerate(Map map) { SetFaction(inhabitantFaction ?? GenCity.RandomCityFaction(f => f.HostileTo(Faction.OfPlayer))); }