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 override void PostMapGenerate(Map map) { base.PostMapGenerate(map); MapParent mapParent = Find.World.worldObjects.MapParentAt(map.Tile); Faction faction = mapParent.Faction; //TODO: check if it works IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.FactionArrival, map); incidentParms.points = Mathf.Max(incidentParms.points, 250f); incidentParms.points *= 2f; PawnGroupMakerParms pawnGroupMakerParms = new PawnGroupMakerParms(); pawnGroupMakerParms.groupKind = PawnGroupKindDefOf.Settlement; pawnGroupMakerParms.tile = map.Tile; pawnGroupMakerParms.faction = faction; pawnGroupMakerParms.points = incidentParms.points; pawnGroupMakerParms.inhabitants = true; List <Pawn> list = new List <Pawn>(); foreach (Pawn pawn in PawnGroupMakerUtility.GeneratePawns(pawnGroupMakerParms, true)) { IntVec3 loc; CellFinder.TryFindRandomCellInsideWith(new CellRect(40, 40, map.Size.x - 80, map.Size.z - 80), (IntVec3 c) => c.Standable(map), out loc); GenSpawn.Spawn(pawn, loc, map); list.Add(pawn); } IntVec3 intVec; CellFinder.TryFindRandomCellInsideWith(new CellRect(50, 50, map.Size.x - 100, map.Size.z - 100), (IntVec3 c) => c.Standable(map), out intVec); if (faction.leader != null) { GenSpawn.Spawn(faction.leader, intVec, map); mapParent.GetComponent <QuestComp_PeaceTalks>().Negotiator = faction.leader; list.Add(faction.leader); } LordJob lordJob = new LordJob_DefendBase(faction, intVec); LordMaker.MakeNewLord(faction, lordJob, map, list); }
public static FloatMenuAcceptanceReport CanEnter(Caravan caravan, MapParent mapParent) { //worldObject.GetComponent<EnterCooldownComp>()?.DaysLeft ?? 0f add message return(!(mapParent.GetComponent <EnterCooldownComp>()?.BlocksEntering ?? false)); }
public static float EnterCooldownDaysLeft(this MapParent worldObject) { return(worldObject.GetComponent <EnterCooldownComp>()?.DaysLeft ?? 0f); }
public static bool EnterCooldownBlocksEntering(this MapParent worldObject) { return(worldObject.GetComponent <EnterCooldownComp>()?.BlocksEntering ?? false); }