public static IntVec3 FindShipDropPoint(Map map, CellRect rect, ThingDef thingDef, ref Rot4?rot, out bool hasToWipeBuilding, out bool doesntFit) { if (!thingDef.rotatable) { rot = new Rot4?(Rot4.North); } if (!rot.HasValue) { RunwayUtility.tmpRotations.Shuffle <Rot4>(); for (int i = 0; i < RunwayUtility.tmpRotations.Length; i++) { IntVec3 result = RunwayUtility.FindBestSpawnCellForNonItem(map, rect, thingDef, RunwayUtility.tmpRotations[i], out hasToWipeBuilding, out doesntFit); if (!hasToWipeBuilding && !doesntFit) { rot = new Rot4?(RunwayUtility.tmpRotations[i]); return(result); } } for (int j = 0; j < RunwayUtility.tmpRotations.Length; j++) { IntVec3 result2 = RunwayUtility.FindBestSpawnCellForNonItem(map, rect, thingDef, RunwayUtility.tmpRotations[j], out hasToWipeBuilding, out doesntFit); if (!doesntFit) { rot = new Rot4?(RunwayUtility.tmpRotations[j]); return(result2); } } rot = new Rot4?(Rot4.Random); return(RunwayUtility.FindBestSpawnCellForNonItem(map, rect, thingDef, rot.Value, out hasToWipeBuilding, out doesntFit)); } return(RunwayUtility.FindBestSpawnCellForNonItem(map, rect, thingDef, rot.Value, out hasToWipeBuilding, out doesntFit)); }
public override void Resolve(ResolveParams rp) { ThingDef stuff = rp.wallStuff ?? ThingDefOf.Steel; Rot4? thingRot = rp.thingRot; Rot4 rot = (thingRot == null) ? Rot4.East : thingRot.Value; if (rp.singleThingDef.rotatable) { if (rp.singleThingDef.MadeFromStuff) { Thing thing = ThingMaker.MakeThing(rp.singleThingDef, stuff); GenSpawn.Spawn(thing, rp.rect.RandomCell, BaseGen.globalSettings.map, rot, WipeMode.Vanish, false); } else { Thing thing2 = ThingMaker.MakeThing(rp.singleThingDef, null); GenSpawn.Spawn(thing2, rp.rect.RandomCell, BaseGen.globalSettings.map, rot, WipeMode.Vanish, false); } } else if (rp.singleThingDef.MadeFromStuff) { Thing thing3 = ThingMaker.MakeThing(rp.singleThingDef, stuff); GenSpawn.Spawn(thing3, rp.rect.RandomCell, BaseGen.globalSettings.map, rot, WipeMode.Vanish, false); } else { Thing thing4 = ThingMaker.MakeThing(rp.singleThingDef, null); GenSpawn.Spawn(thing4, rp.rect.RandomCell, BaseGen.globalSettings.map, rot, WipeMode.Vanish, false); } }
public override bool CanResolve(ResolveParams rp) { bool result; if (!base.CanResolve(rp)) { result = false; } else if (rp.singleThingToSpawn != null) { result = false; } else { if (rp.singleThingDef != null) { Rot4? thingRot = rp.thingRot; Rot4 rot = (thingRot == null) ? Rot4.North : thingRot.Value; IntVec3 zero = IntVec3.Zero; IntVec2 size = rp.singleThingDef.size; GenAdj.AdjustForRotation(ref zero, ref size, rot); if (rp.rect.Width < size.x || rp.rect.Height < size.z) { return(false); } } result = true; } return(result); }
public override void Resolve(ResolveParams rp) { int? ancientCryptosleepCasketGroupID = rp.ancientCryptosleepCasketGroupID; int groupID = (ancientCryptosleepCasketGroupID == null) ? Find.UniqueIDsManager.GetNextAncientCryptosleepCasketGroupID() : ancientCryptosleepCasketGroupID.Value; PodContentsType?podContentsType = rp.podContentsType; PodContentsType value = (podContentsType == null) ? Gen.RandomEnumValue <PodContentsType>(true) : podContentsType.Value; Rot4? thingRot = rp.thingRot; Rot4 rot = (thingRot == null) ? Rot4.North : thingRot.Value; Building_AncientCryptosleepCasket building_AncientCryptosleepCasket = (Building_AncientCryptosleepCasket)ThingMaker.MakeThing(ThingDefOf.AncientCryptosleepCasket, null); building_AncientCryptosleepCasket.groupID = groupID; ThingSetMakerParams parms = default(ThingSetMakerParams); parms.podContentsType = new PodContentsType?(value); List <Thing> list = ThingSetMakerDefOf.MapGen_AncientPodContents.root.Generate(parms); for (int i = 0; i < list.Count; i++) { if (!building_AncientCryptosleepCasket.TryAcceptThing(list[i], false)) { Pawn pawn = list[i] as Pawn; if (pawn != null) { Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard); } else { list[i].Destroy(DestroyMode.Vanish); } } } GenSpawn.Spawn(building_AncientCryptosleepCasket, rp.rect.RandomCell, BaseGen.globalSettings.map, rot, WipeMode.Vanish, false); }
public override void Resolve(ResolveParams rp) { Map map = BaseGen.globalSettings.map; Faction faction; if ((faction = rp.faction) == null) { faction = (Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Industrial) ?? Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Undefined)); } Faction faction2 = faction; Rot4? thingRot = rp.thingRot; Rot4 rot = (thingRot == null) ? Rot4.Random : thingRot.Value; ThingDef thingDef; if ((thingDef = rp.mortarDef) == null) { thingDef = (from x in DefDatabase <ThingDef> .AllDefsListForReading where x.category == ThingCategory.Building && x.building.IsMortar select x).RandomElement <ThingDef>(); } ThingDef thingDef2 = thingDef; IntVec3 intVec; if (this.TryFindMortarSpawnCell(rp.rect, rot, thingDef2, out intVec)) { if (thingDef2.HasComp(typeof(CompMannable))) { IntVec3 c = ThingUtility.InteractionCellWhenAt(thingDef2, intVec, rot, map); Lord singlePawnLord = LordMaker.MakeNewLord(faction2, new LordJob_ManTurrets(), map, null); PawnKindDef kind = faction2.RandomPawnKind(); Faction faction3 = faction2; int tile = map.Tile; PawnGenerationRequest value = new PawnGenerationRequest(kind, faction3, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, true, 1f, false, true, true, true, false, false, false, null, null, null, null, null, null, null, null); ResolveParams resolveParams = rp; resolveParams.faction = faction2; resolveParams.singlePawnGenerationRequest = new PawnGenerationRequest?(value); resolveParams.rect = CellRect.SingleCell(c); resolveParams.singlePawnLord = singlePawnLord; BaseGen.symbolStack.Push("pawn", resolveParams); } ThingDef turret = thingDef2; bool allowEMP = false; TechLevel techLevel = faction2.def.techLevel; ThingDef thingDef3 = TurretGunUtility.TryFindRandomShellDef(turret, allowEMP, true, techLevel, false, 250f); if (thingDef3 != null) { ResolveParams resolveParams2 = rp; resolveParams2.faction = faction2; resolveParams2.singleThingDef = thingDef3; resolveParams2.singleThingStackCount = new int?(Rand.RangeInclusive(5, Mathf.Min(8, thingDef3.stackLimit))); BaseGen.symbolStack.Push("thing", resolveParams2); } ResolveParams resolveParams3 = rp; resolveParams3.faction = faction2; resolveParams3.singleThingDef = thingDef2; resolveParams3.rect = CellRect.SingleCell(intVec); resolveParams3.thingRot = new Rot4?(rot); BaseGen.symbolStack.Push("thing", resolveParams3); } }
private IntVec3 FindBestSpawnCellForNonItem(CellRect rect, ThingDef thingDef, ref Rot4?rot, out bool hasToWipeBuilding, out bool doesntFit) { if (!thingDef.rotatable) { rot = new Rot4?(Rot4.North); } if (!rot.HasValue) { SymbolResolver_SingleThing.tmpRotations.Shuffle <Rot4>(); for (int i = 0; i < SymbolResolver_SingleThing.tmpRotations.Length; i++) { IntVec3 result = this.FindBestSpawnCellForNonItem(rect, thingDef, SymbolResolver_SingleThing.tmpRotations[i], out hasToWipeBuilding, out doesntFit); if (!hasToWipeBuilding && !doesntFit) { rot = new Rot4?(SymbolResolver_SingleThing.tmpRotations[i]); return(result); } } for (int j = 0; j < SymbolResolver_SingleThing.tmpRotations.Length; j++) { IntVec3 result2 = this.FindBestSpawnCellForNonItem(rect, thingDef, SymbolResolver_SingleThing.tmpRotations[j], out hasToWipeBuilding, out doesntFit); if (!doesntFit) { rot = new Rot4?(SymbolResolver_SingleThing.tmpRotations[j]); return(result2); } } rot = new Rot4?(Rot4.Random); return(this.FindBestSpawnCellForNonItem(rect, thingDef, rot.Value, out hasToWipeBuilding, out doesntFit)); } return(this.FindBestSpawnCellForNonItem(rect, thingDef, rot.Value, out hasToWipeBuilding, out doesntFit)); }
public override bool CanResolve(ResolveParams rp) { if (!base.CanResolve(rp)) { return(false); } if (rp.singleThingToSpawn != null) { return(false); } if (rp.singleThingDef != null) { Rot4? thingRot = rp.thingRot; Rot4 rot = (!thingRot.HasValue) ? Rot4.North : thingRot.Value; IntVec3 zero = IntVec3.Zero; IntVec2 size = rp.singleThingDef.size; GenAdj.AdjustForRotation(ref zero, ref size, rot); if (rp.rect.Width >= size.x && rp.rect.Height >= size.z) { goto IL_009d; } return(false); } goto IL_009d; IL_009d: return(true); }
static void Prefix(PawnRenderer __instance, ref Rot4?rotOverride, ref bool __state) { var pawn = __instance.pawn; if (pawn.Map == null || pawn.GetPosture() != PawnPosture.Standing || pawn.Downed) { return; } HandleRotation(pawn, ref rotOverride); }
public override void Resolve(ResolveParams rp) { Map map = BaseGen.globalSettings.map; Faction faction = rp.faction ?? Find.FactionManager.RandomEnemyFaction(allowHidden: false, allowDefeated: false, allowNonHumanlike: true, TechLevel.Industrial) ?? Find.FactionManager.RandomEnemyFaction(); Rot4? thingRot = rp.thingRot; Rot4 rot = (!thingRot.HasValue) ? Rot4.Random : thingRot.Value; ThingDef thingDef = rp.mortarDef ?? (from x in DefDatabase <ThingDef> .AllDefsListForReading where x.category == ThingCategory.Building && x.building.IsMortar select x).RandomElement(); if (TryFindMortarSpawnCell(rp.rect, rot, thingDef, out IntVec3 cell)) { if (thingDef.HasComp(typeof(CompMannable))) { IntVec3 c = ThingUtility.InteractionCellWhenAt(thingDef, cell, rot, map); Lord singlePawnLord = LordMaker.MakeNewLord(faction, new LordJob_ManTurrets(), map); PawnKindDef kind = faction.RandomPawnKind(); Faction faction2 = faction; int tile = map.Tile; PawnGenerationRequest value = new PawnGenerationRequest(kind, faction2, PawnGenerationContext.NonPlayer, tile, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: true, 1f, forceAddFreeWarmLayerIfNeeded: false, allowGay: true, allowFood: true, inhabitant: true); ResolveParams resolveParams = rp; resolveParams.faction = faction; resolveParams.singlePawnGenerationRequest = value; resolveParams.rect = CellRect.SingleCell(c); resolveParams.singlePawnLord = singlePawnLord; BaseGen.symbolStack.Push("pawn", resolveParams); } ThingDef turret = thingDef; bool allowEMP = false; TechLevel techLevel = faction.def.techLevel; ThingDef thingDef2 = TurretGunUtility.TryFindRandomShellDef(turret, allowEMP, mustHarmHealth: true, techLevel, allowAntigrainWarhead: false, 250f); if (thingDef2 != null) { ResolveParams resolveParams2 = rp; resolveParams2.faction = faction; resolveParams2.singleThingDef = thingDef2; resolveParams2.singleThingStackCount = Rand.RangeInclusive(5, Mathf.Min(8, thingDef2.stackLimit)); BaseGen.symbolStack.Push("thing", resolveParams2); } ResolveParams resolveParams3 = rp; resolveParams3.faction = faction; resolveParams3.singleThingDef = thingDef; resolveParams3.rect = CellRect.SingleCell(cell); resolveParams3.thingRot = rot; BaseGen.symbolStack.Push("thing", resolveParams3); } }
public static bool CreateAndDropSingleShip(Map map, Faction faction, ThingDef shipDef, List <Pawn> pawns, bool dropPawns, out ShipBase newShip) { List <ShipBase> ships = CreateDropShips(pawns, faction, new List <ThingDef> { shipDef }); if (!ships.NullOrEmpty()) { ShipBase ship = ships[0]; List <Zone> runways = map.zoneManager.AllZones.FindAll(x => x is Zone_Runway); bool wipeBuildings; bool doesntFit; IntVec3 dropCell = IntVec3.Zero; Rot4? rot = ship.Rotation; foreach (var runway in runways) { List <IntVec3> cells = runway.Cells; int x = cells.Min(c => c.x); int z = cells.Min(c => c.z); int width = cells.Max(c => c.x) - x; int height = cells.Max(c => c.z) - z; CellRect rect = new CellRect(x, z, width, height); dropCell = (RunwayUtility.FindShipDropPoint(map, rect, ship.def, ref rot, out wipeBuildings, out doesntFit)); if (doesntFit == true) { newShip = null; return(false); } if (wipeBuildings == true) { Messages.Message("LandingZoneBlocked".Translate(), MessageTypeDefOf.RejectInput); newShip = null; return(false); } } newShip = ship; DropShipUtility.DropSingleShip(map, dropCell, ship, ShipArrivalAction.EnterMapFriendly, dropPawns); return(true); } newShip = null; return(false); }
static void HandleRotation(Pawn pawn, ref Rot4?rotOverride) { var comp = pawn.Map.CarouselComp(); var camera = Rot4.FromAngleFlat(-comp.current).AsInt; // Conditions from Pawn_RotationTracker.UpdateRotation if (!pawn.Destroyed && !pawn.jobs.HandlingFacing && pawn.pather.Moving && pawn.pather.curPath != null && pawn.pather.curPath.NodesLeftCount >= 1) { var movingRotation = FaceAdjacentCell(pawn.Position, pawn.pather.nextCell, Rot4.FromAngleFlat(-comp.current)); if (movingRotation != null) { rotOverride = new Rot4(movingRotation.Value.AsInt); return; } } rotOverride = new Rot4((rotOverride?.AsInt ?? pawn.Rotation.AsInt) + camera); }
public override void Resolve(ResolveParams rp) { ThingDef thingDef; if ((thingDef = rp.singleThingDef) == null) { thingDef = (from x in ThingSetMakerUtility.allGeneratableItems where x.IsWeapon || x.IsMedicine || x.IsDrug select x).RandomElement <ThingDef>(); } ThingDef thingDef2 = thingDef; Rot4? thingRot = rp.thingRot; Rot4 rot = (thingRot == null) ? Rot4.North : thingRot.Value; IntVec3 zero = IntVec3.Zero; IntVec2 size = thingDef2.size; int? fillWithThingsPadding = rp.fillWithThingsPadding; int num = (fillWithThingsPadding == null) ? 0 : fillWithThingsPadding.Value; if (num < 0) { num = 0; } GenAdj.AdjustForRotation(ref zero, ref size, rot); if (size.x <= 0 || size.z <= 0) { Log.Error("Thing has 0 size.", false); } else { for (int i = rp.rect.minX; i <= rp.rect.maxX - size.x + 1; i += size.x + num) { for (int j = rp.rect.minZ; j <= rp.rect.maxZ - size.z + 1; j += size.z + num) { ResolveParams resolveParams = rp; resolveParams.rect = new CellRect(i, j, size.x, size.z); resolveParams.singleThingDef = thingDef2; resolveParams.thingRot = new Rot4?(rot); BaseGen.symbolStack.Push("thing", resolveParams); } } BaseGen.symbolStack.Push("clear", rp); } }
public override bool CanResolve(ResolveParams rp) { if (!base.CanResolve(rp)) { return(false); } if (rp.singleThingToSpawn != null) { return(false); } if (rp.singleThingDef != null) { Rot4? thingRot = rp.thingRot; Rot4 rot = (!thingRot.HasValue) ? Rot4.North : thingRot.Value; IntVec3 center = IntVec3.Zero; IntVec2 size = rp.singleThingDef.size; GenAdj.AdjustForRotation(ref center, ref size, rot); if (rp.rect.Width < size.x || rp.rect.Height < size.z) { return(false); } } return(true); }
private IntVec3 FindBestSpawnCellForNonItem(CellRect rect, ThingDef thingDef, ref Rot4?rot, out bool hasToWipeBuilding, out bool doesntFit) { if (!thingDef.rotatable) { rot = Rot4.North; } if (!rot.HasValue) { tmpRotations.Shuffle(); for (int i = 0; i < tmpRotations.Length; i++) { IntVec3 result = FindBestSpawnCellForNonItem(rect, thingDef, tmpRotations[i], out hasToWipeBuilding, out doesntFit); if (!hasToWipeBuilding && !doesntFit) { rot = tmpRotations[i]; return(result); } } for (int j = 0; j < tmpRotations.Length; j++) { IntVec3 result2 = FindBestSpawnCellForNonItem(rect, thingDef, tmpRotations[j], out hasToWipeBuilding, out doesntFit); if (!doesntFit) { rot = tmpRotations[j]; return(result2); } } rot = Rot4.Random; return(FindBestSpawnCellForNonItem(rect, thingDef, rot.Value, out hasToWipeBuilding, out doesntFit)); } return(FindBestSpawnCellForNonItem(rect, thingDef, rot.Value, out hasToWipeBuilding, out doesntFit)); }
public static VehiclePawn SpawnVehicleRandomized(VehicleDef vehicleDef, IntVec3 cell, Map map, Faction faction, Rot4?rot = null, bool autoFill = false) { if (rot is null) { rot = Rot4.Random; } VehiclePawn vehicle = GenerateVehicle(new VehicleGenerationRequest(vehicleDef, faction, true, true)); vehicle.CompFueledTravel?.Refuel(vehicle.CompFueledTravel.FuelCapacity); GenSpawn.Spawn(vehicle, cell, map, rot.Value, WipeMode.FullRefund, false); if (autoFill) { foreach (VehicleHandler handler in vehicle.handlers.Where(h => h.role.handlingTypes.NotNullAndAny())) { Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDefOf.Colonist, faction)); pawn.SetFactionDirect(faction); vehicle.GiveLoadJob(pawn, handler); vehicle.Notify_Boarded(pawn); } } return(vehicle); }
public override string ToString() { object[] array = new object[114]; array[0] = "rect="; array[1] = this.rect; array[2] = ", faction="; array[3] = ((this.faction == null) ? "null" : this.faction.ToString()); array[4] = ", custom="; array[5] = ((this.custom == null) ? "null" : this.custom.Count.ToString()); array[6] = ", ancientTempleEntranceHeight="; int num = 7; int?num2 = this.ancientTempleEntranceHeight; array[num] = ((num2 == null) ? "null" : this.ancientTempleEntranceHeight.ToString()); array[8] = ", pawnGroupMakerParams="; array[9] = ((this.pawnGroupMakerParams == null) ? "null" : this.pawnGroupMakerParams.ToString()); array[10] = ", pawnGroupKindDef="; array[11] = ((this.pawnGroupKindDef == null) ? "null" : this.pawnGroupKindDef.ToString()); array[12] = ", roofDef="; array[13] = ((this.roofDef == null) ? "null" : this.roofDef.ToString()); array[14] = ", noRoof="; int num3 = 15; bool?flag = this.noRoof; array[num3] = ((flag == null) ? "null" : this.noRoof.ToString()); array[16] = ", addRoomCenterToRootsToUnfog="; int num4 = 17; bool?flag2 = this.addRoomCenterToRootsToUnfog; array[num4] = ((flag2 == null) ? "null" : this.addRoomCenterToRootsToUnfog.ToString()); array[18] = ", singleThingToSpawn="; array[19] = ((this.singleThingToSpawn == null) ? "null" : this.singleThingToSpawn.ToString()); array[20] = ", singleThingDef="; array[21] = ((this.singleThingDef == null) ? "null" : this.singleThingDef.ToString()); array[22] = ", singleThingStuff="; array[23] = ((this.singleThingStuff == null) ? "null" : this.singleThingStuff.ToString()); array[24] = ", singleThingStackCount="; int num5 = 25; int?num6 = this.singleThingStackCount; array[num5] = ((num6 == null) ? "null" : this.singleThingStackCount.ToString()); array[26] = ", skipSingleThingIfHasToWipeBuildingOrDoesntFit="; int num7 = 27; bool?flag3 = this.skipSingleThingIfHasToWipeBuildingOrDoesntFit; array[num7] = ((flag3 == null) ? "null" : this.skipSingleThingIfHasToWipeBuildingOrDoesntFit.ToString()); array[28] = ", spawnBridgeIfTerrainCantSupportThing="; int num8 = 29; bool?flag4 = this.spawnBridgeIfTerrainCantSupportThing; array[num8] = ((flag4 == null) ? "null" : this.spawnBridgeIfTerrainCantSupportThing.ToString()); array[30] = ", singlePawnToSpawn="; array[31] = ((this.singlePawnToSpawn == null) ? "null" : this.singlePawnToSpawn.ToString()); array[32] = ", singlePawnKindDef="; array[33] = ((this.singlePawnKindDef == null) ? "null" : this.singlePawnKindDef.ToString()); array[34] = ", disableSinglePawn="; int num9 = 35; bool?flag5 = this.disableSinglePawn; array[num9] = ((flag5 == null) ? "null" : this.disableSinglePawn.ToString()); array[36] = ", singlePawnLord="; array[37] = ((this.singlePawnLord == null) ? "null" : this.singlePawnLord.ToString()); array[38] = ", singlePawnSpawnCellExtraPredicate="; array[39] = ((this.singlePawnSpawnCellExtraPredicate == null) ? "null" : this.singlePawnSpawnCellExtraPredicate.ToString()); array[40] = ", singlePawnGenerationRequest="; int num10 = 41; PawnGenerationRequest?pawnGenerationRequest = this.singlePawnGenerationRequest; array[num10] = ((pawnGenerationRequest == null) ? "null" : this.singlePawnGenerationRequest.ToString()); array[42] = ", postThingSpawn="; array[43] = ((this.postThingSpawn == null) ? "null" : this.postThingSpawn.ToString()); array[44] = ", postThingGenerate="; array[45] = ((this.postThingGenerate == null) ? "null" : this.postThingGenerate.ToString()); array[46] = ", mechanoidsCount="; int num11 = 47; int?num12 = this.mechanoidsCount; array[num11] = ((num12 == null) ? "null" : this.mechanoidsCount.ToString()); array[48] = ", hivesCount="; int num13 = 49; int?num14 = this.hivesCount; array[num13] = ((num14 == null) ? "null" : this.hivesCount.ToString()); array[50] = ", disableHives="; int num15 = 51; bool?flag6 = this.disableHives; array[num15] = ((flag6 == null) ? "null" : this.disableHives.ToString()); array[52] = ", thingRot="; int num16 = 53; Rot4?rot = this.thingRot; array[num16] = ((rot == null) ? "null" : this.thingRot.ToString()); array[54] = ", wallStuff="; array[55] = ((this.wallStuff == null) ? "null" : this.wallStuff.ToString()); array[56] = ", chanceToSkipWallBlock="; int num17 = 57; float?num18 = this.chanceToSkipWallBlock; array[num17] = ((num18 == null) ? "null" : this.chanceToSkipWallBlock.ToString()); array[58] = ", floorDef="; array[59] = ((this.floorDef == null) ? "null" : this.floorDef.ToString()); array[60] = ", chanceToSkipFloor="; int num19 = 61; float?num20 = this.chanceToSkipFloor; array[num19] = ((num20 == null) ? "null" : this.chanceToSkipFloor.ToString()); array[62] = ", filthDef="; array[63] = ((this.filthDef == null) ? "null" : this.filthDef.ToString()); array[64] = ", filthDensity="; int num21 = 65; FloatRange?floatRange = this.filthDensity; array[num21] = ((floatRange == null) ? "null" : this.filthDensity.ToString()); array[66] = ", clearEdificeOnly="; int num22 = 67; bool?flag7 = this.clearEdificeOnly; array[num22] = ((flag7 == null) ? "null" : this.clearEdificeOnly.ToString()); array[68] = ", clearFillageOnly="; int num23 = 69; bool?flag8 = this.clearFillageOnly; array[num23] = ((flag8 == null) ? "null" : this.clearFillageOnly.ToString()); array[70] = ", clearRoof="; int num24 = 71; bool?flag9 = this.clearRoof; array[num24] = ((flag9 == null) ? "null" : this.clearRoof.ToString()); array[72] = ", ancientCryptosleepCasketGroupID="; int num25 = 73; int?num26 = this.ancientCryptosleepCasketGroupID; array[num25] = ((num26 == null) ? "null" : this.ancientCryptosleepCasketGroupID.ToString()); array[74] = ", podContentsType="; int num27 = 75; PodContentsType?podContentsType = this.podContentsType; array[num27] = ((podContentsType == null) ? "null" : this.podContentsType.ToString()); array[76] = ", thingSetMakerDef="; array[77] = ((this.thingSetMakerDef == null) ? "null" : this.thingSetMakerDef.ToString()); array[78] = ", thingSetMakerParams="; int num28 = 79; ThingSetMakerParams?thingSetMakerParams = this.thingSetMakerParams; array[num28] = ((thingSetMakerParams == null) ? "null" : this.thingSetMakerParams.ToString()); array[80] = ", stockpileConcreteContents="; array[81] = ((this.stockpileConcreteContents == null) ? "null" : this.stockpileConcreteContents.Count.ToString()); array[82] = ", stockpileMarketValue="; int num29 = 83; float?num30 = this.stockpileMarketValue; array[num29] = ((num30 == null) ? "null" : this.stockpileMarketValue.ToString()); array[84] = ", innerStockpileSize="; int num31 = 85; int?num32 = this.innerStockpileSize; array[num31] = ((num32 == null) ? "null" : this.innerStockpileSize.ToString()); array[86] = ", edgeDefenseWidth="; int num33 = 87; int?num34 = this.edgeDefenseWidth; array[num33] = ((num34 == null) ? "null" : this.edgeDefenseWidth.ToString()); array[88] = ", edgeDefenseTurretsCount="; int num35 = 89; int?num36 = this.edgeDefenseTurretsCount; array[num35] = ((num36 == null) ? "null" : this.edgeDefenseTurretsCount.ToString()); array[90] = ", edgeDefenseMortarsCount="; int num37 = 91; int?num38 = this.edgeDefenseMortarsCount; array[num37] = ((num38 == null) ? "null" : this.edgeDefenseMortarsCount.ToString()); array[92] = ", edgeDefenseGuardsCount="; int num39 = 93; int?num40 = this.edgeDefenseGuardsCount; array[num39] = ((num40 == null) ? "null" : this.edgeDefenseGuardsCount.ToString()); array[94] = ", mortarDef="; array[95] = ((this.mortarDef == null) ? "null" : this.mortarDef.ToString()); array[96] = ", pathwayFloorDef="; array[97] = ((this.pathwayFloorDef == null) ? "null" : this.pathwayFloorDef.ToString()); array[98] = ", cultivatedPlantDef="; array[99] = ((this.cultivatedPlantDef == null) ? "null" : this.cultivatedPlantDef.ToString()); array[100] = ", fillWithThingsPadding="; int num41 = 101; int?num42 = this.fillWithThingsPadding; array[num41] = ((num42 == null) ? "null" : this.fillWithThingsPadding.ToString()); array[102] = ", settlementPawnGroupPoints="; int num43 = 103; float?num44 = this.settlementPawnGroupPoints; array[num43] = ((num44 == null) ? "null" : this.settlementPawnGroupPoints.ToString()); array[104] = ", settlementPawnGroupSeed="; int num45 = 105; int?num46 = this.settlementPawnGroupSeed; array[num45] = ((num46 == null) ? "null" : this.settlementPawnGroupSeed.ToString()); array[106] = ", streetHorizontal="; int num47 = 107; bool?flag10 = this.streetHorizontal; array[num47] = ((flag10 == null) ? "null" : this.streetHorizontal.ToString()); array[108] = ", edgeThingAvoidOtherEdgeThings="; int num48 = 109; bool?flag11 = this.edgeThingAvoidOtherEdgeThings; array[num48] = ((flag11 == null) ? "null" : this.edgeThingAvoidOtherEdgeThings.ToString()); array[110] = ", allowPlacementOffEdge="; int num49 = 111; bool?flag12 = this.allowPlacementOffEdge; array[num49] = ((flag12 == null) ? "null" : this.allowPlacementOffEdge.ToString()); array[112] = ", thrustAxis="; int num50 = 113; Rot4?rot2 = this.thrustAxis; array[num50] = ((rot2 == null) ? "null" : this.thrustAxis.ToString()); return(string.Concat(array)); }
public override void Resolve(ResolveParams rp) { if (rp.singleThingToSpawn is Pawn) { ResolveParams resolveParams = rp; resolveParams.singlePawnToSpawn = (Pawn)rp.singleThingToSpawn; BaseGen.symbolStack.Push("pawn", resolveParams); } else { if (rp.singleThingToSpawn != null && rp.singleThingToSpawn.Spawned) { return; } ThingDef thingDef = (rp.singleThingToSpawn != null) ? rp.singleThingToSpawn.def : (rp.singleThingDef ?? (from x in ItemCollectionGeneratorUtility.allGeneratableItems where x.IsWeapon || x.IsMedicine || x.IsDrug select x).RandomElement()); Rot4? nullable = rp.thingRot; IntVec3 loc = default(IntVec3); if (thingDef.category == ThingCategory.Item) { nullable = Rot4.North; if (!this.TryFindSpawnCellForItem(rp.rect, out loc)) { if (rp.singleThingToSpawn != null) { rp.singleThingToSpawn.Destroy(DestroyMode.Vanish); } return; } } else { bool flag = default(bool); bool flag2 = default(bool); loc = this.FindBestSpawnCellForNonItem(rp.rect, thingDef, ref nullable, out flag, out flag2); if ((flag || flag2) && rp.skipSingleThingIfHasToWipeBuildingOrDoesntFit.HasValue && rp.skipSingleThingIfHasToWipeBuildingOrDoesntFit.Value) { return; } } if (!nullable.HasValue) { Log.Error("Could not resolve rotation. Bug."); } Thing thing; if (rp.singleThingToSpawn == null) { ThingDef stuff = (rp.singleThingStuff == null || !rp.singleThingStuff.stuffProps.CanMake(thingDef)) ? GenStuff.RandomStuffByCommonalityFor(thingDef, (rp.faction != null) ? rp.faction.def.techLevel : TechLevel.Undefined) : rp.singleThingStuff; thing = ThingMaker.MakeThing(thingDef, stuff); Thing thing2 = thing; int? singleThingStackCount = rp.singleThingStackCount; thing2.stackCount = ((!singleThingStackCount.HasValue) ? 1 : singleThingStackCount.Value); if (thing.stackCount <= 0) { thing.stackCount = 1; } if (thing.def.CanHaveFaction && thing.Faction != rp.faction) { thing.SetFaction(rp.faction, null); } CompQuality compQuality = thing.TryGetComp <CompQuality>(); if (compQuality != null) { compQuality.SetQuality(QualityUtility.RandomBaseGenItemQuality(), ArtGenerationContext.Outsider); } if (rp.postThingGenerate != null) { rp.postThingGenerate(thing); } } else { thing = rp.singleThingToSpawn; } thing = GenSpawn.Spawn(thing, loc, BaseGen.globalSettings.map, nullable.Value, false); if (thing != null && thing.def.category == ThingCategory.Item) { thing.SetForbidden(true, false); } if (rp.postThingSpawn != null) { rp.postThingSpawn(thing); } } }
/// <summary> /// Ensures the cellrect inhabited by <paramref name="vehicleDef"/> contains no Things that will block pathing and movement at <paramref name="cell"/>. /// </summary> /// <param name="pawn"></param> /// <param name="c"></param> public static bool CellRectStandable(this VehicleDef vehicleDef, Map map, IntVec3 cell, Rot4?rot = null) { IntVec2 dimensions = vehicleDef.Size; if (rot?.IsHorizontal ?? false) { int x = dimensions.x; dimensions.x = dimensions.z; dimensions.z = x; } foreach (IntVec3 cell2 in CellRect.CenteredOn(cell, dimensions.x, dimensions.z)) { if (vehicleDef.IsBoat() && !GenGridVehicles.Standable(cell2, map)) { return(false); } else if (!GenGrid.Standable(cell2, map)) { return(false); } } return(true); }
public override string ToString() { object[] obj = new object[116] { "rect=", rect, ", faction=", (faction == null) ? "null" : faction.ToString(), ", custom=", (custom == null) ? "null" : custom.Count.ToString(), ", ancientTempleEntranceHeight=", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null }; int?num = ancientTempleEntranceHeight; obj[7] = ((!num.HasValue) ? "null" : ancientTempleEntranceHeight.ToString()); obj[8] = ", pawnGroupMakerParams="; obj[9] = ((pawnGroupMakerParams == null) ? "null" : pawnGroupMakerParams.ToString()); obj[10] = ", pawnGroupKindDef="; obj[11] = ((pawnGroupKindDef == null) ? "null" : pawnGroupKindDef.ToString()); obj[12] = ", roofDef="; obj[13] = ((roofDef == null) ? "null" : roofDef.ToString()); obj[14] = ", noRoof="; bool?flag = noRoof; obj[15] = ((!flag.HasValue) ? "null" : noRoof.ToString()); obj[16] = ", addRoomCenterToRootsToUnfog="; bool?flag2 = addRoomCenterToRootsToUnfog; obj[17] = ((!flag2.HasValue) ? "null" : addRoomCenterToRootsToUnfog.ToString()); obj[18] = ", singleThingToSpawn="; obj[19] = ((singleThingToSpawn == null) ? "null" : singleThingToSpawn.ToString()); obj[20] = ", singleThingDef="; obj[21] = ((singleThingDef == null) ? "null" : singleThingDef.ToString()); obj[22] = ", singleThingStuff="; obj[23] = ((singleThingStuff == null) ? "null" : singleThingStuff.ToString()); obj[24] = ", singleThingStackCount="; int?num2 = singleThingStackCount; obj[25] = ((!num2.HasValue) ? "null" : singleThingStackCount.ToString()); obj[26] = ", skipSingleThingIfHasToWipeBuildingOrDoesntFit="; bool?flag3 = skipSingleThingIfHasToWipeBuildingOrDoesntFit; obj[27] = ((!flag3.HasValue) ? "null" : skipSingleThingIfHasToWipeBuildingOrDoesntFit.ToString()); obj[28] = ", spawnBridgeIfTerrainCantSupportThing="; bool?flag4 = spawnBridgeIfTerrainCantSupportThing; obj[29] = ((!flag4.HasValue) ? "null" : spawnBridgeIfTerrainCantSupportThing.ToString()); obj[30] = ", singlePawnToSpawn="; obj[31] = ((singlePawnToSpawn == null) ? "null" : singlePawnToSpawn.ToString()); obj[32] = ", singlePawnKindDef="; obj[33] = ((singlePawnKindDef == null) ? "null" : singlePawnKindDef.ToString()); obj[34] = ", disableSinglePawn="; bool?flag5 = disableSinglePawn; obj[35] = ((!flag5.HasValue) ? "null" : disableSinglePawn.ToString()); obj[36] = ", singlePawnLord="; obj[37] = ((singlePawnLord == null) ? "null" : singlePawnLord.ToString()); obj[38] = ", singlePawnSpawnCellExtraPredicate="; obj[39] = ((singlePawnSpawnCellExtraPredicate == null) ? "null" : singlePawnSpawnCellExtraPredicate.ToString()); obj[40] = ", singlePawnGenerationRequest="; PawnGenerationRequest?pawnGenerationRequest = singlePawnGenerationRequest; obj[41] = ((!pawnGenerationRequest.HasValue) ? "null" : singlePawnGenerationRequest.ToString()); obj[42] = ", postThingSpawn="; obj[43] = ((postThingSpawn == null) ? "null" : postThingSpawn.ToString()); obj[44] = ", postThingGenerate="; obj[45] = ((postThingGenerate == null) ? "null" : postThingGenerate.ToString()); obj[46] = ", mechanoidsCount="; int?num3 = mechanoidsCount; obj[47] = ((!num3.HasValue) ? "null" : mechanoidsCount.ToString()); obj[48] = ", hivesCount="; int?num4 = hivesCount; obj[49] = ((!num4.HasValue) ? "null" : hivesCount.ToString()); obj[50] = ", disableHives="; bool?flag6 = disableHives; obj[51] = ((!flag6.HasValue) ? "null" : disableHives.ToString()); obj[52] = ", thingRot="; Rot4?rot = thingRot; obj[53] = ((!rot.HasValue) ? "null" : thingRot.ToString()); obj[54] = ", wallStuff="; obj[55] = ((wallStuff == null) ? "null" : wallStuff.ToString()); obj[56] = ", chanceToSkipWallBlock="; float?num5 = chanceToSkipWallBlock; obj[57] = ((!num5.HasValue) ? "null" : chanceToSkipWallBlock.ToString()); obj[58] = ", floorDef="; obj[59] = ((floorDef == null) ? "null" : floorDef.ToString()); obj[60] = ", chanceToSkipFloor="; float?num6 = chanceToSkipFloor; obj[61] = ((!num6.HasValue) ? "null" : chanceToSkipFloor.ToString()); obj[62] = ", filthDef="; obj[63] = ((filthDef == null) ? "null" : filthDef.ToString()); obj[64] = ", filthDensity="; FloatRange?floatRange = filthDensity; obj[65] = ((!floatRange.HasValue) ? "null" : filthDensity.ToString()); obj[66] = ", floorOnlyIfTerrainSupports="; bool?flag7 = floorOnlyIfTerrainSupports; obj[67] = ((!flag7.HasValue) ? "null" : floorOnlyIfTerrainSupports.ToString()); obj[68] = ", clearEdificeOnly="; bool?flag8 = clearEdificeOnly; obj[69] = ((!flag8.HasValue) ? "null" : clearEdificeOnly.ToString()); obj[70] = ", clearFillageOnly="; bool?flag9 = clearFillageOnly; obj[71] = ((!flag9.HasValue) ? "null" : clearFillageOnly.ToString()); obj[72] = ", clearRoof="; bool?flag10 = clearRoof; obj[73] = ((!flag10.HasValue) ? "null" : clearRoof.ToString()); obj[74] = ", ancientCryptosleepCasketGroupID="; int?num7 = ancientCryptosleepCasketGroupID; obj[75] = ((!num7.HasValue) ? "null" : ancientCryptosleepCasketGroupID.ToString()); obj[76] = ", podContentsType="; PodContentsType?podContentsType = this.podContentsType; obj[77] = ((!podContentsType.HasValue) ? "null" : this.podContentsType.ToString()); obj[78] = ", thingSetMakerDef="; obj[79] = ((thingSetMakerDef == null) ? "null" : thingSetMakerDef.ToString()); obj[80] = ", thingSetMakerParams="; ThingSetMakerParams?thingSetMakerParams = this.thingSetMakerParams; obj[81] = ((!thingSetMakerParams.HasValue) ? "null" : this.thingSetMakerParams.ToString()); obj[82] = ", stockpileConcreteContents="; obj[83] = ((stockpileConcreteContents == null) ? "null" : stockpileConcreteContents.Count.ToString()); obj[84] = ", stockpileMarketValue="; float?num8 = stockpileMarketValue; obj[85] = ((!num8.HasValue) ? "null" : stockpileMarketValue.ToString()); obj[86] = ", innerStockpileSize="; int?num9 = innerStockpileSize; obj[87] = ((!num9.HasValue) ? "null" : innerStockpileSize.ToString()); obj[88] = ", edgeDefenseWidth="; int?num10 = edgeDefenseWidth; obj[89] = ((!num10.HasValue) ? "null" : edgeDefenseWidth.ToString()); obj[90] = ", edgeDefenseTurretsCount="; int?num11 = edgeDefenseTurretsCount; obj[91] = ((!num11.HasValue) ? "null" : edgeDefenseTurretsCount.ToString()); obj[92] = ", edgeDefenseMortarsCount="; int?num12 = edgeDefenseMortarsCount; obj[93] = ((!num12.HasValue) ? "null" : edgeDefenseMortarsCount.ToString()); obj[94] = ", edgeDefenseGuardsCount="; int?num13 = edgeDefenseGuardsCount; obj[95] = ((!num13.HasValue) ? "null" : edgeDefenseGuardsCount.ToString()); obj[96] = ", mortarDef="; obj[97] = ((mortarDef == null) ? "null" : mortarDef.ToString()); obj[98] = ", pathwayFloorDef="; obj[99] = ((pathwayFloorDef == null) ? "null" : pathwayFloorDef.ToString()); obj[100] = ", cultivatedPlantDef="; obj[101] = ((cultivatedPlantDef == null) ? "null" : cultivatedPlantDef.ToString()); obj[102] = ", fillWithThingsPadding="; int?num14 = fillWithThingsPadding; obj[103] = ((!num14.HasValue) ? "null" : fillWithThingsPadding.ToString()); obj[104] = ", settlementPawnGroupPoints="; float?num15 = settlementPawnGroupPoints; obj[105] = ((!num15.HasValue) ? "null" : settlementPawnGroupPoints.ToString()); obj[106] = ", settlementPawnGroupSeed="; int?num16 = settlementPawnGroupSeed; obj[107] = ((!num16.HasValue) ? "null" : settlementPawnGroupSeed.ToString()); obj[108] = ", streetHorizontal="; bool?flag11 = streetHorizontal; obj[109] = ((!flag11.HasValue) ? "null" : streetHorizontal.ToString()); obj[110] = ", edgeThingAvoidOtherEdgeThings="; bool?flag12 = edgeThingAvoidOtherEdgeThings; obj[111] = ((!flag12.HasValue) ? "null" : edgeThingAvoidOtherEdgeThings.ToString()); obj[112] = ", allowPlacementOffEdge="; bool?flag13 = allowPlacementOffEdge; obj[113] = ((!flag13.HasValue) ? "null" : allowPlacementOffEdge.ToString()); obj[114] = ", thrustAxis="; Rot4?rot2 = thrustAxis; obj[115] = ((!rot2.HasValue) ? "null" : thrustAxis.ToString()); return(string.Concat(obj)); }
public override string ToString() { object[] obj = new object[110] { "rect=", this.rect, ", faction=", (this.faction == null) ? "null" : this.faction.ToString(), ", custom=", (this.custom == null) ? "null" : this.custom.Count.ToString(), ", ancientTempleEntranceHeight=", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null }; int?nullable = this.ancientTempleEntranceHeight; obj[7] = ((!nullable.HasValue) ? "null" : this.ancientTempleEntranceHeight.ToString()); obj[8] = ", pawnGroupMakerParams="; obj[9] = ((this.pawnGroupMakerParams == null) ? "null" : this.pawnGroupMakerParams.ToString()); obj[10] = ", pawnGroupKindDef="; obj[11] = ((this.pawnGroupKindDef == null) ? "null" : this.pawnGroupKindDef.ToString()); obj[12] = ", roofDef="; obj[13] = ((this.roofDef == null) ? "null" : this.roofDef.ToString()); obj[14] = ", noRoof="; bool?nullable2 = this.noRoof; obj[15] = ((!nullable2.HasValue) ? "null" : this.noRoof.ToString()); obj[16] = ", addRoomCenterToRootsToUnfog="; bool?nullable3 = this.addRoomCenterToRootsToUnfog; obj[17] = ((!nullable3.HasValue) ? "null" : this.addRoomCenterToRootsToUnfog.ToString()); obj[18] = ", singleThingToSpawn="; obj[19] = ((this.singleThingToSpawn == null) ? "null" : this.singleThingToSpawn.ToString()); obj[20] = ", singleThingDef="; obj[21] = ((this.singleThingDef == null) ? "null" : this.singleThingDef.ToString()); obj[22] = ", singleThingStuff="; obj[23] = ((this.singleThingStuff == null) ? "null" : this.singleThingStuff.ToString()); obj[24] = ", singleThingStackCount="; int?nullable4 = this.singleThingStackCount; obj[25] = ((!nullable4.HasValue) ? "null" : this.singleThingStackCount.ToString()); obj[26] = ", skipSingleThingIfHasToWipeBuildingOrDoesntFit="; bool?nullable5 = this.skipSingleThingIfHasToWipeBuildingOrDoesntFit; obj[27] = ((!nullable5.HasValue) ? "null" : this.skipSingleThingIfHasToWipeBuildingOrDoesntFit.ToString()); obj[28] = ", singlePawnToSpawn="; obj[29] = ((this.singlePawnToSpawn == null) ? "null" : this.singlePawnToSpawn.ToString()); obj[30] = ", singlePawnKindDef="; obj[31] = ((this.singlePawnKindDef == null) ? "null" : this.singlePawnKindDef.ToString()); obj[32] = ", disableSinglePawn="; bool?nullable6 = this.disableSinglePawn; obj[33] = ((!nullable6.HasValue) ? "null" : this.disableSinglePawn.ToString()); obj[34] = ", singlePawnLord="; obj[35] = ((this.singlePawnLord == null) ? "null" : this.singlePawnLord.ToString()); obj[36] = ", singlePawnSpawnCellExtraPredicate="; obj[37] = ((this.singlePawnSpawnCellExtraPredicate == null) ? "null" : this.singlePawnSpawnCellExtraPredicate.ToString()); obj[38] = ", singlePawnGenerationRequest="; PawnGenerationRequest?nullable7 = this.singlePawnGenerationRequest; obj[39] = ((!nullable7.HasValue) ? "null" : this.singlePawnGenerationRequest.ToString()); obj[40] = ", postThingSpawn="; obj[41] = ((this.postThingSpawn == null) ? "null" : this.postThingSpawn.ToString()); obj[42] = ", postThingGenerate="; obj[43] = ((this.postThingGenerate == null) ? "null" : this.postThingGenerate.ToString()); obj[44] = ", mechanoidsCount="; int?nullable8 = this.mechanoidsCount; obj[45] = ((!nullable8.HasValue) ? "null" : this.mechanoidsCount.ToString()); obj[46] = ", hivesCount="; int?nullable9 = this.hivesCount; obj[47] = ((!nullable9.HasValue) ? "null" : this.hivesCount.ToString()); obj[48] = ", disableHives="; bool?nullable10 = this.disableHives; obj[49] = ((!nullable10.HasValue) ? "null" : this.disableHives.ToString()); obj[50] = ", thingRot="; Rot4?nullable11 = this.thingRot; obj[51] = ((!nullable11.HasValue) ? "null" : this.thingRot.ToString()); obj[52] = ", wallStuff="; obj[53] = ((this.wallStuff == null) ? "null" : this.wallStuff.ToString()); obj[54] = ", chanceToSkipWallBlock="; float?nullable12 = this.chanceToSkipWallBlock; obj[55] = ((!nullable12.HasValue) ? "null" : this.chanceToSkipWallBlock.ToString()); obj[56] = ", floorDef="; obj[57] = ((this.floorDef == null) ? "null" : this.floorDef.ToString()); obj[58] = ", chanceToSkipFloor="; float?nullable13 = this.chanceToSkipFloor; obj[59] = ((!nullable13.HasValue) ? "null" : this.chanceToSkipFloor.ToString()); obj[60] = ", filthDef="; obj[61] = ((this.filthDef == null) ? "null" : this.filthDef.ToString()); obj[62] = ", filthDensity="; FloatRange?nullable14 = this.filthDensity; obj[63] = ((!nullable14.HasValue) ? "null" : this.filthDensity.ToString()); obj[64] = ", clearEdificeOnly="; bool?nullable15 = this.clearEdificeOnly; obj[65] = ((!nullable15.HasValue) ? "null" : this.clearEdificeOnly.ToString()); obj[66] = ", clearFillageOnly="; bool?nullable16 = this.clearFillageOnly; obj[67] = ((!nullable16.HasValue) ? "null" : this.clearFillageOnly.ToString()); obj[68] = ", clearRoof="; bool?nullable17 = this.clearRoof; obj[69] = ((!nullable17.HasValue) ? "null" : this.clearRoof.ToString()); obj[70] = ", ancientCryptosleepCasketGroupID="; int?nullable18 = this.ancientCryptosleepCasketGroupID; obj[71] = ((!nullable18.HasValue) ? "null" : this.ancientCryptosleepCasketGroupID.ToString()); obj[72] = ", podContentsType="; PodContentsType?nullable19 = this.podContentsType; obj[73] = ((!nullable19.HasValue) ? "null" : this.podContentsType.ToString()); obj[74] = ", itemCollectionGeneratorDef="; obj[75] = ((this.itemCollectionGeneratorDef == null) ? "null" : this.itemCollectionGeneratorDef.ToString()); obj[76] = ", itemCollectionGeneratorParams="; ItemCollectionGeneratorParams?nullable20 = this.itemCollectionGeneratorParams; obj[77] = ((!nullable20.HasValue) ? "null" : this.itemCollectionGeneratorParams.ToString()); obj[78] = ", stockpileConcreteContents="; obj[79] = ((this.stockpileConcreteContents == null) ? "null" : this.stockpileConcreteContents.Count.ToString()); obj[80] = ", stockpileMarketValue="; float?nullable21 = this.stockpileMarketValue; obj[81] = ((!nullable21.HasValue) ? "null" : this.stockpileMarketValue.ToString()); obj[82] = ", innerStockpileSize="; int?nullable22 = this.innerStockpileSize; obj[83] = ((!nullable22.HasValue) ? "null" : this.innerStockpileSize.ToString()); obj[84] = ", edgeDefenseWidth="; int?nullable23 = this.edgeDefenseWidth; obj[85] = ((!nullable23.HasValue) ? "null" : this.edgeDefenseWidth.ToString()); obj[86] = ", edgeDefenseTurretsCount="; int?nullable24 = this.edgeDefenseTurretsCount; obj[87] = ((!nullable24.HasValue) ? "null" : this.edgeDefenseTurretsCount.ToString()); obj[88] = ", edgeDefenseMortarsCount="; int?nullable25 = this.edgeDefenseMortarsCount; obj[89] = ((!nullable25.HasValue) ? "null" : this.edgeDefenseMortarsCount.ToString()); obj[90] = ", edgeDefenseGuardsCount="; int?nullable26 = this.edgeDefenseGuardsCount; obj[91] = ((!nullable26.HasValue) ? "null" : this.edgeDefenseGuardsCount.ToString()); obj[92] = ", mortarDef="; obj[93] = ((this.mortarDef == null) ? "null" : this.mortarDef.ToString()); obj[94] = ", pathwayFloorDef="; obj[95] = ((this.pathwayFloorDef == null) ? "null" : this.pathwayFloorDef.ToString()); obj[96] = ", cultivatedPlantDef="; obj[97] = ((this.cultivatedPlantDef == null) ? "null" : this.cultivatedPlantDef.ToString()); obj[98] = ", fillWithThingsPadding="; int?nullable27 = this.fillWithThingsPadding; obj[99] = ((!nullable27.HasValue) ? "null" : this.fillWithThingsPadding.ToString()); obj[100] = ", factionBasePawnGroupPointsFactor="; float?nullable28 = this.factionBasePawnGroupPointsFactor; obj[101] = ((!nullable28.HasValue) ? "null" : this.factionBasePawnGroupPointsFactor.ToString()); obj[102] = ", streetHorizontal="; bool?nullable29 = this.streetHorizontal; obj[103] = ((!nullable29.HasValue) ? "null" : this.streetHorizontal.ToString()); obj[104] = ", edgeThingAvoidOtherEdgeThings="; bool?nullable30 = this.edgeThingAvoidOtherEdgeThings; obj[105] = ((!nullable30.HasValue) ? "null" : this.edgeThingAvoidOtherEdgeThings.ToString()); obj[106] = ", allowPlacementOffEdge="; bool?nullable31 = this.allowPlacementOffEdge; obj[107] = ((!nullable31.HasValue) ? "null" : this.allowPlacementOffEdge.ToString()); obj[108] = ", thrustAxis="; Rot4?nullable32 = this.thrustAxis; obj[109] = ((!nullable32.HasValue) ? "null" : this.thrustAxis.ToString()); return(string.Concat(obj)); }
public override void Resolve(ResolveParams rp) { if (rp.singleThingToSpawn is Pawn) { ResolveParams resolveParams = rp; resolveParams.singlePawnToSpawn = (Pawn)rp.singleThingToSpawn; BaseGen.symbolStack.Push("pawn", resolveParams); } else { if (rp.singleThingToSpawn != null && rp.singleThingToSpawn.Spawned) { return; } ThingDef thingDef = (rp.singleThingToSpawn != null) ? rp.singleThingToSpawn.def : (rp.singleThingDef ?? ThingSetMakerUtility.allGeneratableItems.Where((ThingDef x) => x.IsWeapon || x.IsMedicine || x.IsDrug).RandomElement()); Rot4? rot = rp.thingRot; IntVec3 result; if (thingDef.category == ThingCategory.Item) { rot = Rot4.North; if (!TryFindSpawnCellForItem(rp.rect, out result)) { if (rp.singleThingToSpawn != null) { rp.singleThingToSpawn.Destroy(); } return; } } else { result = FindBestSpawnCellForNonItem(rp.rect, thingDef, ref rot, out bool hasToWipeBuilding, out bool doesntFit); if ((hasToWipeBuilding | doesntFit) && rp.skipSingleThingIfHasToWipeBuildingOrDoesntFit.HasValue && rp.skipSingleThingIfHasToWipeBuildingOrDoesntFit.Value) { return; } } if (!rot.HasValue) { Log.Error("Could not resolve rotation. Bug."); } Thing thing; if (rp.singleThingToSpawn == null) { ThingDef stuff = (rp.singleThingStuff == null || !rp.singleThingStuff.stuffProps.CanMake(thingDef)) ? GenStuff.RandomStuffInexpensiveFor(thingDef, rp.faction) : rp.singleThingStuff; thing = ThingMaker.MakeThing(thingDef, stuff); thing.stackCount = (rp.singleThingStackCount ?? 1); if (thing.stackCount <= 0) { thing.stackCount = 1; } if (thing.def.CanHaveFaction && thing.Faction != rp.faction) { thing.SetFaction(rp.faction); } thing.TryGetComp <CompQuality>()?.SetQuality(QualityUtility.GenerateQualityBaseGen(), ArtGenerationContext.Outsider); if (rp.postThingGenerate != null) { rp.postThingGenerate(thing); } } else { thing = rp.singleThingToSpawn; } if (!rp.spawnBridgeIfTerrainCantSupportThing.HasValue || rp.spawnBridgeIfTerrainCantSupportThing.Value) { BaseGenUtility.CheckSpawnBridgeUnder(thing.def, result, rot.Value); } thing = GenSpawn.Spawn(thing, result, BaseGen.globalSettings.map, rot.Value); if (thing != null && thing.def.category == ThingCategory.Item) { thing.SetForbidden(value: true, warnOnFail: false); } if (rp.postThingSpawn != null) { rp.postThingSpawn(thing); } } }
public override string ToString() { object[] expr_07 = new object[116]; expr_07[0] = "rect="; expr_07[1] = this.rect; expr_07[2] = ", faction="; expr_07[3] = ((this.faction == null) ? "null" : this.faction.ToString()); expr_07[4] = ", custom="; expr_07[5] = ((this.custom == null) ? "null" : this.custom.Count.ToString()); expr_07[6] = ", ancientTempleEntranceHeight="; int arg_B9_1 = 7; int?num = this.ancientTempleEntranceHeight; expr_07[arg_B9_1] = ((!num.HasValue) ? "null" : this.ancientTempleEntranceHeight.ToString()); expr_07[8] = ", pawnGroupMakerParams="; expr_07[9] = ((this.pawnGroupMakerParams == null) ? "null" : this.pawnGroupMakerParams.ToString()); expr_07[10] = ", pawnGroupKindDef="; expr_07[11] = ((this.pawnGroupKindDef == null) ? "null" : this.pawnGroupKindDef.ToString()); expr_07[12] = ", roofDef="; expr_07[13] = ((this.roofDef == null) ? "null" : this.roofDef.ToString()); expr_07[14] = ", noRoof="; int arg_17A_1 = 15; bool?flag = this.noRoof; expr_07[arg_17A_1] = ((!flag.HasValue) ? "null" : this.noRoof.ToString()); expr_07[16] = ", addRoomCenterToRootsToUnfog="; int arg_1B5_1 = 17; bool?flag2 = this.addRoomCenterToRootsToUnfog; expr_07[arg_1B5_1] = ((!flag2.HasValue) ? "null" : this.addRoomCenterToRootsToUnfog.ToString()); expr_07[18] = ", singleThingToSpawn="; expr_07[19] = ((this.singleThingToSpawn == null) ? "null" : this.singleThingToSpawn.ToString()); expr_07[20] = ", singleThingDef="; expr_07[21] = ((this.singleThingDef == null) ? "null" : this.singleThingDef.ToString()); expr_07[22] = ", singleThingStuff="; expr_07[23] = ((this.singleThingStuff == null) ? "null" : this.singleThingStuff.ToString()); expr_07[24] = ", singleThingStackCount="; int arg_278_1 = 25; int?num2 = this.singleThingStackCount; expr_07[arg_278_1] = ((!num2.HasValue) ? "null" : this.singleThingStackCount.ToString()); expr_07[26] = ", skipSingleThingIfHasToWipeBuildingOrDoesntFit="; int arg_2B4_1 = 27; bool?flag3 = this.skipSingleThingIfHasToWipeBuildingOrDoesntFit; expr_07[arg_2B4_1] = ((!flag3.HasValue) ? "null" : this.skipSingleThingIfHasToWipeBuildingOrDoesntFit.ToString()); expr_07[28] = ", spawnBridgeIfTerrainCantSupportThing="; int arg_2F0_1 = 29; bool?flag4 = this.spawnBridgeIfTerrainCantSupportThing; expr_07[arg_2F0_1] = ((!flag4.HasValue) ? "null" : this.spawnBridgeIfTerrainCantSupportThing.ToString()); expr_07[30] = ", singlePawnToSpawn="; expr_07[31] = ((this.singlePawnToSpawn == null) ? "null" : this.singlePawnToSpawn.ToString()); expr_07[32] = ", singlePawnKindDef="; expr_07[33] = ((this.singlePawnKindDef == null) ? "null" : this.singlePawnKindDef.ToString()); expr_07[34] = ", disableSinglePawn="; int arg_386_1 = 35; bool?flag5 = this.disableSinglePawn; expr_07[arg_386_1] = ((!flag5.HasValue) ? "null" : this.disableSinglePawn.ToString()); expr_07[36] = ", singlePawnLord="; expr_07[37] = ((this.singlePawnLord == null) ? "null" : this.singlePawnLord.ToString()); expr_07[38] = ", singlePawnSpawnCellExtraPredicate="; expr_07[39] = ((this.singlePawnSpawnCellExtraPredicate == null) ? "null" : this.singlePawnSpawnCellExtraPredicate.ToString()); expr_07[40] = ", singlePawnGenerationRequest="; int arg_41C_1 = 41; PawnGenerationRequest?pawnGenerationRequest = this.singlePawnGenerationRequest; expr_07[arg_41C_1] = ((!pawnGenerationRequest.HasValue) ? "null" : this.singlePawnGenerationRequest.ToString()); expr_07[42] = ", postThingSpawn="; expr_07[43] = ((this.postThingSpawn == null) ? "null" : this.postThingSpawn.ToString()); expr_07[44] = ", postThingGenerate="; expr_07[45] = ((this.postThingGenerate == null) ? "null" : this.postThingGenerate.ToString()); expr_07[46] = ", mechanoidsCount="; int arg_4B2_1 = 47; int?num3 = this.mechanoidsCount; expr_07[arg_4B2_1] = ((!num3.HasValue) ? "null" : this.mechanoidsCount.ToString()); expr_07[48] = ", hivesCount="; int arg_4EE_1 = 49; int?num4 = this.hivesCount; expr_07[arg_4EE_1] = ((!num4.HasValue) ? "null" : this.hivesCount.ToString()); expr_07[50] = ", disableHives="; int arg_52A_1 = 51; bool?flag6 = this.disableHives; expr_07[arg_52A_1] = ((!flag6.HasValue) ? "null" : this.disableHives.ToString()); expr_07[52] = ", thingRot="; int arg_566_1 = 53; Rot4?rot = this.thingRot; expr_07[arg_566_1] = ((!rot.HasValue) ? "null" : this.thingRot.ToString()); expr_07[54] = ", wallStuff="; expr_07[55] = ((this.wallStuff == null) ? "null" : this.wallStuff.ToString()); expr_07[56] = ", chanceToSkipWallBlock="; int arg_5CF_1 = 57; float?num5 = this.chanceToSkipWallBlock; expr_07[arg_5CF_1] = ((!num5.HasValue) ? "null" : this.chanceToSkipWallBlock.ToString()); expr_07[58] = ", floorDef="; expr_07[59] = ((this.floorDef == null) ? "null" : this.floorDef.ToString()); expr_07[60] = ", chanceToSkipFloor="; int arg_638_1 = 61; float?num6 = this.chanceToSkipFloor; expr_07[arg_638_1] = ((!num6.HasValue) ? "null" : this.chanceToSkipFloor.ToString()); expr_07[62] = ", filthDef="; expr_07[63] = ((this.filthDef == null) ? "null" : this.filthDef.ToString()); expr_07[64] = ", filthDensity="; int arg_6A1_1 = 65; FloatRange?floatRange = this.filthDensity; expr_07[arg_6A1_1] = ((!floatRange.HasValue) ? "null" : this.filthDensity.ToString()); expr_07[66] = ", floorOnlyIfTerrainSupports="; int arg_6DD_1 = 67; bool?flag7 = this.floorOnlyIfTerrainSupports; expr_07[arg_6DD_1] = ((!flag7.HasValue) ? "null" : this.floorOnlyIfTerrainSupports.ToString()); expr_07[68] = ", clearEdificeOnly="; int arg_719_1 = 69; bool?flag8 = this.clearEdificeOnly; expr_07[arg_719_1] = ((!flag8.HasValue) ? "null" : this.clearEdificeOnly.ToString()); expr_07[70] = ", clearFillageOnly="; int arg_755_1 = 71; bool?flag9 = this.clearFillageOnly; expr_07[arg_755_1] = ((!flag9.HasValue) ? "null" : this.clearFillageOnly.ToString()); expr_07[72] = ", clearRoof="; int arg_791_1 = 73; bool?flag10 = this.clearRoof; expr_07[arg_791_1] = ((!flag10.HasValue) ? "null" : this.clearRoof.ToString()); expr_07[74] = ", ancientCryptosleepCasketGroupID="; int arg_7CD_1 = 75; int?num7 = this.ancientCryptosleepCasketGroupID; expr_07[arg_7CD_1] = ((!num7.HasValue) ? "null" : this.ancientCryptosleepCasketGroupID.ToString()); expr_07[76] = ", podContentsType="; int arg_809_1 = 77; PodContentsType?podContentsType = this.podContentsType; expr_07[arg_809_1] = ((!podContentsType.HasValue) ? "null" : this.podContentsType.ToString()); expr_07[78] = ", thingSetMakerDef="; expr_07[79] = ((this.thingSetMakerDef == null) ? "null" : this.thingSetMakerDef.ToString()); expr_07[80] = ", thingSetMakerParams="; int arg_872_1 = 81; ThingSetMakerParams?thingSetMakerParams = this.thingSetMakerParams; expr_07[arg_872_1] = ((!thingSetMakerParams.HasValue) ? "null" : this.thingSetMakerParams.ToString()); expr_07[82] = ", stockpileConcreteContents="; expr_07[83] = ((this.stockpileConcreteContents == null) ? "null" : this.stockpileConcreteContents.Count.ToString()); expr_07[84] = ", stockpileMarketValue="; int arg_8EA_1 = 85; float?num8 = this.stockpileMarketValue; expr_07[arg_8EA_1] = ((!num8.HasValue) ? "null" : this.stockpileMarketValue.ToString()); expr_07[86] = ", innerStockpileSize="; int arg_926_1 = 87; int?num9 = this.innerStockpileSize; expr_07[arg_926_1] = ((!num9.HasValue) ? "null" : this.innerStockpileSize.ToString()); expr_07[88] = ", edgeDefenseWidth="; int arg_962_1 = 89; int?num10 = this.edgeDefenseWidth; expr_07[arg_962_1] = ((!num10.HasValue) ? "null" : this.edgeDefenseWidth.ToString()); expr_07[90] = ", edgeDefenseTurretsCount="; int arg_99E_1 = 91; int?num11 = this.edgeDefenseTurretsCount; expr_07[arg_99E_1] = ((!num11.HasValue) ? "null" : this.edgeDefenseTurretsCount.ToString()); expr_07[92] = ", edgeDefenseMortarsCount="; int arg_9DA_1 = 93; int?num12 = this.edgeDefenseMortarsCount; expr_07[arg_9DA_1] = ((!num12.HasValue) ? "null" : this.edgeDefenseMortarsCount.ToString()); expr_07[94] = ", edgeDefenseGuardsCount="; int arg_A16_1 = 95; int?num13 = this.edgeDefenseGuardsCount; expr_07[arg_A16_1] = ((!num13.HasValue) ? "null" : this.edgeDefenseGuardsCount.ToString()); expr_07[96] = ", mortarDef="; expr_07[97] = ((this.mortarDef == null) ? "null" : this.mortarDef.ToString()); expr_07[98] = ", pathwayFloorDef="; expr_07[99] = ((this.pathwayFloorDef == null) ? "null" : this.pathwayFloorDef.ToString()); expr_07[100] = ", cultivatedPlantDef="; expr_07[101] = ((this.cultivatedPlantDef == null) ? "null" : this.cultivatedPlantDef.ToString()); expr_07[102] = ", fillWithThingsPadding="; int arg_AD9_1 = 103; int?num14 = this.fillWithThingsPadding; expr_07[arg_AD9_1] = ((!num14.HasValue) ? "null" : this.fillWithThingsPadding.ToString()); expr_07[104] = ", settlementPawnGroupPoints="; int arg_B15_1 = 105; float?num15 = this.settlementPawnGroupPoints; expr_07[arg_B15_1] = ((!num15.HasValue) ? "null" : this.settlementPawnGroupPoints.ToString()); expr_07[106] = ", settlementPawnGroupSeed="; int arg_B51_1 = 107; int?num16 = this.settlementPawnGroupSeed; expr_07[arg_B51_1] = ((!num16.HasValue) ? "null" : this.settlementPawnGroupSeed.ToString()); expr_07[108] = ", streetHorizontal="; int arg_B8D_1 = 109; bool?flag11 = this.streetHorizontal; expr_07[arg_B8D_1] = ((!flag11.HasValue) ? "null" : this.streetHorizontal.ToString()); expr_07[110] = ", edgeThingAvoidOtherEdgeThings="; int arg_BC9_1 = 111; bool?flag12 = this.edgeThingAvoidOtherEdgeThings; expr_07[arg_BC9_1] = ((!flag12.HasValue) ? "null" : this.edgeThingAvoidOtherEdgeThings.ToString()); expr_07[112] = ", allowPlacementOffEdge="; int arg_C05_1 = 113; bool?flag13 = this.allowPlacementOffEdge; expr_07[arg_C05_1] = ((!flag13.HasValue) ? "null" : this.allowPlacementOffEdge.ToString()); expr_07[114] = ", thrustAxis="; int arg_C41_1 = 115; Rot4?rot2 = this.thrustAxis; expr_07[arg_C41_1] = ((!rot2.HasValue) ? "null" : this.thrustAxis.ToString()); return(string.Concat(expr_07)); }
public override void Resolve(ResolveParams rp) { if (rp.singleThingToSpawn is Pawn) { ResolveParams resolveParams = rp; resolveParams.singlePawnToSpawn = (Pawn)rp.singleThingToSpawn; BaseGen.symbolStack.Push("pawn", resolveParams); } else if (rp.singleThingToSpawn == null || !rp.singleThingToSpawn.Spawned) { ThingDef thingDef2; if (rp.singleThingToSpawn == null) { ThingDef thingDef; if ((thingDef = rp.singleThingDef) == null) { thingDef = (from x in ThingSetMakerUtility.allGeneratableItems where x.IsWeapon || x.IsMedicine || x.IsDrug select x).RandomElement <ThingDef>(); } thingDef2 = thingDef; } else { thingDef2 = rp.singleThingToSpawn.def; } Rot4? rot = rp.thingRot; IntVec3 loc; if (thingDef2.category == ThingCategory.Item) { rot = new Rot4?(Rot4.North); if (!this.TryFindSpawnCellForItem(rp.rect, out loc)) { if (rp.singleThingToSpawn != null) { rp.singleThingToSpawn.Destroy(DestroyMode.Vanish); } return; } } else { bool flag; bool flag2; loc = this.FindBestSpawnCellForNonItem(rp.rect, thingDef2, ref rot, out flag, out flag2); if ((flag || flag2) && rp.skipSingleThingIfHasToWipeBuildingOrDoesntFit != null && rp.skipSingleThingIfHasToWipeBuildingOrDoesntFit.Value) { return; } } if (rot == null) { Log.Error("Could not resolve rotation. Bug.", false); } Thing thing; if (rp.singleThingToSpawn == null) { ThingDef stuff; if (rp.singleThingStuff != null && rp.singleThingStuff.stuffProps.CanMake(thingDef2)) { stuff = rp.singleThingStuff; } else { stuff = GenStuff.RandomStuffInexpensiveFor(thingDef2, rp.faction); } thing = ThingMaker.MakeThing(thingDef2, stuff); Thing thing2 = thing; int? singleThingStackCount = rp.singleThingStackCount; thing2.stackCount = ((singleThingStackCount == null) ? 1 : singleThingStackCount.Value); if (thing.stackCount <= 0) { thing.stackCount = 1; } if (thing.def.CanHaveFaction && thing.Faction != rp.faction) { thing.SetFaction(rp.faction, null); } CompQuality compQuality = thing.TryGetComp <CompQuality>(); if (compQuality != null) { compQuality.SetQuality(QualityUtility.GenerateQualityBaseGen(), ArtGenerationContext.Outsider); } if (rp.postThingGenerate != null) { rp.postThingGenerate(thing); } } else { thing = rp.singleThingToSpawn; } thing = GenSpawn.Spawn(thing, loc, BaseGen.globalSettings.map, rot.Value, WipeMode.Vanish, false); if (thing != null && thing.def.category == ThingCategory.Item) { thing.SetForbidden(true, false); } if (rp.postThingSpawn != null) { rp.postThingSpawn(thing); } } }