private static void GenerateMap() { MapParent mapParent = (MapParent)WorldObjectMaker.MakeWorldObject(WorldObjectDefOf.Settlement); mapParent.Tile = TileFinder.RandomStartingTile(); mapParent.SetFaction(Faction.OfPlayer); Find.WorldObjects.Add(mapParent); GetOrGenerateMapUtility.GetOrGenerateMap(mapParent.Tile, new IntVec3(50, 1, 50), null); }
public void EstablishFarcasterLink() { mapHome = this.Map; Messages.Message("GU_FarcasterActivated".Translate(), MessageTypeDefOf.PositiveEvent); FarcasterDestination worldObjectFarcaster = (FarcasterDestination)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed("GU_FarcasterDestinationSigmaAlcyon", true)); mapParent = (MapParent)worldObjectFarcaster; mapParent.Tile = TileFinder.RandomStartingTile(); mapParent.SetFaction(Faction.OfPlayer); worldObjectFarcaster.mapHome = mapHome; worldObjectFarcaster.mapGen = DefDatabase <MapGeneratorDef> .GetNamed("GU_FarcasterMapSigmaAlcyon", true); Find.WorldObjects.Add(mapParent); myMap = new Map(); LongEventHandler.QueueLongEvent(delegate { myMap = GetOrGenerateMapUtility.GetOrGenerateMap(mapParent.Tile, Find.World.info.initialMapSize, null); }, "GU_LinkingWithFarcasters", true, new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap)); LongEventHandler.QueueLongEvent(delegate { originalBiome = myMap.TileInfo.biome; originalTile = mapParent.Tile; myMap.TileInfo.biome = DefDatabase <BiomeDef> .GetNamed("GU_SigmaAlcyonIIb", true); mapParent.Tile = base.Tile; mapFarcast = myMap; //Remote Farcaster portal spawning Building_AncientFarcaster building_AncientFarcaster = (Building_AncientFarcaster)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("GU_AncientFarcasterPortal", true)); building_AncientFarcaster.mapHome = mapHome; building_AncientFarcaster.locationHome = this.Position; building_AncientFarcaster.SetFaction(Faction.OfPlayer); GenSpawn.Spawn(building_AncientFarcaster, myMap.Center, myMap); locationFarcast = building_AncientFarcaster.Position; //An auxiliary pad too Building_Storage building_AncientPad = (Building_Storage)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("GU_AncientFarcasterPad", true)); building_AncientPad.SetFaction(Faction.OfPlayer); GenSpawn.Spawn(building_AncientPad, myMap.Center - GenAdj.CardinalDirections[0] * 4, myMap); //Farcaster portal spawning ends here }, "GU_LinkingWithFarcasters", true, new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap)); }
public static void BeginArenaFight(List <PawnKindDef> lhs, List <PawnKindDef> rhs, Action <ArenaResult> callback) { MapParent mapParent = (MapParent)WorldObjectMaker.MakeWorldObject(WorldObjectDefOf.Debug_Arena); mapParent.Tile = TileFinder.RandomSettlementTileFor(Faction.OfPlayer, mustBeAutoChoosable: true, (int tile) => lhs.Concat(rhs).Any((PawnKindDef pawnkind) => Find.World.tileTemperatures.SeasonAndOutdoorTemperatureAcceptableFor(tile, pawnkind.race))); mapParent.SetFaction(Faction.OfPlayer); Find.WorldObjects.Add(mapParent); Map orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(mapParent.Tile, new IntVec3(50, 1, 50), null); MultipleCaravansCellFinder.FindStartingCellsFor2Groups(orGenerateMap, out IntVec3 first, out IntVec3 second); List <Pawn> lhs2 = SpawnPawnSet(orGenerateMap, lhs, first, Faction.OfAncients); List <Pawn> rhs2 = SpawnPawnSet(orGenerateMap, rhs, second, Faction.OfAncientsHostile); DebugArena component = mapParent.GetComponent <DebugArena>(); component.lhs = lhs2; component.rhs = rhs2; component.callback = callback; }
public static void BeginArenaFight(List <PawnKindDef> lhs, List <PawnKindDef> rhs, Action <ArenaResult> callback) { MapParent mapParent = (MapParent)WorldObjectMaker.MakeWorldObject(WorldObjectDefOf.Debug_Arena); mapParent.Tile = TileFinder.RandomFactionBaseTileFor(Faction.OfPlayer, true, (int tile) => lhs.Concat(rhs).Any((PawnKindDef pawnkind) => Find.World.tileTemperatures.SeasonAndOutdoorTemperatureAcceptableFor(tile, pawnkind.race))); mapParent.SetFaction(Faction.OfPlayer); Find.WorldObjects.Add(mapParent); Map orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(mapParent.Tile, new IntVec3(50, 1, 50), null); IntVec3 spot = default(IntVec3); IntVec3 spot2 = default(IntVec3); MultipleCaravansCellFinder.FindStartingCellsFor2Groups(orGenerateMap, out spot, out spot2); List <Pawn> lhs2 = ArenaUtility.SpawnPawnSet(orGenerateMap, lhs, spot, Faction.OfSpacer); List <Pawn> rhs2 = ArenaUtility.SpawnPawnSet(orGenerateMap, rhs, spot2, Faction.OfSpacerHostile); DebugArena component = ((WorldObject)mapParent).GetComponent <DebugArena>(); component.lhs = lhs2; component.rhs = rhs2; component.callback = callback; }