diff --git a/Assembly-CSharp/-PrivateImplementationDetails-.cs b/Assembly-CSharp/-PrivateImplementationDetails-.cs
new file mode 100644
index 000000000..b2bc96008
--- /dev/null
+++ b/Assembly-CSharp/-PrivateImplementationDetails-.cs
@@ -0,0 +1,73 @@
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[CompilerGenerated]
+internal class _003CPrivateImplementationDetails_003E
+{
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 20)]
+ private struct _0024ArrayType_002420
+ {
+ }
+
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 32)]
+ private struct _0024ArrayType_002432
+ {
+ }
+
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 36)]
+ private struct _0024ArrayType_002436
+ {
+ }
+
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 16)]
+ private struct _0024ArrayType_002416
+ {
+ }
+
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 64)]
+ private struct _0024ArrayType_002464
+ {
+ }
+
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 24)]
+ private struct _0024ArrayType_002424
+ {
+ }
+
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 12)]
+ private struct _0024ArrayType_002412
+ {
+ }
+
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 40)]
+ private struct _0024ArrayType_002440
+ {
+ }
+
+ [StructLayout(LayoutKind.Explicit, Pack = 1, Size = 8192)]
+ private struct _0024ArrayType_00248192
+ {
+ }
+
+ internal static _0024ArrayType_002420 _0024_0024field_002D0;
+
+ internal static _0024ArrayType_002432 _0024_0024field_002D1;
+
+ internal static _0024ArrayType_002436 _0024_0024field_002D2;
+
+ internal static _0024ArrayType_002416 _0024_0024field_002D3;
+
+ internal static _0024ArrayType_002464 _0024_0024field_002D4;
+
+ internal static _0024ArrayType_002416 _0024_0024field_002D5;
+
+ internal static _0024ArrayType_002424 _0024_0024field_002D6;
+
+ internal static _0024ArrayType_002412 _0024_0024field_002D7;
+
+ internal static _0024ArrayType_002412 _0024_0024field_002D8;
+
+ internal static _0024ArrayType_002440 _0024_0024field_002D9;
+
+ internal static _0024ArrayType_00248192 _0024_0024field_002D10;
+}
diff --git a/Assembly-CSharp/Assembly-CSharp.csproj b/Assembly-CSharp/Assembly-CSharp.csproj
index 7711680e9..4ad8c958d 100644
--- a/Assembly-CSharp/Assembly-CSharp.csproj
+++ b/Assembly-CSharp/Assembly-CSharp.csproj
@@ -1,13 +1,14 @@
-
+
- {8EF1BBB4-A18A-4B64-B581-3E19C4D7B030}
+ {7E232168-7164-4790-9EA5-47D5BE405A8F}
Debug
AnyCPU
Library
Assembly-CSharp
v2.0
4
+ True
AnyCPU
@@ -25,8 +26,35 @@
true
+
+ D:\Games\SteamLibrary\steamapps\common\RimWorld\RimWorldWin_Data\Managed\UnityEngine.dll
+
+
+ C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll
+
+
+ C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll
+
+
+ C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
+
+
+ D:\Games\SteamLibrary\steamapps\common\RimWorld\RimWorldWin_Data\Managed\Assembly-CSharp-firstpass.dll
+
+
+ C:\Windows\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll
+
+
+ D:\Games\SteamLibrary\steamapps\common\RimWorld\RimWorldWin_Data\Managed\NAudio.dll
+
+
+ D:\Games\SteamLibrary\steamapps\common\RimWorld\RimWorldWin_Data\Managed\NVorbis.dll
+
+
+
+
+
-
@@ -3427,42 +3455,5 @@
-
-
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\Assembly-CSharp-firstpass.dll
-
-
- False
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\Mono.Posix.dll
-
-
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\Mono.Security.dll
-
-
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\NAudio.dll
-
-
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\NVorbis.dll
-
-
-
-
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\System.Core.dll
-
-
-
-
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\System.Xml.Linq.dll
-
-
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\UnityEngine.dll
-
-
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\UnityEngine.Networking.dll
-
-
- D:\Game\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\UnityEngine.UI.dll
-
-
\ No newline at end of file
diff --git a/Assembly-CSharp/NVorbis.NAudioSupport/VorbisWaveReader.cs b/Assembly-CSharp/NVorbis.NAudioSupport/VorbisWaveReader.cs
index 0de7adbd5..a05f36633 100644
--- a/Assembly-CSharp/NVorbis.NAudioSupport/VorbisWaveReader.cs
+++ b/Assembly-CSharp/NVorbis.NAudioSupport/VorbisWaveReader.cs
@@ -37,11 +37,12 @@ public override long Position
}
set
{
- if (value < 0L || value > this.Length)
+ if (value >= 0 && value <= this.Length)
{
- throw new ArgumentOutOfRangeException("value");
+ this._reader.DecodedTime = TimeSpan.FromSeconds((double)value / (double)this._reader.SampleRate / (double)this._reader.Channels / 4.0);
+ return;
}
- this._reader.DecodedTime = TimeSpan.FromSeconds((double)value / (double)this._reader.SampleRate / (double)this._reader.Channels / 4.0);
+ throw new ArgumentOutOfRangeException("value");
}
}
@@ -77,11 +78,11 @@ public int CurrentStream
{
if (!this._reader.SwitchStreams(value))
{
- throw new NVorbis.InvalidDataException("The selected stream is not a valid Vorbis stream!");
+ throw new InvalidDataException("The selected stream is not a valid Vorbis stream!");
}
if (this.NextStreamIndex.HasValue && value == this.NextStreamIndex.Value)
{
- this.NextStreamIndex = null;
+ this.NextStreamIndex = default(int?);
}
}
}
@@ -168,12 +169,7 @@ public override int Read(byte[] buffer, int offset, int count)
{
count /= 4;
count -= count % this._reader.Channels;
- float[] arg_2E_0;
- if ((arg_2E_0 = VorbisWaveReader._conversionBuffer) == null)
- {
- arg_2E_0 = (VorbisWaveReader._conversionBuffer = new float[count]);
- }
- float[] array = arg_2E_0;
+ float[] array = VorbisWaveReader._conversionBuffer ?? (VorbisWaveReader._conversionBuffer = new float[count]);
if (array.Length < count)
{
array = (VorbisWaveReader._conversionBuffer = new float[count]);
diff --git a/Assembly-CSharp/Properties/AssemblyInfo.cs b/Assembly-CSharp/Properties/AssemblyInfo.cs
index 43327acab..23bdafda9 100644
--- a/Assembly-CSharp/Properties/AssemblyInfo.cs
+++ b/Assembly-CSharp/Properties/AssemblyInfo.cs
@@ -1,9 +1,8 @@
-using System;
using System.Reflection;
using System.Runtime.CompilerServices;
-[assembly: AssemblyVersion("0.17.6362.34601")]
-[assembly: AssemblyCompany("Ludeon Studios")]
[assembly: AssemblyCopyright("Copyright Ludeon Studios.")]
[assembly: AssemblyTrademark("RimWorld is a registered trademark of Ludeon Studios.")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
+[assembly: AssemblyCompany("Ludeon Studios")]
+[assembly: AssemblyVersion("0.17.6362.34601")]
diff --git a/Assembly-CSharp/RimWorld.BaseGen/BaseGen.cs b/Assembly-CSharp/RimWorld.BaseGen/BaseGen.cs
index e2f4cae89..e24764476 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/BaseGen.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/BaseGen.cs
@@ -24,7 +24,7 @@ public static void Reset()
List allDefsListForReading = DefDatabase.AllDefsListForReading;
for (int i = 0; i < allDefsListForReading.Count; i++)
{
- List list;
+ List list = default(List);
if (!BaseGen.rulesBySymbol.TryGetValue(allDefsListForReading[i].symbol, out list))
{
list = new List();
@@ -39,65 +39,66 @@ public static void Generate()
if (BaseGen.working)
{
Log.Error("Cannot call Generate() while already generating. Nested calls are not allowed.");
- return;
}
- BaseGen.working = true;
- try
+ else
{
- if (BaseGen.symbolStack.Empty)
+ BaseGen.working = true;
+ try
{
- Log.Warning("Symbol stack is empty.");
- }
- else if (BaseGen.globalSettings.map == null)
- {
- Log.Error("Called BaseGen.Resolve() with null map.");
- }
- else
- {
- int num = BaseGen.symbolStack.Count - 1;
- int num2 = 0;
- while (!BaseGen.symbolStack.Empty)
+ if (BaseGen.symbolStack.Empty)
{
- num2++;
- if (num2 > 100000)
- {
- Log.Error("Error in BaseGen: Too many iterations. Infinite loop?");
- break;
- }
- Pair toResolve = BaseGen.symbolStack.Pop();
- if (BaseGen.symbolStack.Count == num)
- {
- BaseGen.globalSettings.mainRect = toResolve.Second.rect;
- num--;
- }
- try
- {
- BaseGen.Resolve(toResolve);
- }
- catch (Exception ex)
+ Log.Warning("Symbol stack is empty.");
+ }
+ else if (BaseGen.globalSettings.map == null)
+ {
+ Log.Error("Called BaseGen.Resolve() with null map.");
+ }
+ else
+ {
+ int num = BaseGen.symbolStack.Count - 1;
+ int num2 = 0;
+ while (true)
{
- Log.Error(string.Concat(new object[]
+ if (!BaseGen.symbolStack.Empty)
{
- "Error while resolving symbol \"",
- toResolve.First,
- "\" with params=",
- toResolve.Second,
- "\n\nException: ",
- ex
- }));
+ num2++;
+ if (num2 <= 100000)
+ {
+ Pair toResolve = BaseGen.symbolStack.Pop();
+ if (BaseGen.symbolStack.Count == num)
+ {
+ GlobalSettings obj = BaseGen.globalSettings;
+ ResolveParams second = toResolve.Second;
+ obj.mainRect = second.rect;
+ num--;
+ }
+ try
+ {
+ BaseGen.Resolve(toResolve);
+ }
+ catch (Exception ex)
+ {
+ Log.Error("Error while resolving symbol \"" + toResolve.First + "\" with params=" + toResolve.Second + "\n\nException: " + ex);
+ }
+ continue;
+ }
+ break;
+ }
+ return;
}
+ Log.Error("Error in BaseGen: Too many iterations. Infinite loop?");
}
}
- }
- catch (Exception arg)
- {
- Log.Error("Error in BaseGen: " + arg);
- }
- finally
- {
- BaseGen.working = false;
- BaseGen.symbolStack.Clear();
- BaseGen.globalSettings.Clear();
+ catch (Exception arg)
+ {
+ Log.Error("Error in BaseGen: " + arg);
+ }
+ finally
+ {
+ BaseGen.working = false;
+ BaseGen.symbolStack.Clear();
+ BaseGen.globalSettings.Clear();
+ }
}
}
@@ -106,7 +107,7 @@ private static void Resolve(Pair toResolve)
string first = toResolve.First;
ResolveParams second = toResolve.Second;
BaseGen.tmpResolvers.Clear();
- List list;
+ List list = default(List);
if (BaseGen.rulesBySymbol.TryGetValue(first, out list))
{
for (int i = 0; i < list.Count; i++)
@@ -122,19 +123,15 @@ private static void Resolve(Pair toResolve)
}
}
}
- if (!BaseGen.tmpResolvers.Any())
+ if (!BaseGen.tmpResolvers.Any())
{
- Log.Warning(string.Concat(new object[]
- {
- "Could not find any RuleDef for symbol \"",
- first,
- "\" with any resolver that could resolve ",
- second
- }));
- return;
+ Log.Warning("Could not find any RuleDef for symbol \"" + first + "\" with any resolver that could resolve " + second);
+ }
+ else
+ {
+ SymbolResolver symbolResolver2 = BaseGen.tmpResolvers.RandomElementByWeight((Func)((SymbolResolver x) => x.selectionWeight));
+ symbolResolver2.Resolve(second);
}
- SymbolResolver symbolResolver2 = BaseGen.tmpResolvers.RandomElementByWeight((SymbolResolver x) => x.selectionWeight);
- symbolResolver2.Resolve(second);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/BaseGenUtility.cs b/Assembly-CSharp/RimWorld.BaseGen/BaseGenUtility.cs
index a00fdfaa7..ef2cf3dba 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/BaseGenUtility.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/BaseGenUtility.cs
@@ -20,13 +20,13 @@ public static ThingDef RandomCheapWallStuff(TechLevel techLevel, bool notVeryFla
return ThingDefOf.WoodLog;
}
return (from d in DefDatabase.AllDefsListForReading
- where BaseGenUtility.IsCheapWallStuff(d) && (!notVeryFlammable || d.BaseFlammability < 0.5f)
- select d).RandomElement();
+ where BaseGenUtility.IsCheapWallStuff(d) && (!notVeryFlammable || d.BaseFlammability < 0.5)
+ select d).RandomElement();
}
public static bool IsCheapWallStuff(ThingDef d)
{
- return d.IsStuff && d.stuffProps.CanMake(ThingDefOf.Wall) && d.BaseMarketValue / d.VolumePerUnit < 5f;
+ return d.IsStuff && d.stuffProps.CanMake(ThingDefOf.Wall) && d.BaseMarketValue / d.VolumePerUnit < 5.0;
}
public static TerrainDef RandomBasicFloorDef(Faction faction, bool allowCarpet = false)
@@ -35,9 +35,9 @@ public static TerrainDef RandomBasicFloorDef(Faction faction, bool allowCarpet =
{
return (from x in DefDatabase.AllDefsListForReading
where x.IsCarpet
- select x).RandomElement();
+ select x).RandomElement();
}
- return Rand.Element(TerrainDefOf.MetalTile, TerrainDefOf.PavedTile, TerrainDefOf.WoodPlankFloor, TerrainDefOf.TileSandstone);
+ return Rand.Element(TerrainDefOf.MetalTile, TerrainDefOf.PavedTile, TerrainDefOf.WoodPlankFloor, TerrainDefOf.TileSandstone);
}
public static TerrainDef CorrespondingTerrainDef(ThingDef stuffDef, bool beautiful)
@@ -87,14 +87,11 @@ public static bool AnyDoorCardinalAdjacentTo(IntVec3 cell, Map map)
public static bool AnyDoorCardinalAdjacentTo(CellRect rect, Map map)
{
- foreach (IntVec3 current in rect.ExpandedBy(1).EdgeCells)
+ foreach (IntVec3 edgeCell in rect.ExpandedBy(1).EdgeCells)
{
- if (!rect.IsCorner(current) && current.InBounds(map))
+ if (!rect.IsCorner(edgeCell) && edgeCell.InBounds(map) && edgeCell.GetDoor(map) != null)
{
- if (current.GetDoor(map) != null)
- {
- return true;
- }
+ return true;
}
}
return false;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/GlobalSettings.cs b/Assembly-CSharp/RimWorld.BaseGen/GlobalSettings.cs
index 557cf0ade..89171c6e5 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/GlobalSettings.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/GlobalSettings.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/ResolveParams.cs b/Assembly-CSharp/RimWorld.BaseGen/ResolveParams.cs
index 8f2d201ea..df3649a18 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/ResolveParams.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/ResolveParams.cs
@@ -103,11 +103,11 @@ public void SetCustom(string name, T obj, bool inherit = false)
}
else
{
- this.custom = new Dictionary(this.custom);
+ this.custom = new Dictionary((IDictionary)this.custom);
}
if (!this.custom.ContainsKey(name))
{
- this.custom.Add(name, obj);
+ this.custom.Add(name, (object)obj);
}
else if (!inherit)
{
@@ -117,176 +117,234 @@ public void SetCustom(string name, T obj, bool inherit = false)
public void RemoveCustom(string name)
{
- if (this.custom == null)
+ if (this.custom != null)
{
- return;
+ this.custom = new Dictionary(this.custom);
+ this.custom.Remove(name);
}
- this.custom = new Dictionary(this.custom);
- this.custom.Remove(name);
}
public bool TryGetCustom(string name, out T obj)
{
- object obj2;
- if (this.custom == null || !this.custom.TryGetValue(name, out obj2))
+ object obj2 = default(object);
+ if (this.custom != null && this.custom.TryGetValue(name, out obj2))
{
- obj = default(T);
- return false;
+ obj = (T)obj2;
+ return true;
}
- obj = (T)((object)obj2);
- return true;
+ obj = default(T);
+ return false;
}
public T GetCustom(string name)
{
- object obj;
- if (this.custom == null || !this.custom.TryGetValue(name, out obj))
+ object obj = default(object);
+ if (this.custom != null && this.custom.TryGetValue(name, out obj))
{
- return default(T);
+ return (T)obj;
}
- return (T)((object)obj);
+ return default(T);
}
public override string ToString()
{
- object[] expr_07 = new object[88];
- 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_AD_1 = 7;
- int? num = this.ancientTempleEntranceHeight;
- expr_07[arg_AD_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_168_1 = 15;
- bool? flag = this.noRoof;
- expr_07[arg_168_1] = ((!flag.HasValue) ? "null" : this.noRoof.ToString());
- expr_07[16] = ", addRoomCenterToRootsToUnfog=";
- int arg_19D_1 = 17;
- bool? flag2 = this.addRoomCenterToRootsToUnfog;
- expr_07[arg_19D_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_25A_1 = 25;
- int? num2 = this.singleThingStackCount;
- expr_07[arg_25A_1] = ((!num2.HasValue) ? "null" : this.singleThingStackCount.ToString());
- expr_07[26] = ", singlePawnToSpawn=";
- expr_07[27] = ((this.singlePawnToSpawn == null) ? "null" : this.singlePawnToSpawn.ToString());
- expr_07[28] = ", singlePawnKindDef=";
- expr_07[29] = ((this.singlePawnKindDef == null) ? "null" : this.singlePawnKindDef.ToString());
- expr_07[30] = ", disableSinglePawn=";
- int arg_2EA_1 = 31;
- bool? flag3 = this.disableSinglePawn;
- expr_07[arg_2EA_1] = ((!flag3.HasValue) ? "null" : this.disableSinglePawn.ToString());
- expr_07[32] = ", singlePawnLord=";
- expr_07[33] = ((this.singlePawnLord == null) ? "null" : this.singlePawnLord.ToString());
- expr_07[34] = ", singlePawnSpawnCellExtraPredicate=";
- expr_07[35] = ((this.singlePawnSpawnCellExtraPredicate == null) ? "null" : this.singlePawnSpawnCellExtraPredicate.ToString());
- expr_07[36] = ", singlePawnGenerationRequest=";
- int arg_37A_1 = 37;
- PawnGenerationRequest? pawnGenerationRequest = this.singlePawnGenerationRequest;
- expr_07[arg_37A_1] = ((!pawnGenerationRequest.HasValue) ? "null" : this.singlePawnGenerationRequest.ToString());
- expr_07[38] = ", mechanoidsCount=";
- int arg_3B0_1 = 39;
- int? num3 = this.mechanoidsCount;
- expr_07[arg_3B0_1] = ((!num3.HasValue) ? "null" : this.mechanoidsCount.ToString());
- expr_07[40] = ", hivesCount=";
- int arg_3E6_1 = 41;
- int? num4 = this.hivesCount;
- expr_07[arg_3E6_1] = ((!num4.HasValue) ? "null" : this.hivesCount.ToString());
- expr_07[42] = ", disableHives=";
- int arg_41C_1 = 43;
- bool? flag4 = this.disableHives;
- expr_07[arg_41C_1] = ((!flag4.HasValue) ? "null" : this.disableHives.ToString());
- expr_07[44] = ", thingRot=";
- int arg_452_1 = 45;
- Rot4? rot = this.thingRot;
- expr_07[arg_452_1] = ((!rot.HasValue) ? "null" : this.thingRot.ToString());
- expr_07[46] = ", wallStuff=";
- expr_07[47] = ((this.wallStuff == null) ? "null" : this.wallStuff.ToString());
- expr_07[48] = ", chanceToSkipWallBlock=";
- int arg_4B5_1 = 49;
- float? num5 = this.chanceToSkipWallBlock;
- expr_07[arg_4B5_1] = ((!num5.HasValue) ? "null" : this.chanceToSkipWallBlock.ToString());
- expr_07[50] = ", floorDef=";
- expr_07[51] = ((this.floorDef == null) ? "null" : this.floorDef.ToString());
- expr_07[52] = ", clearEdificeOnly=";
- int arg_518_1 = 53;
- bool? flag5 = this.clearEdificeOnly;
- expr_07[arg_518_1] = ((!flag5.HasValue) ? "null" : this.clearEdificeOnly.ToString());
- expr_07[54] = ", ancientCryptosleepCasketGroupID=";
- int arg_54E_1 = 55;
- int? num6 = this.ancientCryptosleepCasketGroupID;
- expr_07[arg_54E_1] = ((!num6.HasValue) ? "null" : this.ancientCryptosleepCasketGroupID.ToString());
- expr_07[56] = ", podContentsType=";
- int arg_584_1 = 57;
- PodContentsType? podContentsType = this.podContentsType;
- expr_07[arg_584_1] = ((!podContentsType.HasValue) ? "null" : this.podContentsType.ToString());
- expr_07[58] = ", itemCollectionGeneratorDef=";
- expr_07[59] = ((this.itemCollectionGeneratorDef == null) ? "null" : this.itemCollectionGeneratorDef.ToString());
- expr_07[60] = ", itemCollectionGeneratorParams=";
- int arg_5E7_1 = 61;
- ItemCollectionGeneratorParams? itemCollectionGeneratorParams = this.itemCollectionGeneratorParams;
- expr_07[arg_5E7_1] = ((!itemCollectionGeneratorParams.HasValue) ? "null" : this.itemCollectionGeneratorParams.ToString());
- expr_07[62] = ", stockpileConcreteContents=";
- expr_07[63] = ((this.stockpileConcreteContents == null) ? "null" : this.stockpileConcreteContents.Count.ToString());
- expr_07[64] = ", stockpileMarketValue=";
- int arg_653_1 = 65;
- float? num7 = this.stockpileMarketValue;
- expr_07[arg_653_1] = ((!num7.HasValue) ? "null" : this.stockpileMarketValue.ToString());
- expr_07[66] = ", edgeDefenseWidth=";
- int arg_689_1 = 67;
- int? num8 = this.edgeDefenseWidth;
- expr_07[arg_689_1] = ((!num8.HasValue) ? "null" : this.edgeDefenseWidth.ToString());
- expr_07[68] = ", edgeDefenseTurretsCount=";
- int arg_6BF_1 = 69;
- int? num9 = this.edgeDefenseTurretsCount;
- expr_07[arg_6BF_1] = ((!num9.HasValue) ? "null" : this.edgeDefenseTurretsCount.ToString());
- expr_07[70] = ", edgeDefenseMortarsCount=";
- int arg_6F5_1 = 71;
- int? num10 = this.edgeDefenseMortarsCount;
- expr_07[arg_6F5_1] = ((!num10.HasValue) ? "null" : this.edgeDefenseMortarsCount.ToString());
- expr_07[72] = ", edgeDefenseGuardsCount=";
- int arg_72B_1 = 73;
- int? num11 = this.edgeDefenseGuardsCount;
- expr_07[arg_72B_1] = ((!num11.HasValue) ? "null" : this.edgeDefenseGuardsCount.ToString());
- expr_07[74] = ", mortarDef=";
- expr_07[75] = ((this.mortarDef == null) ? "null" : this.mortarDef.ToString());
- expr_07[76] = ", pathwayFloorDef=";
- expr_07[77] = ((this.pathwayFloorDef == null) ? "null" : this.pathwayFloorDef.ToString());
- expr_07[78] = ", cultivatedPlantDef=";
- expr_07[79] = ((this.cultivatedPlantDef == null) ? "null" : this.cultivatedPlantDef.ToString());
- expr_07[80] = ", fillWithThingsPadding=";
- int arg_7E8_1 = 81;
- int? num12 = this.fillWithThingsPadding;
- expr_07[arg_7E8_1] = ((!num12.HasValue) ? "null" : this.fillWithThingsPadding.ToString());
- expr_07[82] = ", factionBasePawnGroupPointsFactor=";
- int arg_81E_1 = 83;
- float? num13 = this.factionBasePawnGroupPointsFactor;
- expr_07[arg_81E_1] = ((!num13.HasValue) ? "null" : this.factionBasePawnGroupPointsFactor.ToString());
- expr_07[84] = ", streetHorizontal=";
- int arg_854_1 = 85;
- bool? flag6 = this.streetHorizontal;
- expr_07[arg_854_1] = ((!flag6.HasValue) ? "null" : this.streetHorizontal.ToString());
- expr_07[86] = ", edgeThingAvoidOtherEdgeThings=";
- int arg_88A_1 = 87;
- bool? flag7 = this.edgeThingAvoidOtherEdgeThings;
- expr_07[arg_88A_1] = ((!flag7.HasValue) ? "null" : this.edgeThingAvoidOtherEdgeThings.ToString());
- return string.Concat(expr_07);
+ object[] obj = new object[88]
+ {
+ "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
+ };
+ 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] = ", singlePawnToSpawn=";
+ obj[27] = ((this.singlePawnToSpawn == null) ? "null" : this.singlePawnToSpawn.ToString());
+ obj[28] = ", singlePawnKindDef=";
+ obj[29] = ((this.singlePawnKindDef == null) ? "null" : this.singlePawnKindDef.ToString());
+ obj[30] = ", disableSinglePawn=";
+ bool? nullable5 = this.disableSinglePawn;
+ obj[31] = ((!nullable5.HasValue) ? "null" : this.disableSinglePawn.ToString());
+ obj[32] = ", singlePawnLord=";
+ obj[33] = ((this.singlePawnLord == null) ? "null" : this.singlePawnLord.ToString());
+ obj[34] = ", singlePawnSpawnCellExtraPredicate=";
+ obj[35] = (((object)this.singlePawnSpawnCellExtraPredicate == null) ? "null" : this.singlePawnSpawnCellExtraPredicate.ToString());
+ obj[36] = ", singlePawnGenerationRequest=";
+ PawnGenerationRequest? nullable6 = this.singlePawnGenerationRequest;
+ obj[37] = ((!nullable6.HasValue) ? "null" : this.singlePawnGenerationRequest.ToString());
+ obj[38] = ", mechanoidsCount=";
+ int? nullable7 = this.mechanoidsCount;
+ obj[39] = ((!nullable7.HasValue) ? "null" : this.mechanoidsCount.ToString());
+ obj[40] = ", hivesCount=";
+ int? nullable8 = this.hivesCount;
+ obj[41] = ((!nullable8.HasValue) ? "null" : this.hivesCount.ToString());
+ obj[42] = ", disableHives=";
+ bool? nullable9 = this.disableHives;
+ obj[43] = ((!nullable9.HasValue) ? "null" : this.disableHives.ToString());
+ obj[44] = ", thingRot=";
+ Rot4? nullable10 = this.thingRot;
+ obj[45] = ((!nullable10.HasValue) ? "null" : this.thingRot.ToString());
+ obj[46] = ", wallStuff=";
+ obj[47] = ((this.wallStuff == null) ? "null" : this.wallStuff.ToString());
+ obj[48] = ", chanceToSkipWallBlock=";
+ float? nullable11 = this.chanceToSkipWallBlock;
+ obj[49] = ((!nullable11.HasValue) ? "null" : this.chanceToSkipWallBlock.ToString());
+ obj[50] = ", floorDef=";
+ obj[51] = ((this.floorDef == null) ? "null" : this.floorDef.ToString());
+ obj[52] = ", clearEdificeOnly=";
+ bool? nullable12 = this.clearEdificeOnly;
+ obj[53] = ((!nullable12.HasValue) ? "null" : this.clearEdificeOnly.ToString());
+ obj[54] = ", ancientCryptosleepCasketGroupID=";
+ int? nullable13 = this.ancientCryptosleepCasketGroupID;
+ obj[55] = ((!nullable13.HasValue) ? "null" : this.ancientCryptosleepCasketGroupID.ToString());
+ obj[56] = ", podContentsType=";
+ PodContentsType? nullable14 = this.podContentsType;
+ obj[57] = ((!nullable14.HasValue) ? "null" : this.podContentsType.ToString());
+ obj[58] = ", itemCollectionGeneratorDef=";
+ obj[59] = ((this.itemCollectionGeneratorDef == null) ? "null" : this.itemCollectionGeneratorDef.ToString());
+ obj[60] = ", itemCollectionGeneratorParams=";
+ ItemCollectionGeneratorParams? nullable15 = this.itemCollectionGeneratorParams;
+ obj[61] = ((!nullable15.HasValue) ? "null" : this.itemCollectionGeneratorParams.ToString());
+ obj[62] = ", stockpileConcreteContents=";
+ obj[63] = ((this.stockpileConcreteContents == null) ? "null" : this.stockpileConcreteContents.Count.ToString());
+ obj[64] = ", stockpileMarketValue=";
+ float? nullable16 = this.stockpileMarketValue;
+ obj[65] = ((!nullable16.HasValue) ? "null" : this.stockpileMarketValue.ToString());
+ obj[66] = ", edgeDefenseWidth=";
+ int? nullable17 = this.edgeDefenseWidth;
+ obj[67] = ((!nullable17.HasValue) ? "null" : this.edgeDefenseWidth.ToString());
+ obj[68] = ", edgeDefenseTurretsCount=";
+ int? nullable18 = this.edgeDefenseTurretsCount;
+ obj[69] = ((!nullable18.HasValue) ? "null" : this.edgeDefenseTurretsCount.ToString());
+ obj[70] = ", edgeDefenseMortarsCount=";
+ int? nullable19 = this.edgeDefenseMortarsCount;
+ obj[71] = ((!nullable19.HasValue) ? "null" : this.edgeDefenseMortarsCount.ToString());
+ obj[72] = ", edgeDefenseGuardsCount=";
+ int? nullable20 = this.edgeDefenseGuardsCount;
+ obj[73] = ((!nullable20.HasValue) ? "null" : this.edgeDefenseGuardsCount.ToString());
+ obj[74] = ", mortarDef=";
+ obj[75] = ((this.mortarDef == null) ? "null" : this.mortarDef.ToString());
+ obj[76] = ", pathwayFloorDef=";
+ obj[77] = ((this.pathwayFloorDef == null) ? "null" : this.pathwayFloorDef.ToString());
+ obj[78] = ", cultivatedPlantDef=";
+ obj[79] = ((this.cultivatedPlantDef == null) ? "null" : this.cultivatedPlantDef.ToString());
+ obj[80] = ", fillWithThingsPadding=";
+ int? nullable21 = this.fillWithThingsPadding;
+ obj[81] = ((!nullable21.HasValue) ? "null" : this.fillWithThingsPadding.ToString());
+ obj[82] = ", factionBasePawnGroupPointsFactor=";
+ float? nullable22 = this.factionBasePawnGroupPointsFactor;
+ obj[83] = ((!nullable22.HasValue) ? "null" : this.factionBasePawnGroupPointsFactor.ToString());
+ obj[84] = ", streetHorizontal=";
+ bool? nullable23 = this.streetHorizontal;
+ obj[85] = ((!nullable23.HasValue) ? "null" : this.streetHorizontal.ToString());
+ obj[86] = ", edgeThingAvoidOtherEdgeThings=";
+ bool? nullable24 = this.edgeThingAvoidOtherEdgeThings;
+ obj[87] = ((!nullable24.HasValue) ? "null" : this.edgeThingAvoidOtherEdgeThings.ToString());
+ return string.Concat(obj);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver.cs
index 4a2551085..23bd59258 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AddWortToFermentingBarrels.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AddWortToFermentingBarrels.cs
index 1aa0c83e2..d9c11905f 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AddWortToFermentingBarrels.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AddWortToFermentingBarrels.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using UnityEngine;
using Verse;
@@ -32,11 +31,11 @@ public override void Resolve(ResolveParams rp)
{
if (!SymbolResolver_AddWortToFermentingBarrels.barrels[j].Fermented)
{
- int num = Rand.RangeInclusive(1, 25);
- num = Mathf.Min(num, SymbolResolver_AddWortToFermentingBarrels.barrels[j].SpaceLeftForWort);
- if (num > 0)
+ int a = Rand.RangeInclusive(1, 25);
+ a = Mathf.Min(a, SymbolResolver_AddWortToFermentingBarrels.barrels[j].SpaceLeftForWort);
+ if (a > 0)
{
- SymbolResolver_AddWortToFermentingBarrels.barrels[j].AddWort(num);
+ SymbolResolver_AddWortToFermentingBarrels.barrels[j].AddWort(a);
SymbolResolver_AddWortToFermentingBarrels.barrels[j].Progress = progress;
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientCryptosleepCasket.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientCryptosleepCasket.cs
index 018f1e5ab..907542eb5 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientCryptosleepCasket.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientCryptosleepCasket.cs
@@ -1,5 +1,4 @@
using RimWorld.Planet;
-using System;
using System.Collections.Generic;
using Verse;
@@ -17,8 +16,10 @@ public override void Resolve(ResolveParams rp)
Rot4 rot = (!thingRot.HasValue) ? Rot4.North : thingRot.Value;
Building_AncientCryptosleepCasket building_AncientCryptosleepCasket = (Building_AncientCryptosleepCasket)ThingMaker.MakeThing(ThingDefOf.AncientCryptosleepCasket, null);
building_AncientCryptosleepCasket.groupID = groupID;
- ItemCollectionGeneratorParams parms = default(ItemCollectionGeneratorParams);
- parms.podContentsType = podContentsType2;
+ ItemCollectionGeneratorParams parms = new ItemCollectionGeneratorParams
+ {
+ podContentsType = podContentsType2
+ };
List list = ItemCollectionGeneratorDefOf.AncientPodContents.Worker.Generate(parms);
for (int i = 0; i < list.Count; i++)
{
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientRuins.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientRuins.cs
index c698dd642..9ed188044 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientRuins.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientRuins.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_AncientRuins : SymbolResolver
@@ -9,7 +7,7 @@ public override void Resolve(ResolveParams rp)
ResolveParams resolveParams = rp;
resolveParams.wallStuff = (rp.wallStuff ?? BaseGenUtility.RandomCheapWallStuff(rp.faction, true));
float? chanceToSkipWallBlock = rp.chanceToSkipWallBlock;
- resolveParams.chanceToSkipWallBlock = new float?((!chanceToSkipWallBlock.HasValue) ? 0.1f : chanceToSkipWallBlock.Value);
+ resolveParams.chanceToSkipWallBlock = new float?((float)((!chanceToSkipWallBlock.HasValue) ? 0.10000000149011612 : chanceToSkipWallBlock.Value));
bool? clearEdificeOnly = rp.clearEdificeOnly;
resolveParams.clearEdificeOnly = new bool?(!clearEdificeOnly.HasValue || clearEdificeOnly.Value);
bool? noRoof = rp.noRoof;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientShrine.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientShrine.cs
index c5a2b4823..e5a2cd0b9 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientShrine.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientShrine.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
@@ -11,15 +10,18 @@ public override void Resolve(ResolveParams rp)
IntVec3 bottomLeft = rp.rect.BottomLeft;
Map map = BaseGen.globalSettings.map;
CellRect rect = new CellRect(bottomLeft.x + rp.rect.Width / 2 - 1, bottomLeft.z + rp.rect.Height / 2, 2, 1);
- foreach (IntVec3 current in rect)
+ foreach (IntVec3 item in rect)
{
- List thingList = current.GetThingList(map);
- for (int i = 0; i < thingList.Count; i++)
+ List thingList = item.GetThingList(map);
+ int num = 0;
+ while (num < thingList.Count)
{
- if (!thingList[i].def.destroyable)
+ if (thingList[num].def.destroyable)
{
- return;
+ num++;
+ continue;
}
+ return;
}
}
ResolveParams resolveParams = rp;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientShrinesGroup.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientShrinesGroup.cs
index ab01282d9..93616cd20 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientShrinesGroup.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientShrinesGroup.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
@@ -15,40 +14,44 @@ public class SymbolResolver_AncientShrinesGroup : SymbolResolver
public override void Resolve(ResolveParams rp)
{
- int num = (rp.rect.Width + 1) / (SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize.x + 1);
- int num2 = (rp.rect.Height + 1) / (SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize.z + 1);
+ int num = rp.rect.Width + 1;
+ IntVec2 standardAncientShrineSize = SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize;
+ int num2 = num / (standardAncientShrineSize.x + 1);
+ int num3 = rp.rect.Height + 1;
+ IntVec2 standardAncientShrineSize2 = SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize;
+ int num4 = num3 / (standardAncientShrineSize2.z + 1);
IntVec3 bottomLeft = rp.rect.BottomLeft;
PodContentsType? podContentsType = rp.podContentsType;
if (!podContentsType.HasValue)
{
float value = Rand.Value;
- if (value < 0.5f)
- {
- podContentsType = null;
- }
- else if (value < 0.7f)
- {
- podContentsType = new PodContentsType?(PodContentsType.Slave);
- }
- else
- {
- podContentsType = new PodContentsType?(PodContentsType.SpacerHostile);
- }
+ podContentsType = ((!(value < 0.5)) ? ((!(value < 0.699999988079071)) ? new PodContentsType?(PodContentsType.SpacerHostile) : new PodContentsType?(PodContentsType.Slave)) : default(PodContentsType?));
}
int? ancientCryptosleepCasketGroupID = rp.ancientCryptosleepCasketGroupID;
int value2 = (!ancientCryptosleepCasketGroupID.HasValue) ? Find.UniqueIDsManager.GetNextAncientCryptosleepCasketGroupID() : ancientCryptosleepCasketGroupID.Value;
- int num3 = 0;
- for (int i = 0; i < num2; i++)
+ int num5 = 0;
+ for (int num6 = 0; num6 < num4; num6++)
{
- for (int j = 0; j < num; j++)
+ for (int num7 = 0; num7 < num2; num7++)
{
if (!Rand.Chance(0.25f))
{
- if (num3 >= 6)
+ if (num5 >= 6)
{
break;
}
- CellRect rect = new CellRect(bottomLeft.x + j * (SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize.x + 1), bottomLeft.z + i * (SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize.z + 1), SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize.x, SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize.z);
+ int x = bottomLeft.x;
+ int num8 = num7;
+ IntVec2 standardAncientShrineSize3 = SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize;
+ int minX = x + num8 * (standardAncientShrineSize3.x + 1);
+ int z = bottomLeft.z;
+ int num9 = num6;
+ IntVec2 standardAncientShrineSize4 = SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize;
+ int minZ = z + num9 * (standardAncientShrineSize4.z + 1);
+ IntVec2 standardAncientShrineSize5 = SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize;
+ int x2 = standardAncientShrineSize5.x;
+ IntVec2 standardAncientShrineSize6 = SymbolResolver_AncientShrinesGroup.StandardAncientShrineSize;
+ CellRect rect = new CellRect(minX, minZ, x2, standardAncientShrineSize6.z);
if (rect.FullyContainedWithin(rp.rect))
{
ResolveParams resolveParams = rp;
@@ -56,7 +59,7 @@ public override void Resolve(ResolveParams rp)
resolveParams.ancientCryptosleepCasketGroupID = new int?(value2);
resolveParams.podContentsType = podContentsType;
BaseGen.symbolStack.Push("ancientShrine", resolveParams);
- num3++;
+ num5++;
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientTemple.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientTemple.cs
index 1d0df32f4..252e3e16a 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientTemple.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_AncientTemple.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_AncientTemple : SymbolResolver
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Barracks.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Barracks.cs
index 16414dea4..60561309c 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Barracks.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Barracks.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_Barracks : SymbolResolver
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors.cs
index 69019010e..7a54bb030 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
@@ -7,8 +6,7 @@ public class SymbolResolver_BasePart_Indoors : SymbolResolver
{
public override void Resolve(ResolveParams rp)
{
- bool flag = rp.rect.Width > 13 || rp.rect.Height > 13 || ((rp.rect.Width >= 9 || rp.rect.Height >= 9) && Rand.Chance(0.3f));
- if (flag)
+ if (rp.rect.Width > 13 || rp.rect.Height > 13 || ((rp.rect.Width >= 9 || rp.rect.Height >= 9) && Rand.Chance(0.3f)))
{
BaseGen.symbolStack.Push("basePart_indoors_division", rp);
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Division_Split.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Division_Split.cs
index ea421f311..5b5cd81a2 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Division_Split.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Division_Split.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
@@ -19,10 +18,8 @@ public override void Resolve(ResolveParams rp)
if (rp.rect.Width < 9 && rp.rect.Height < 9)
{
Log.Warning("Too small rect. params=" + rp);
- return;
}
- bool flag = (Rand.Bool && rp.rect.Height >= 9) || rp.rect.Width < 9;
- if (flag)
+ else if ((Rand.Bool && rp.rect.Height >= 9) || rp.rect.Width < 9)
{
int num = Rand.RangeInclusive(4, rp.rect.Height - 5);
ResolveParams resolveParams = rp;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Barracks.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Barracks.cs
index 84bd48083..ee6fe2cf8 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Barracks.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Barracks.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BasePart_Indoors_Leaf_Barracks : SymbolResolver
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_BatteryRoom.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_BatteryRoom.cs
index cd3b411e9..859eb7cfd 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_BatteryRoom.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_BatteryRoom.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BasePart_Indoors_Leaf_BatteryRoom : SymbolResolver
@@ -8,7 +6,19 @@ public class SymbolResolver_BasePart_Indoors_Leaf_BatteryRoom : SymbolResolver
public override bool CanResolve(ResolveParams rp)
{
- return base.CanResolve(rp) && BaseGen.globalSettings.basePart_barracksResolved >= BaseGen.globalSettings.minBarracks && BaseGen.globalSettings.basePart_batteriesCoverage + (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area < 0.06f && (rp.faction == null || rp.faction.def.techLevel >= TechLevel.Industrial);
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_barracksResolved < BaseGen.globalSettings.minBarracks)
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_batteriesCoverage + (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area >= 0.059999998658895493)
+ {
+ return false;
+ }
+ return rp.faction == null || (int)rp.faction.def.techLevel >= 4;
}
public override void Resolve(ResolveParams rp)
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Brewery.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Brewery.cs
index 9e8df4078..700192be2 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Brewery.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Brewery.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BasePart_Indoors_Leaf_Brewery : SymbolResolver
@@ -8,7 +6,19 @@ public class SymbolResolver_BasePart_Indoors_Leaf_Brewery : SymbolResolver
public override bool CanResolve(ResolveParams rp)
{
- return base.CanResolve(rp) && BaseGen.globalSettings.basePart_barracksResolved >= BaseGen.globalSettings.minBarracks && BaseGen.globalSettings.basePart_breweriesCoverage + (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area < 0.08f && (rp.faction == null || rp.faction.def.techLevel >= TechLevel.Medieval);
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_barracksResolved < BaseGen.globalSettings.minBarracks)
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_breweriesCoverage + (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area >= 0.079999998211860657)
+ {
+ return false;
+ }
+ return rp.faction == null || (int)rp.faction.def.techLevel >= 3;
}
public override void Resolve(ResolveParams rp)
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_DiningRoom.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_DiningRoom.cs
index 1efb88d3e..523ed6704 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_DiningRoom.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_DiningRoom.cs
@@ -1,12 +1,18 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BasePart_Indoors_Leaf_DiningRoom : SymbolResolver
{
public override bool CanResolve(ResolveParams rp)
{
- return base.CanResolve(rp) && BaseGen.globalSettings.basePart_barracksResolved >= BaseGen.globalSettings.minBarracks;
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_barracksResolved < BaseGen.globalSettings.minBarracks)
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Storage.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Storage.cs
index b4f2bcdc2..06e5d6309 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Storage.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Indoors_Leaf_Storage.cs
@@ -1,12 +1,18 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BasePart_Indoors_Leaf_Storage : SymbolResolver
{
public override bool CanResolve(ResolveParams rp)
{
- return base.CanResolve(rp) && BaseGen.globalSettings.basePart_barracksResolved >= BaseGen.globalSettings.minBarracks;
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_barracksResolved < BaseGen.globalSettings.minBarracks)
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors.cs
index 8922bedce..9e02a4bef 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Division_Grid.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Division_Grid.cs
index 6ecb85def..5f8af6116 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Division_Grid.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Division_Grid.cs
@@ -36,7 +36,7 @@ private class Child
private List> optionsZ = new List>();
- private List children = new List();
+ private List children = new List();
private static List, Pair>> options = new List, Pair>>();
@@ -51,53 +51,29 @@ public override bool CanResolve(ResolveParams rp)
return false;
}
this.FillOptions(rp.rect);
- return this.optionsX.Any>() && this.optionsZ.Any>();
+ return this.optionsX.Any() && this.optionsZ.Any();
}
public override void Resolve(ResolveParams rp)
{
this.FillOptions(rp.rect);
- if (!Rand.Chance(0.2f))
+ if ((Rand.Chance(0.2f) || (!this.TryResolveRandomOption(0, 0, rp) && !this.TryResolveRandomOption(0, 1, rp))) && !this.TryResolveRandomOption(1, 0, rp) && !this.TryResolveRandomOption(2, 0, rp) && !this.TryResolveRandomOption(2, 1, rp) && !this.TryResolveRandomOption(999999, 999999, rp))
{
- if (this.TryResolveRandomOption(0, 0, rp))
- {
- return;
- }
- if (this.TryResolveRandomOption(0, 1, rp))
- {
- return;
- }
- }
- if (this.TryResolveRandomOption(1, 0, rp))
- {
- return;
- }
- if (this.TryResolveRandomOption(2, 0, rp))
- {
- return;
- }
- if (this.TryResolveRandomOption(2, 1, rp))
- {
- return;
- }
- if (this.TryResolveRandomOption(999999, 999999, rp))
- {
- return;
+ Log.Warning("Grid resolver could not resolve any grid size. params=" + rp);
}
- Log.Warning("Grid resolver could not resolve any grid size. params=" + rp);
}
private void FillOptions(CellRect rect)
{
this.FillOptions(this.optionsX, rect.Width);
this.FillOptions(this.optionsZ, rect.Height);
- if (this.optionsZ.Any((Pair x) => x.First > 1))
+ if (this.optionsZ.Any((Predicate>)((Pair x) => x.First > 1)))
{
- this.optionsX.RemoveAll((Pair x) => x.First >= 3 && this.GetRoomSize(x.First, x.Second, rect.Width) <= 7);
+ this.optionsX.RemoveAll((Predicate>)((Pair x) => x.First >= 3 && this.GetRoomSize(x.First, x.Second, rect.Width) <= 7));
}
- if (this.optionsX.Any((Pair x) => x.First > 1))
+ if (this.optionsX.Any((Predicate>)((Pair x) => x.First > 1)))
{
- this.optionsZ.RemoveAll((Pair x) => x.First >= 3 && this.GetRoomSize(x.First, x.Second, rect.Height) <= 7);
+ this.optionsZ.RemoveAll((Predicate>)((Pair x) => x.First >= 3 && this.GetRoomSize(x.First, x.Second, rect.Height) <= 7));
}
}
@@ -146,9 +122,9 @@ private bool TryResolveRandomOption(int maxWidthHeightDiff, int maxPathwayWidthD
}
}
}
- if (SymbolResolver_BasePart_Outdoors_Division_Grid.options.Any, Pair>>())
+ if (SymbolResolver_BasePart_Outdoors_Division_Grid.options.Any())
{
- Pair, Pair> pair = SymbolResolver_BasePart_Outdoors_Division_Grid.options.RandomElement, Pair>>();
+ Pair, Pair> pair = SymbolResolver_BasePart_Outdoors_Division_Grid.options.RandomElement();
this.ResolveOption(pair.First.First, pair.First.Second, pair.Second.First, pair.Second.Second, rp);
return true;
}
@@ -163,14 +139,7 @@ private void ResolveOption(int roomsPerRowX, int pathwayWidthX, int roomsPerRowZ
ThingDef thingDef = null;
if (pathwayWidthX >= 3)
{
- if (rp.faction == null || rp.faction.def.techLevel >= TechLevel.Industrial)
- {
- thingDef = ThingDefOf.StandingLamp;
- }
- else
- {
- thingDef = ThingDefOf.TorchLamp;
- }
+ thingDef = ((rp.faction != null && (int)rp.faction.def.techLevel < 4) ? ThingDefOf.TorchLamp : ThingDefOf.StandingLamp);
}
TerrainDef floorDef = rp.pathwayFloorDef ?? BaseGenUtility.RandomBasicFloorDef(rp.faction, false);
int num = roomSize;
@@ -198,14 +167,14 @@ private void ResolveOption(int roomsPerRowX, int pathwayWidthX, int roomsPerRowZ
num = 0;
num2 = 0;
this.children.Clear();
- for (int k = 0; k < roomsPerRowX; k++)
+ for (int num3 = 0; num3 < roomsPerRowX; num3++)
{
- for (int l = 0; l < roomsPerRowZ; l++)
+ for (int num4 = 0; num4 < roomsPerRowZ; num4++)
{
- SymbolResolver_BasePart_Outdoors_Division_Grid.Child child = new SymbolResolver_BasePart_Outdoors_Division_Grid.Child();
+ Child child = new Child();
child.rect = new CellRect(rp.rect.minX + num, rp.rect.minZ + num2, roomSize, roomSize2);
- child.gridX = k;
- child.gridY = l;
+ child.gridX = num3;
+ child.gridY = num4;
this.children.Add(child);
num2 += roomSize2 + pathwayWidthZ;
}
@@ -213,12 +182,12 @@ private void ResolveOption(int roomsPerRowX, int pathwayWidthX, int roomsPerRowZ
num2 = 0;
}
this.MergeRandomChildren();
- this.children.Shuffle();
- for (int m = 0; m < this.children.Count; m++)
+ this.children.Shuffle();
+ for (int k = 0; k < this.children.Count; k++)
{
if (thingDef != null)
{
- IntVec3 c = new IntVec3(this.children[m].rect.maxX + 1, 0, this.children[m].rect.maxZ);
+ IntVec3 c = new IntVec3(this.children[k].rect.maxX + 1, 0, this.children[k].rect.maxZ);
if (rp.rect.Contains(c) && c.Standable(map))
{
ResolveParams resolveParams3 = rp;
@@ -228,37 +197,39 @@ private void ResolveOption(int roomsPerRowX, int pathwayWidthX, int roomsPerRowZ
}
}
ResolveParams resolveParams4 = rp;
- resolveParams4.rect = this.children[m].rect;
+ resolveParams4.rect = this.children[k].rect;
BaseGen.symbolStack.Push("basePart_outdoors", resolveParams4);
}
}
private void MergeRandomChildren()
{
- if (this.children.Count < 4)
+ if (this.children.Count >= 4)
{
- return;
- }
- int num = GenMath.RoundRandom((float)this.children.Count / 6f);
- for (int i = 0; i < num; i++)
- {
- SymbolResolver_BasePart_Outdoors_Division_Grid.Child child = this.children.Find((SymbolResolver_BasePart_Outdoors_Division_Grid.Child x) => !x.merged);
- if (child == null)
+ int num = GenMath.RoundRandom((float)((float)this.children.Count / 6.0));
+ int num2 = 0;
+ while (num2 < num)
{
+ Child child = this.children.Find((Predicate)((Child x) => !x.merged));
+ if (child != null)
+ {
+ Child child2 = this.children.Find((Predicate)((Child x) => x != child && ((Mathf.Abs(x.gridX - child.gridX) == 1 && x.gridY == child.gridY) || (Mathf.Abs(x.gridY - child.gridY) == 1 && x.gridX == child.gridX))));
+ if (child2 != null)
+ {
+ this.children.Remove(child);
+ this.children.Remove(child2);
+ Child child3 = new Child();
+ child3.gridX = Mathf.Min(child.gridX, child2.gridX);
+ child3.gridY = Mathf.Min(child.gridY, child2.gridY);
+ child3.merged = true;
+ child3.rect = CellRect.FromLimits(Mathf.Min(child.rect.minX, child2.rect.minX), Mathf.Min(child.rect.minZ, child2.rect.minZ), Mathf.Max(child.rect.maxX, child2.rect.maxX), Mathf.Max(child.rect.maxZ, child2.rect.maxZ));
+ this.children.Add(child3);
+ }
+ num2++;
+ continue;
+ }
break;
}
- SymbolResolver_BasePart_Outdoors_Division_Grid.Child child3 = this.children.Find((SymbolResolver_BasePart_Outdoors_Division_Grid.Child x) => x != child && ((Mathf.Abs(x.gridX - child.gridX) == 1 && x.gridY == child.gridY) || (Mathf.Abs(x.gridY - child.gridY) == 1 && x.gridX == child.gridX)));
- if (child3 != null)
- {
- this.children.Remove(child);
- this.children.Remove(child3);
- SymbolResolver_BasePart_Outdoors_Division_Grid.Child child2 = new SymbolResolver_BasePart_Outdoors_Division_Grid.Child();
- child2.gridX = Mathf.Min(child.gridX, child3.gridX);
- child2.gridY = Mathf.Min(child.gridY, child3.gridY);
- child2.merged = true;
- child2.rect = CellRect.FromLimits(Mathf.Min(child.rect.minX, child3.rect.minX), Mathf.Min(child.rect.minZ, child3.rect.minZ), Mathf.Max(child.rect.maxX, child3.rect.maxX), Mathf.Max(child.rect.maxZ, child3.rect.maxZ));
- this.children.Add(child2);
- }
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Division_Split.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Division_Split.cs
index 6bd9d030c..59623b133 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Division_Split.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Division_Split.cs
@@ -1,4 +1,3 @@
-using System;
using UnityEngine;
using Verse;
@@ -12,30 +11,38 @@ public class SymbolResolver_BasePart_Outdoors_Division_Split : SymbolResolver
public override bool CanResolve(ResolveParams rp)
{
- int num;
- int num2;
- return base.CanResolve(rp) && (this.TryFindSplitPoint(false, rp.rect, out num, out num2) || this.TryFindSplitPoint(true, rp.rect, out num, out num2));
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ int num = default(int);
+ int num2 = default(int);
+ if (!this.TryFindSplitPoint(false, rp.rect, out num, out num2) && !this.TryFindSplitPoint(true, rp.rect, out num, out num2))
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
{
bool @bool = Rand.Bool;
- int num;
- int num2;
+ int num = default(int);
+ int num2 = default(int);
bool flag;
if (this.TryFindSplitPoint(@bool, rp.rect, out num, out num2))
{
flag = @bool;
+ goto IL_0053;
}
- else
+ if (this.TryFindSplitPoint(!@bool, rp.rect, out num, out num2))
{
- if (!this.TryFindSplitPoint(!@bool, rp.rect, out num, out num2))
- {
- Log.Warning("Could not find split point.");
- return;
- }
flag = !@bool;
+ goto IL_0053;
}
+ Log.Warning("Could not find split point.");
+ return;
+ IL_0053:
TerrainDef floorDef = rp.pathwayFloorDef ?? BaseGenUtility.RandomBasicFloorDef(rp.faction, false);
ResolveParams resolveParams3;
ResolveParams resolveParams5;
@@ -84,7 +91,9 @@ private bool TryFindSplitPoint(bool horizontal, CellRect rect, out int splitPoin
int num = (!horizontal) ? rect.Width : rect.Height;
spaceBetween = SymbolResolver_BasePart_Outdoors_Division_Split.SpaceBetweenRange.RandomInRange;
spaceBetween = Mathf.Min(spaceBetween, num - 10);
- if (spaceBetween < SymbolResolver_BasePart_Outdoors_Division_Split.SpaceBetweenRange.min)
+ int num2 = spaceBetween;
+ IntRange spaceBetweenRange = SymbolResolver_BasePart_Outdoors_Division_Split.SpaceBetweenRange;
+ if (num2 < spaceBetweenRange.min)
{
splitPoint = -1;
return false;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafDecorated_EdgeStreet.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafDecorated_EdgeStreet.cs
index 349e9cc6f..09f6dc420 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafDecorated_EdgeStreet.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafDecorated_EdgeStreet.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BasePart_Outdoors_LeafDecorated_EdgeStreet : SymbolResolver
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafDecorated_RandomInnerRect.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafDecorated_RandomInnerRect.cs
index ba7e48f1e..2515fb428 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafDecorated_RandomInnerRect.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafDecorated_RandomInnerRect.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafPossiblyDecorated.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafPossiblyDecorated.cs
index ddbaede58..872451822 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafPossiblyDecorated.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_LeafPossiblyDecorated.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Building.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Building.cs
index 165a9258a..dc0263470 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Building.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Building.cs
@@ -1,12 +1,18 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BasePart_Outdoors_Leaf_Building : SymbolResolver
{
public override bool CanResolve(ResolveParams rp)
{
- return base.CanResolve(rp) && (BaseGen.globalSettings.basePart_emptyNodesResolved >= BaseGen.globalSettings.minEmptyNodes || BaseGen.globalSettings.basePart_buildingsResolved < BaseGen.globalSettings.minBuildings);
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_emptyNodesResolved < BaseGen.globalSettings.minEmptyNodes && BaseGen.globalSettings.basePart_buildingsResolved >= BaseGen.globalSettings.minBuildings)
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Empty.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Empty.cs
index 64adf18aa..fd6adde19 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Empty.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Empty.cs
@@ -1,12 +1,18 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BasePart_Outdoors_Leaf_Empty : SymbolResolver
{
public override bool CanResolve(ResolveParams rp)
{
- return base.CanResolve(rp) && BaseGen.globalSettings.basePart_buildingsResolved >= BaseGen.globalSettings.minBuildings;
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_buildingsResolved < BaseGen.globalSettings.minBuildings)
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Farm.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Farm.cs
index 2144f3739..b743d8e1a 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Farm.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_Farm.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BasePart_Outdoors_Leaf_Farm : SymbolResolver
@@ -8,7 +6,23 @@ public class SymbolResolver_BasePart_Outdoors_Leaf_Farm : SymbolResolver
public override bool CanResolve(ResolveParams rp)
{
- return base.CanResolve(rp) && BaseGen.globalSettings.basePart_buildingsResolved >= BaseGen.globalSettings.minBuildings && BaseGen.globalSettings.basePart_emptyNodesResolved >= BaseGen.globalSettings.minEmptyNodes && BaseGen.globalSettings.basePart_farmsCoverage + (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area < 0.55f && (rp.rect.Width <= 15 && rp.rect.Height <= 15) && (rp.cultivatedPlantDef != null || SymbolResolver_CultivatedPlants.DeterminePlantDef(rp.rect) != null);
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_buildingsResolved < BaseGen.globalSettings.minBuildings)
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_emptyNodesResolved < BaseGen.globalSettings.minEmptyNodes)
+ {
+ return false;
+ }
+ if (BaseGen.globalSettings.basePart_farmsCoverage + (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area >= 0.550000011920929)
+ {
+ return false;
+ }
+ return rp.rect.Width <= 15 && rp.rect.Height <= 15 && (rp.cultivatedPlantDef != null || SymbolResolver_CultivatedPlants.DeterminePlantDef(rp.rect) != null);
}
public override void Resolve(ResolveParams rp)
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.cs
index 0cbfd1db7..96f17e16d 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using UnityEngine;
using Verse;
@@ -25,37 +24,36 @@ public override bool CanResolve(ResolveParams rp)
{
return false;
}
- if (BaseGen.globalSettings.basePart_powerPlantsCoverage + (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area >= 0.09f)
+ if (BaseGen.globalSettings.basePart_powerPlantsCoverage + (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area >= 0.090000003576278687)
{
return false;
}
- if (rp.faction != null && rp.faction.def.techLevel < TechLevel.Industrial)
+ if (rp.faction != null && (int)rp.faction.def.techLevel < 4)
{
return false;
}
- if (rp.rect.Width > 13 || rp.rect.Height > 13)
+ if (rp.rect.Width <= 13 && rp.rect.Height <= 13)
{
- return false;
+ this.CalculateAvailablePowerPlants(rp.rect);
+ return SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.Any();
}
- this.CalculateAvailablePowerPlants(rp.rect);
- return SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.Any();
+ return false;
}
public override void Resolve(ResolveParams rp)
{
this.CalculateAvailablePowerPlants(rp.rect);
- if (!SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.Any())
+ if (SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.Any())
{
- return;
+ BaseGen.symbolStack.Push("refuel", rp);
+ ThingDef thingDef = SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.RandomElement();
+ ResolveParams resolveParams = rp;
+ resolveParams.singleThingDef = thingDef;
+ int? fillWithThingsPadding = rp.fillWithThingsPadding;
+ resolveParams.fillWithThingsPadding = new int?((!fillWithThingsPadding.HasValue) ? Mathf.Max(5 - thingDef.size.x, 1) : fillWithThingsPadding.Value);
+ BaseGen.symbolStack.Push("fillWithThings", resolveParams);
+ BaseGen.globalSettings.basePart_powerPlantsCoverage += (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area;
}
- BaseGen.symbolStack.Push("refuel", rp);
- ThingDef thingDef = SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.RandomElement();
- ResolveParams resolveParams = rp;
- resolveParams.singleThingDef = thingDef;
- int? fillWithThingsPadding = rp.fillWithThingsPadding;
- resolveParams.fillWithThingsPadding = new int?((!fillWithThingsPadding.HasValue) ? Mathf.Max(5 - thingDef.size.x, 1) : fillWithThingsPadding.Value);
- BaseGen.symbolStack.Push("fillWithThings", resolveParams);
- BaseGen.globalSettings.basePart_powerPlantsCoverage += (float)rp.rect.Area / (float)BaseGen.globalSettings.mainRect.Area;
}
private void CalculateAvailablePowerPlants(CellRect rect)
@@ -74,7 +72,7 @@ private void CalculateAvailablePowerPlants(CellRect rect)
}
iterator.MoveNext();
}
- if ((float)num / (float)rect.Area >= 0.5f)
+ if ((float)num / (float)rect.Area >= 0.5)
{
SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.Add(ThingDefOf.SolarGenerator);
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BatteryRoom.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BatteryRoom.cs
index e7c48cae2..2991660e0 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BatteryRoom.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_BatteryRoom.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_BatteryRoom : SymbolResolver
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Brewery.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Brewery.cs
index 3b09ee249..070c72a4d 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Brewery.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Brewery.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_Brewery : SymbolResolver
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ChargeBatteries.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ChargeBatteries.cs
index 4fd6ac14b..7a4b91fc6 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ChargeBatteries.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ChargeBatteries.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using UnityEngine;
using Verse;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Clear.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Clear.cs
index 368766ed4..d3baac06f 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Clear.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Clear.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_CultivatedPlants.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_CultivatedPlants.cs
index 2f2917660..20f26eb55 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_CultivatedPlants.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_CultivatedPlants.cs
@@ -21,19 +21,15 @@ public override void Resolve(ResolveParams rp)
{
Map map = BaseGen.globalSettings.map;
ThingDef thingDef = rp.cultivatedPlantDef ?? SymbolResolver_CultivatedPlants.DeterminePlantDef(rp.rect);
- if (thingDef == null)
+ if (thingDef != null)
{
- return;
- }
- float growth = Rand.Range(0.2f, 1f);
- int age = (!thingDef.plant.LimitedLifespan) ? 0 : Rand.Range(0, Mathf.Max(thingDef.plant.LifespanTicks - 2500, 0));
- CellRect.CellRectIterator iterator = rp.rect.GetIterator();
- while (!iterator.Done())
- {
- float num = map.fertilityGrid.FertilityAt(iterator.Current);
- if (num >= thingDef.plant.fertilityMin)
+ float growth = Rand.Range(0.2f, 1f);
+ int age = thingDef.plant.LimitedLifespan ? Rand.Range(0, Mathf.Max(thingDef.plant.LifespanTicks - 2500, 0)) : 0;
+ CellRect.CellRectIterator iterator = rp.rect.GetIterator();
+ while (!iterator.Done())
{
- if (this.TryDestroyBlockingThingsAt(iterator.Current))
+ float num = map.fertilityGrid.FertilityAt(iterator.Current);
+ if (!(num < thingDef.plant.fertilityMin) && this.TryDestroyBlockingThingsAt(iterator.Current))
{
Plant plant = (Plant)GenSpawn.Spawn(thingDef, iterator.Current, map);
plant.Growth = growth;
@@ -42,42 +38,42 @@ public override void Resolve(ResolveParams rp)
plant.Age = age;
}
}
+ iterator.MoveNext();
}
- iterator.MoveNext();
}
}
public static ThingDef DeterminePlantDef(CellRect rect)
{
Map map = BaseGen.globalSettings.map;
- if (map.mapTemperature.OutdoorTemp < 0f || map.mapTemperature.OutdoorTemp > 58f)
- {
- return null;
- }
- float minFertility = 3.40282347E+38f;
- bool flag = false;
- CellRect.CellRectIterator iterator = rect.GetIterator();
- while (!iterator.Done())
+ if (!(map.mapTemperature.OutdoorTemp < 0.0) && !(map.mapTemperature.OutdoorTemp > 58.0))
{
- float num = map.fertilityGrid.FertilityAt(iterator.Current);
- if (num > 0f)
+ float minFertility = 3.40282347E+38f;
+ bool flag = false;
+ CellRect.CellRectIterator iterator = rect.GetIterator();
+ while (!iterator.Done())
{
- flag = true;
- minFertility = Mathf.Min(minFertility, num);
+ float num = map.fertilityGrid.FertilityAt(iterator.Current);
+ if (!(num <= 0.0))
+ {
+ flag = true;
+ minFertility = Mathf.Min(minFertility, num);
+ }
+ iterator.MoveNext();
+ }
+ if (!flag)
+ {
+ return null;
+ }
+ ThingDef result = default(ThingDef);
+ if ((from x in DefDatabase.AllDefsListForReading
+ where x.category == ThingCategory.Plant && x.plant.Sowable && !x.plant.IsTree && x.plant.fertilityMin <= minFertility && x.plant.Harvestable
+ select x).TryRandomElement(out result))
+ {
+ return result;
}
- iterator.MoveNext();
- }
- if (!flag)
- {
return null;
}
- ThingDef result;
- if ((from x in DefDatabase.AllDefsListForReading
- where x.category == ThingCategory.Plant && x.plant.Sowable && !x.plant.IsTree && x.plant.fertilityMin <= minFertility && x.plant.Harvestable
- select x).TryRandomElement(out result))
- {
- return result;
- }
return null;
}
@@ -88,13 +84,10 @@ private bool TryDestroyBlockingThingsAt(IntVec3 c)
SymbolResolver_CultivatedPlants.tmpThings.AddRange(c.GetThingList(map));
for (int i = 0; i < SymbolResolver_CultivatedPlants.tmpThings.Count; i++)
{
- if (!(SymbolResolver_CultivatedPlants.tmpThings[i] is Pawn))
+ if (!(SymbolResolver_CultivatedPlants.tmpThings[i] is Pawn) && !SymbolResolver_CultivatedPlants.tmpThings[i].def.destroyable)
{
- if (!SymbolResolver_CultivatedPlants.tmpThings[i].def.destroyable)
- {
- SymbolResolver_CultivatedPlants.tmpThings.Clear();
- return false;
- }
+ SymbolResolver_CultivatedPlants.tmpThings.Clear();
+ return false;
}
}
for (int j = 0; j < SymbolResolver_CultivatedPlants.tmpThings.Count; j++)
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_DiningRoom.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_DiningRoom.cs
index a0410828e..957cb6e31 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_DiningRoom.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_DiningRoom.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_DiningRoom : SymbolResolver
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Doors.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Doors.cs
index ac2de5d0d..0edfe614a 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Doors.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Doors.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeDefense.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeDefense.cs
index fd066a0c7..e6450880a 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeDefense.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeDefense.cs
@@ -16,7 +16,7 @@ public override void Resolve(ResolveParams rp)
Map map = BaseGen.globalSettings.map;
Faction faction = rp.faction ?? Find.FactionManager.RandomEnemyFaction(false, false, true);
int? edgeDefenseGuardsCount = rp.edgeDefenseGuardsCount;
- int num = (!edgeDefenseGuardsCount.HasValue) ? 0 : edgeDefenseGuardsCount.Value;
+ int num = edgeDefenseGuardsCount.HasValue ? edgeDefenseGuardsCount.Value : 0;
int width;
if (rp.edgeDefenseWidth.HasValue)
{
@@ -40,8 +40,8 @@ public override void Resolve(ResolveParams rp)
{
case 1:
{
- int? edgeDefenseTurretsCount = rp.edgeDefenseTurretsCount;
- num2 = ((!edgeDefenseTurretsCount.HasValue) ? 0 : edgeDefenseTurretsCount.Value);
+ int? edgeDefenseTurretsCount2 = rp.edgeDefenseTurretsCount;
+ num2 = (edgeDefenseTurretsCount2.HasValue ? edgeDefenseTurretsCount2.Value : 0);
num3 = 0;
flag = false;
flag2 = true;
@@ -50,8 +50,8 @@ public override void Resolve(ResolveParams rp)
}
case 2:
{
- int? edgeDefenseTurretsCount2 = rp.edgeDefenseTurretsCount;
- num2 = ((!edgeDefenseTurretsCount2.HasValue) ? (rp.rect.EdgeCellsCount / 30) : edgeDefenseTurretsCount2.Value);
+ int? edgeDefenseTurretsCount3 = rp.edgeDefenseTurretsCount;
+ num2 = ((!edgeDefenseTurretsCount3.HasValue) ? (rp.rect.EdgeCellsCount / 30) : edgeDefenseTurretsCount3.Value);
num3 = 0;
flag = false;
flag2 = false;
@@ -60,10 +60,10 @@ public override void Resolve(ResolveParams rp)
}
case 3:
{
- int? edgeDefenseTurretsCount3 = rp.edgeDefenseTurretsCount;
- num2 = ((!edgeDefenseTurretsCount3.HasValue) ? (rp.rect.EdgeCellsCount / 30) : edgeDefenseTurretsCount3.Value);
- int? edgeDefenseMortarsCount = rp.edgeDefenseMortarsCount;
- num3 = ((!edgeDefenseMortarsCount.HasValue) ? (rp.rect.EdgeCellsCount / 75) : edgeDefenseMortarsCount.Value);
+ int? edgeDefenseTurretsCount4 = rp.edgeDefenseTurretsCount;
+ num2 = ((!edgeDefenseTurretsCount4.HasValue) ? (rp.rect.EdgeCellsCount / 30) : edgeDefenseTurretsCount4.Value);
+ int? edgeDefenseMortarsCount2 = rp.edgeDefenseMortarsCount;
+ num3 = ((!edgeDefenseMortarsCount2.HasValue) ? (rp.rect.EdgeCellsCount / 75) : edgeDefenseMortarsCount2.Value);
flag = (num3 == 0);
flag2 = false;
flag3 = true;
@@ -71,17 +71,17 @@ public override void Resolve(ResolveParams rp)
}
default:
{
- int? edgeDefenseTurretsCount4 = rp.edgeDefenseTurretsCount;
- num2 = ((!edgeDefenseTurretsCount4.HasValue) ? (rp.rect.EdgeCellsCount / 30) : edgeDefenseTurretsCount4.Value);
- int? edgeDefenseMortarsCount2 = rp.edgeDefenseMortarsCount;
- num3 = ((!edgeDefenseMortarsCount2.HasValue) ? (rp.rect.EdgeCellsCount / 75) : edgeDefenseMortarsCount2.Value);
+ int? edgeDefenseTurretsCount = rp.edgeDefenseTurretsCount;
+ num2 = ((!edgeDefenseTurretsCount.HasValue) ? (rp.rect.EdgeCellsCount / 30) : edgeDefenseTurretsCount.Value);
+ int? edgeDefenseMortarsCount = rp.edgeDefenseMortarsCount;
+ num3 = ((!edgeDefenseMortarsCount.HasValue) ? (rp.rect.EdgeCellsCount / 75) : edgeDefenseMortarsCount.Value);
flag = true;
flag2 = false;
flag3 = false;
break;
}
}
- if (faction != null && faction.def.techLevel < TechLevel.Industrial)
+ if (faction != null && (int)faction.def.techLevel < 4)
{
num2 = 0;
num3 = 0;
@@ -89,17 +89,18 @@ public override void Resolve(ResolveParams rp)
if (num > 0)
{
Lord singlePawnLord = rp.singlePawnLord ?? LordMaker.MakeNewLord(faction, new LordJob_DefendBase(faction, rp.rect.CenterCell), map, null);
- for (int i = 0; i < num; i++)
+ for (int num4 = 0; num4 < num; num4++)
{
- PawnGenerationRequest value = new PawnGenerationRequest(faction.RandomPawnKind(), faction, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, true, 1f, false, true, true, false, false, null, null, null, null, null, null);
- ResolveParams rp2 = rp;
- rp2.faction = faction;
- rp2.singlePawnLord = singlePawnLord;
- rp2.singlePawnGenerationRequest = new PawnGenerationRequest?(value);
- rp2.singlePawnSpawnCellExtraPredicate = (rp2.singlePawnSpawnCellExtraPredicate ?? delegate(IntVec3 x)
+ PawnGenerationRequest value = new PawnGenerationRequest(faction.RandomPawnKind(), faction, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, true, 1f, false, true, true, false, false, null, default(float?), default(float?), default(Gender?), default(float?), (string)null);
+ ResolveParams resolveParams = rp;
+ resolveParams.faction = faction;
+ resolveParams.singlePawnLord = singlePawnLord;
+ resolveParams.singlePawnGenerationRequest = new PawnGenerationRequest?(value);
+ object obj = resolveParams.singlePawnSpawnCellExtraPredicate;
+ obj = (resolveParams.singlePawnSpawnCellExtraPredicate = (Predicate)delegate(IntVec3 x)
{
CellRect cellRect = rp.rect;
- for (int m = 0; m < width; m++)
+ for (int num8 = 0; num8 < width; num8++)
{
if (cellRect.IsOnEdge(x))
{
@@ -109,43 +110,41 @@ public override void Resolve(ResolveParams rp)
}
return true;
});
- BaseGen.symbolStack.Push("pawn", rp2);
+ BaseGen.symbolStack.Push("pawn", resolveParams);
}
}
CellRect rect = rp.rect;
- for (int j = 0; j < width; j++)
+ for (int num5 = 0; num5 < width; num5++)
{
- if (j % 2 == 0)
+ if (num5 % 2 == 0)
{
- ResolveParams rp3 = rp;
- rp3.faction = faction;
- rp3.rect = rect;
- BaseGen.symbolStack.Push("edgeSandbags", rp3);
+ ResolveParams resolveParams2 = rp;
+ resolveParams2.faction = faction;
+ resolveParams2.rect = rect;
+ BaseGen.symbolStack.Push("edgeSandbags", resolveParams2);
if (!flag)
- {
break;
- }
}
rect = rect.ContractedBy(1);
}
CellRect rect2 = (!flag3) ? rp.rect.ContractedBy(1) : rp.rect;
- for (int k = 0; k < num3; k++)
+ for (int num6 = 0; num6 < num3; num6++)
{
- ResolveParams rp4 = rp;
- rp4.faction = faction;
- rp4.rect = rect2;
- BaseGen.symbolStack.Push("edgeMannedMortar", rp4);
+ ResolveParams resolveParams3 = rp;
+ resolveParams3.faction = faction;
+ resolveParams3.rect = rect2;
+ BaseGen.symbolStack.Push("edgeMannedMortar", resolveParams3);
}
CellRect rect3 = (!flag2) ? rp.rect.ContractedBy(1) : rp.rect;
- for (int l = 0; l < num2; l++)
+ for (int num7 = 0; num7 < num2; num7++)
{
- ResolveParams rp5 = rp;
- rp5.faction = faction;
- rp5.singleThingDef = ThingDefOf.TurretGun;
- rp5.rect = rect3;
+ ResolveParams resolveParams4 = rp;
+ resolveParams4.faction = faction;
+ resolveParams4.singleThingDef = ThingDefOf.TurretGun;
+ resolveParams4.rect = rect3;
bool? edgeThingAvoidOtherEdgeThings = rp.edgeThingAvoidOtherEdgeThings;
- rp5.edgeThingAvoidOtherEdgeThings = new bool?(!edgeThingAvoidOtherEdgeThings.HasValue || edgeThingAvoidOtherEdgeThings.Value);
- BaseGen.symbolStack.Push("edgeThing", rp5);
+ resolveParams4.edgeThingAvoidOtherEdgeThings = new bool?(!edgeThingAvoidOtherEdgeThings.HasValue || edgeThingAvoidOtherEdgeThings.Value);
+ BaseGen.symbolStack.Push("edgeThing", resolveParams4);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeFloor.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeFloor.cs
index d7c59905e..2cabd9c0d 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeFloor.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeFloor.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeMannedMortar.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeMannedMortar.cs
index b61ffb2fc..176a03bab 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeMannedMortar.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeMannedMortar.cs
@@ -8,45 +8,36 @@ public class SymbolResolver_EdgeMannedMortar : SymbolResolver
{
public override bool CanResolve(ResolveParams rp)
{
- CellRect cellRect;
+ CellRect cellRect = default(CellRect);
return base.CanResolve(rp) && this.TryFindRandomInnerRectTouchingEdge(rp.rect, out cellRect);
}
public override void Resolve(ResolveParams rp)
{
- CellRect rect;
- if (!this.TryFindRandomInnerRectTouchingEdge(rp.rect, out rect))
+ CellRect rect = default(CellRect);
+ if (this.TryFindRandomInnerRectTouchingEdge(rp.rect, out rect))
{
- return;
+ Rot4 value = (!rect.Cells.Any((Func)((IntVec3 x) => x.x == rp.rect.minX))) ? ((!rect.Cells.Any((Func)((IntVec3 x) => x.x == rp.rect.maxX))) ? ((!rect.Cells.Any((Func)((IntVec3 x) => x.z == rp.rect.minZ))) ? Rot4.North : Rot4.South) : Rot4.East) : Rot4.West;
+ ResolveParams resolveParams = rp;
+ resolveParams.rect = rect;
+ resolveParams.thingRot = new Rot4?(value);
+ BaseGen.symbolStack.Push("mannedMortar", resolveParams);
}
- Rot4 value;
- if (rect.Cells.Any((IntVec3 x) => x.x == rp.rect.minX))
- {
- value = Rot4.West;
- }
- else if (rect.Cells.Any((IntVec3 x) => x.x == rp.rect.maxX))
- {
- value = Rot4.East;
- }
- else if (rect.Cells.Any((IntVec3 x) => x.z == rp.rect.minZ))
- {
- value = Rot4.South;
- }
- else
- {
- value = Rot4.North;
- }
- ResolveParams rp2 = rp;
- rp2.rect = rect;
- rp2.thingRot = new Rot4?(value);
- BaseGen.symbolStack.Push("mannedMortar", rp2);
}
private bool TryFindRandomInnerRectTouchingEdge(CellRect rect, out CellRect mortarRect)
{
Map map = BaseGen.globalSettings.map;
IntVec2 size = new IntVec2(3, 3);
- return rect.TryFindRandomInnerRectTouchingEdge(size, out mortarRect, (CellRect x) => x.Cells.All((IntVec3 y) => y.Standable(map) && y.GetEdifice(map) == null) && GenConstruct.TerrainCanSupport(x, map, ThingDefOf.Turret_MortarBomb)) || rect.TryFindRandomInnerRectTouchingEdge(size, out mortarRect, (CellRect x) => x.Cells.All((IntVec3 y) => y.Standable(map) && y.GetEdifice(map) == null));
+ if (rect.TryFindRandomInnerRectTouchingEdge(size, out mortarRect, (Predicate)((CellRect x) => x.Cells.All((Func)((IntVec3 y) => y.Standable(map) && y.GetEdifice(map) == null)) && GenConstruct.TerrainCanSupport(x, map, ThingDefOf.Turret_MortarBomb))))
+ {
+ return true;
+ }
+ if (rect.TryFindRandomInnerRectTouchingEdge(size, out mortarRect, (Predicate)((CellRect x) => x.Cells.All((Func)((IntVec3 y) => y.Standable(map) && y.GetEdifice(map) == null)))))
+ {
+ return true;
+ }
+ return false;
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeSandbags.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeSandbags.cs
index b3845d339..0c31dc0f6 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeSandbags.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeSandbags.cs
@@ -15,7 +15,11 @@ public override void Resolve(ResolveParams rp)
int num = 0;
int num2 = 0;
int num3 = -1;
- if (rp.rect.EdgeCellsCount < (SymbolResolver_EdgeSandbags.LineLengthRange.max + SymbolResolver_EdgeSandbags.GapLengthRange.max) * 2)
+ int edgeCellsCount = rp.rect.EdgeCellsCount;
+ IntRange lineLengthRange = SymbolResolver_EdgeSandbags.LineLengthRange;
+ int max = lineLengthRange.max;
+ IntRange gapLengthRange = SymbolResolver_EdgeSandbags.GapLengthRange;
+ if (edgeCellsCount < (max + gapLengthRange.max) * 2)
{
num = rp.rect.EdgeCellsCount;
}
@@ -27,7 +31,7 @@ public override void Resolve(ResolveParams rp)
{
num2 = SymbolResolver_EdgeSandbags.GapLengthRange.RandomInRange;
}
- foreach (IntVec3 current in rp.rect.EdgeCells)
+ foreach (IntVec3 edgeCell in rp.rect.EdgeCells)
{
num3++;
if (num2 > 0)
@@ -45,22 +49,19 @@ public override void Resolve(ResolveParams rp)
}
}
}
- else if (current.Standable(map) && !current.Roofed(map))
+ else if (edgeCell.Standable(map) && !edgeCell.Roofed(map) && !GenSpawn.WouldWipeAnythingWith(edgeCell, Rot4.North, ThingDefOf.Sandbags, map, (Predicate)((Thing x) => x.def.category == ThingCategory.Building || x.def.category == ThingCategory.Item)))
{
- if (!GenSpawn.WouldWipeAnythingWith(current, Rot4.North, ThingDefOf.Sandbags, map, (Thing x) => x.def.category == ThingCategory.Building || x.def.category == ThingCategory.Item))
+ if (num > 0)
{
- if (num > 0)
+ num--;
+ if (num == 0)
{
- num--;
- if (num == 0)
- {
- num2 = SymbolResolver_EdgeSandbags.GapLengthRange.RandomInRange;
- }
+ num2 = SymbolResolver_EdgeSandbags.GapLengthRange.RandomInRange;
}
- Thing thing = ThingMaker.MakeThing(ThingDefOf.Sandbags, null);
- thing.SetFaction(rp.faction, null);
- GenSpawn.Spawn(thing, current, map);
}
+ Thing thing = ThingMaker.MakeThing(ThingDefOf.Sandbags, null);
+ thing.SetFaction(rp.faction, null);
+ GenSpawn.Spawn(thing, edgeCell, map);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeStreet.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeStreet.cs
index dc61158b7..2400da2a9 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeStreet.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeStreet.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeThing.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeThing.cs
index 2e6c9a407..1a21f14d4 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeThing.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeThing.cs
@@ -28,9 +28,9 @@ public override bool CanResolve(ResolveParams rp)
{
bool? edgeThingAvoidOtherEdgeThings = rp.edgeThingAvoidOtherEdgeThings;
bool avoidOtherEdgeThings = edgeThingAvoidOtherEdgeThings.HasValue && edgeThingAvoidOtherEdgeThings.Value;
+ IntVec3 intVec = default(IntVec3);
if (rp.thingRot.HasValue)
{
- IntVec3 intVec;
if (!this.TryFindSpawnCell(rp.rect, rp.singleThingDef, rp.thingRot.Value, avoidOtherEdgeThings, out intVec))
{
return false;
@@ -38,7 +38,6 @@ public override bool CanResolve(ResolveParams rp)
}
else if (!rp.singleThingDef.rotatable)
{
- IntVec3 intVec;
if (!this.TryFindSpawnCell(rp.rect, rp.singleThingDef, Rot4.North, avoidOtherEdgeThings, out intVec))
{
return false;
@@ -47,14 +46,16 @@ public override bool CanResolve(ResolveParams rp)
else
{
bool flag = false;
- for (int i = 0; i < 4; i++)
+ int num = 0;
+ while (num < 4)
{
- IntVec3 intVec;
- if (this.TryFindSpawnCell(rp.rect, rp.singleThingDef, new Rot4(i), avoidOtherEdgeThings, out intVec))
+ if (!this.TryFindSpawnCell(rp.rect, rp.singleThingDef, new Rot4(num), avoidOtherEdgeThings, out intVec))
{
- flag = true;
- break;
+ num++;
+ continue;
}
+ flag = true;
+ break;
}
if (!flag)
{
@@ -67,52 +68,64 @@ public override bool CanResolve(ResolveParams rp)
public override void Resolve(ResolveParams rp)
{
- ThingDef thingDef = rp.singleThingDef ?? (from x in DefDatabase.AllDefsListForReading
- where (x.IsWeapon || x.IsMedicine || x.IsDrug) && x.graphicData != null && !x.destroyOnDrop && x.size.x <= rp.rect.Width && x.size.z <= rp.rect.Width && x.size.x <= rp.rect.Height && x.size.z <= rp.rect.Height
- select x).RandomElement();
+ ThingDef thingDef = rp.singleThingDef ?? DefDatabase.AllDefsListForReading.Where((Func)delegate(ThingDef x)
+ {
+ int result;
+ if ((x.IsWeapon || x.IsMedicine || x.IsDrug) && x.graphicData != null && !x.destroyOnDrop && x.size.x <= rp.rect.Width && x.size.z <= rp.rect.Width && x.size.x <= rp.rect.Height)
+ {
+ result = ((x.size.z <= rp.rect.Height) ? 1 : 0);
+ goto IL_00ba;
+ }
+ result = 0;
+ goto IL_00ba;
+ IL_00ba:
+ return (byte)result != 0;
+ }).RandomElement();
IntVec3 invalid = IntVec3.Invalid;
Rot4 value = Rot4.North;
bool? edgeThingAvoidOtherEdgeThings = rp.edgeThingAvoidOtherEdgeThings;
bool avoidOtherEdgeThings = edgeThingAvoidOtherEdgeThings.HasValue && edgeThingAvoidOtherEdgeThings.Value;
if (rp.thingRot.HasValue)
{
- if (!this.TryFindSpawnCell(rp.rect, thingDef, rp.thingRot.Value, avoidOtherEdgeThings, out invalid))
+ if (this.TryFindSpawnCell(rp.rect, thingDef, rp.thingRot.Value, avoidOtherEdgeThings, out invalid))
{
- return;
+ value = rp.thingRot.Value;
+ goto IL_0183;
}
- value = rp.thingRot.Value;
+ return;
}
- else if (!thingDef.rotatable)
+ if (!thingDef.rotatable)
{
- if (!this.TryFindSpawnCell(rp.rect, thingDef, Rot4.North, avoidOtherEdgeThings, out invalid))
+ if (this.TryFindSpawnCell(rp.rect, thingDef, Rot4.North, avoidOtherEdgeThings, out invalid))
{
- return;
+ value = Rot4.North;
+ goto IL_0183;
}
- value = Rot4.North;
+ return;
}
- else
+ this.randomRotations.Shuffle();
+ bool flag = false;
+ int num = 0;
+ while (num < this.randomRotations.Count)
{
- this.randomRotations.Shuffle();
- bool flag = false;
- for (int i = 0; i < this.randomRotations.Count; i++)
+ if (!this.TryFindSpawnCell(rp.rect, thingDef, new Rot4(this.randomRotations[num]), avoidOtherEdgeThings, out invalid))
{
- if (this.TryFindSpawnCell(rp.rect, thingDef, new Rot4(this.randomRotations[i]), avoidOtherEdgeThings, out invalid))
- {
- value = new Rot4(this.randomRotations[i]);
- flag = true;
- break;
- }
- }
- if (!flag)
- {
- return;
+ num++;
+ continue;
}
+ value = new Rot4(this.randomRotations[num]);
+ flag = true;
+ break;
}
- ResolveParams rp2 = rp;
- rp2.rect = CellRect.SingleCell(invalid);
- rp2.thingRot = new Rot4?(value);
- rp2.singleThingDef = thingDef;
- BaseGen.symbolStack.Push("thing", rp2);
+ if (!flag)
+ return;
+ goto IL_0183;
+ IL_0183:
+ ResolveParams resolveParams = rp;
+ resolveParams.rect = CellRect.SingleCell(invalid);
+ resolveParams.thingRot = new Rot4?(value);
+ resolveParams.singleThingDef = thingDef;
+ BaseGen.symbolStack.Push("thing", resolveParams);
}
private bool TryFindSpawnCell(CellRect rect, ThingDef thingDef, Rot4 rot, bool avoidOtherEdgeThings, out IntVec3 spawnCell)
@@ -123,7 +136,7 @@ private bool TryFindSpawnCell(CellRect rect, ThingDef thingDef, Rot4 rot, bool a
int num = -1;
for (int i = 0; i < this.MaxTriesToAvoidOtherEdgeThings; i++)
{
- IntVec3 intVec;
+ IntVec3 intVec = default(IntVec3);
if (this.TryFindSpawnCell(rect, thingDef, rot, out intVec))
{
int distanceSquaredToExistingEdgeThing = this.GetDistanceSquaredToExistingEdgeThing(intVec, rect, thingDef);
@@ -132,9 +145,7 @@ private bool TryFindSpawnCell(CellRect rect, ThingDef thingDef, Rot4 rot, bool a
spawnCell = intVec;
num = distanceSquaredToExistingEdgeThing;
if (num == 2147483647)
- {
break;
- }
}
}
}
@@ -150,27 +161,14 @@ private bool TryFindSpawnCell(CellRect rect, ThingDef thingDef, Rot4 rot, out In
IntVec2 size = thingDef.size;
GenAdj.AdjustForRotation(ref zero, ref size, rot);
CellRect empty = CellRect.Empty;
- Predicate basePredicate = delegate(CellRect x)
- {
- int arg_83_0;
- if (x.Cells.All((IntVec3 y) => y.Standable(map)))
- {
- if (!GenSpawn.WouldWipeAnythingWith(x, thingDef, map, (Thing z) => z.def.category == ThingCategory.Building))
- {
- arg_83_0 = ((thingDef.category != ThingCategory.Item || x.CenterCell.GetFirstItem(map) == null) ? 1 : 0);
- return arg_83_0 != 0;
- }
- }
- arg_83_0 = 0;
- return arg_83_0 != 0;
- };
+ Predicate basePredicate = (Predicate)((CellRect x) => x.Cells.All((Func)((IntVec3 y) => y.Standable(map))) && !GenSpawn.WouldWipeAnythingWith(x, thingDef, map, (Predicate)((Thing z) => z.def.category == ThingCategory.Building)) && (thingDef.category != ThingCategory.Item || x.CenterCell.GetFirstItem(map) == null));
bool flag = false;
if (thingDef.category == ThingCategory.Building)
{
- flag = rect.TryFindRandomInnerRectTouchingEdge(size, out empty, (CellRect x) => basePredicate(x) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(x, map) && GenConstruct.TerrainCanSupport(x, map, thingDef));
+ flag = rect.TryFindRandomInnerRectTouchingEdge(size, out empty, (Predicate)((CellRect x) => basePredicate(x) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(x, map) && GenConstruct.TerrainCanSupport(x, map, thingDef)));
if (!flag)
{
- flag = rect.TryFindRandomInnerRectTouchingEdge(size, out empty, (CellRect x) => basePredicate(x) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(x, map));
+ flag = rect.TryFindRandomInnerRectTouchingEdge(size, out empty, (Predicate)((CellRect x) => basePredicate(x) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(x, map)));
}
}
if (!flag && !rect.TryFindRandomInnerRectTouchingEdge(size, out empty, basePredicate))
@@ -197,21 +195,24 @@ private int GetDistanceSquaredToExistingEdgeThing(IntVec3 cell, CellRect rect, T
{
Map map = BaseGen.globalSettings.map;
int num = 2147483647;
- foreach (IntVec3 current in rect.EdgeCells)
+ foreach (IntVec3 edgeCell in rect.EdgeCells)
{
- List thingList = current.GetThingList(map);
+ List thingList = edgeCell.GetThingList(map);
bool flag = false;
- for (int i = 0; i < thingList.Count; i++)
+ int num2 = 0;
+ while (num2 < thingList.Count)
{
- if (thingList[i].def == thingDef)
+ if (thingList[num2].def != thingDef)
{
- flag = true;
- break;
+ num2++;
+ continue;
}
+ flag = true;
+ break;
}
if (flag)
{
- num = Mathf.Min(num, cell.DistanceToSquared(current));
+ num = Mathf.Min(num, cell.DistanceToSquared(edgeCell));
}
}
return num;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeWalls.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeWalls.cs
index b29514255..c164ac27e 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeWalls.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EdgeWalls.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
@@ -9,9 +8,9 @@ public class SymbolResolver_EdgeWalls : SymbolResolver
public override void Resolve(ResolveParams rp)
{
ThingDef wallStuff = rp.wallStuff ?? BaseGenUtility.RandomCheapWallStuff(rp.faction, false);
- foreach (IntVec3 current in rp.rect.EdgeCells)
+ foreach (IntVec3 edgeCell in rp.rect.EdgeCells)
{
- this.TrySpawnWall(current, rp, wallStuff);
+ this.TrySpawnWall(edgeCell, rp, wallStuff);
}
}
@@ -30,9 +29,9 @@ private Thing TrySpawnWall(IntVec3 c, ResolveParams rp, ThingDef wallStuff)
return null;
}
}
- for (int j = thingList.Count - 1; j >= 0; j--)
+ for (int num = thingList.Count - 1; num >= 0; num--)
{
- thingList[j].Destroy(DestroyMode.Vanish);
+ thingList[num].Destroy(DestroyMode.Vanish);
}
if (rp.chanceToSkipWallBlock.HasValue && Rand.Chance(rp.chanceToSkipWallBlock.Value))
{
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EmptyRoom.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EmptyRoom.cs
index fd661ad7d..146597ca9 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EmptyRoom.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EmptyRoom.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EnsureCanReachMapEdge.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EnsureCanReachMapEdge.cs
index ad2269468..cdf572e2c 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EnsureCanReachMapEdge.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_EnsureCanReachMapEdge.cs
@@ -21,7 +21,7 @@ public override void Resolve(ResolveParams rp)
SymbolResolver_EnsureCanReachMapEdge.cellsInRandomOrder.Add(iterator.Current);
iterator.MoveNext();
}
- SymbolResolver_EnsureCanReachMapEdge.cellsInRandomOrder.Shuffle();
+ SymbolResolver_EnsureCanReachMapEdge.cellsInRandomOrder.Shuffle();
this.TryMakeAllCellsReachable(false, rp);
this.TryMakeAllCellsReachable(true, rp);
}
@@ -44,13 +44,9 @@ private void TryMakeAllCellsReachable(bool canPathThroughNonStandable, ResolvePa
{
bool found = false;
IntVec3 foundDest = IntVec3.Invalid;
- map.floodFiller.FloodFill(intVec, (IntVec3 x) => !found && this.CanTraverse(x, canPathThroughNonStandable), delegate(IntVec3 x)
+ map.floodFiller.FloodFill(intVec, (Predicate)((IntVec3 x) => !found && this.CanTraverse(x, canPathThroughNonStandable)), (Action)delegate(IntVec3 x)
{
- if (found)
- {
- return;
- }
- if (map.reachability.CanReachMapEdge(x, traverseParms))
+ if (!found && map.reachability.CanReachMapEdge(x, traverseParms))
{
found = true;
foundDest = x;
@@ -96,24 +92,14 @@ private void ReconstructPathAndDestroyWalls(IntVec3 foundDest, Room room, Resolv
}
if (intVec.IsValid)
{
- ThingDef arg_12F_0;
- if ((arg_12F_0 = thingDef) == null)
- {
- arg_12F_0 = (rp.wallStuff ?? BaseGenUtility.RandomCheapWallStuff(rp.faction, false));
- }
- ThingDef stuff = arg_12F_0;
+ ThingDef stuff = thingDef ?? rp.wallStuff ?? BaseGenUtility.RandomCheapWallStuff(rp.faction, false);
Thing thing = ThingMaker.MakeThing(ThingDefOf.Door, stuff);
thing.SetFaction(rp.faction, null);
GenSpawn.Spawn(thing, intVec, map);
}
if (intVec2.IsValid && intVec2 != intVec && !intVec2.AdjacentToCardinal(intVec))
{
- ThingDef arg_1A1_0;
- if ((arg_1A1_0 = thingDef2) == null)
- {
- arg_1A1_0 = (rp.wallStuff ?? BaseGenUtility.RandomCheapWallStuff(rp.faction, false));
- }
- ThingDef stuff2 = arg_1A1_0;
+ ThingDef stuff2 = thingDef2 ?? rp.wallStuff ?? BaseGenUtility.RandomCheapWallStuff(rp.faction, false);
Thing thing2 = ThingMaker.MakeThing(ThingDefOf.Door, stuff2);
thing2.SetFaction(rp.faction, null);
GenSpawn.Spawn(thing2, intVec2, map);
@@ -124,7 +110,19 @@ private bool CanTraverse(IntVec3 c, bool canPathThroughNonStandable)
{
Map map = BaseGen.globalSettings.map;
Building edifice = c.GetEdifice(map);
- return this.IsWallOrRock(edifice) || ((canPathThroughNonStandable || c.Standable(map)) && !c.Impassable(map));
+ if (this.IsWallOrRock(edifice))
+ {
+ return true;
+ }
+ if (!canPathThroughNonStandable && !c.Standable(map))
+ {
+ return false;
+ }
+ if (!c.Impassable(map))
+ {
+ return true;
+ }
+ return false;
}
private bool IsWallOrRock(Building b)
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ExtraDoor.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ExtraDoor.cs
index e5d239209..257eb8c1a 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ExtraDoor.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ExtraDoor.cs
@@ -17,7 +17,7 @@ public override void Resolve(ResolveParams rp)
{
for (int j = 0; j < 2; j++)
{
- IntVec3 intVec;
+ IntVec3 intVec = default(IntVec3);
if (this.TryFindRandomDoorSpawnCell(rp.rect, new Rot4(i), out intVec))
{
int distanceToExistingDoors = this.GetDistanceToExistingDoors(intVec, rp.rect);
@@ -26,9 +26,7 @@ public override void Resolve(ResolveParams rp)
loc = intVec;
num = distanceToExistingDoors;
if (num == 2147483647)
- {
break;
- }
}
}
}
@@ -45,9 +43,9 @@ public override void Resolve(ResolveParams rp)
private bool WallHasDoor(CellRect rect, Rot4 dir)
{
Map map = BaseGen.globalSettings.map;
- foreach (IntVec3 current in rect.GetEdgeCells(dir))
+ foreach (IntVec3 edgeCell in rect.GetEdgeCells(dir))
{
- if (current.GetDoor(map) != null)
+ if (edgeCell.GetDoor(map) != null)
{
return true;
}
@@ -65,12 +63,12 @@ private bool TryFindRandomDoorSpawnCell(CellRect rect, Rot4 dir, out IntVec3 fou
found = IntVec3.Invalid;
return false;
}
- int newX;
- if (!Rand.TryRangeInclusiveWhere(rect.minX + 1, rect.maxX - 1, delegate(int x)
+ int newX = default(int);
+ if (!Rand.TryRangeInclusiveWhere(rect.minX + 1, rect.maxX - 1, (Predicate)delegate(int x)
{
- IntVec3 c = new IntVec3(x, 0, rect.maxZ + 1);
- IntVec3 c2 = new IntVec3(x, 0, rect.maxZ - 1);
- return c.InBounds(map) && c.Standable(map) && c2.InBounds(map) && c2.Standable(map);
+ IntVec3 c7 = new IntVec3(x, 0, rect.maxZ + 1);
+ IntVec3 c8 = new IntVec3(x, 0, rect.maxZ - 1);
+ return c7.InBounds(map) && c7.Standable(map) && c8.InBounds(map) && c8.Standable(map);
}, out newX))
{
found = IntVec3.Invalid;
@@ -79,19 +77,19 @@ private bool TryFindRandomDoorSpawnCell(CellRect rect, Rot4 dir, out IntVec3 fou
found = new IntVec3(newX, 0, rect.maxZ);
return true;
}
- else if (dir == Rot4.South)
+ if (dir == Rot4.South)
{
if (rect.Width <= 2)
{
found = IntVec3.Invalid;
return false;
}
- int newX2;
- if (!Rand.TryRangeInclusiveWhere(rect.minX + 1, rect.maxX - 1, delegate(int x)
+ int newX2 = default(int);
+ if (!Rand.TryRangeInclusiveWhere(rect.minX + 1, rect.maxX - 1, (Predicate)delegate(int x)
{
- IntVec3 c = new IntVec3(x, 0, rect.minZ - 1);
- IntVec3 c2 = new IntVec3(x, 0, rect.minZ + 1);
- return c.InBounds(map) && c.Standable(map) && c2.InBounds(map) && c2.Standable(map);
+ IntVec3 c5 = new IntVec3(x, 0, rect.minZ - 1);
+ IntVec3 c6 = new IntVec3(x, 0, rect.minZ + 1);
+ return c5.InBounds(map) && c5.Standable(map) && c6.InBounds(map) && c6.Standable(map);
}, out newX2))
{
found = IntVec3.Invalid;
@@ -100,19 +98,19 @@ private bool TryFindRandomDoorSpawnCell(CellRect rect, Rot4 dir, out IntVec3 fou
found = new IntVec3(newX2, 0, rect.minZ);
return true;
}
- else if (dir == Rot4.West)
+ if (dir == Rot4.West)
{
if (rect.Height <= 2)
{
found = IntVec3.Invalid;
return false;
}
- int newZ;
- if (!Rand.TryRangeInclusiveWhere(rect.minZ + 1, rect.maxZ - 1, delegate(int z)
+ int newZ = default(int);
+ if (!Rand.TryRangeInclusiveWhere(rect.minZ + 1, rect.maxZ - 1, (Predicate)delegate(int z)
{
- IntVec3 c = new IntVec3(rect.minX - 1, 0, z);
- IntVec3 c2 = new IntVec3(rect.minX + 1, 0, z);
- return c.InBounds(map) && c.Standable(map) && c2.InBounds(map) && c2.Standable(map);
+ IntVec3 c3 = new IntVec3(rect.minX - 1, 0, z);
+ IntVec3 c4 = new IntVec3(rect.minX + 1, 0, z);
+ return c3.InBounds(map) && c3.Standable(map) && c4.InBounds(map) && c4.Standable(map);
}, out newZ))
{
found = IntVec3.Invalid;
@@ -121,35 +119,33 @@ private bool TryFindRandomDoorSpawnCell(CellRect rect, Rot4 dir, out IntVec3 fou
found = new IntVec3(rect.minX, 0, newZ);
return true;
}
- else
+ if (rect.Height <= 2)
{
- if (rect.Height <= 2)
- {
- found = IntVec3.Invalid;
- return false;
- }
- int newZ2;
- if (!Rand.TryRangeInclusiveWhere(rect.minZ + 1, rect.maxZ - 1, delegate(int z)
- {
- IntVec3 c = new IntVec3(rect.maxX + 1, 0, z);
- IntVec3 c2 = new IntVec3(rect.maxX - 1, 0, z);
- return c.InBounds(map) && c.Standable(map) && c2.InBounds(map) && c2.Standable(map);
- }, out newZ2))
- {
- found = IntVec3.Invalid;
- return false;
- }
- found = new IntVec3(rect.maxX, 0, newZ2);
- return true;
+ found = IntVec3.Invalid;
+ return false;
+ }
+ int newZ2 = default(int);
+ if (!Rand.TryRangeInclusiveWhere(rect.minZ + 1, rect.maxZ - 1, (Predicate)delegate(int z)
+ {
+ IntVec3 c = new IntVec3(rect.maxX + 1, 0, z);
+ IntVec3 c2 = new IntVec3(rect.maxX - 1, 0, z);
+ return c.InBounds(map) && c.Standable(map) && c2.InBounds(map) && c2.Standable(map);
+ }, out newZ2))
+ {
+ found = IntVec3.Invalid;
+ return false;
}
+ found = new IntVec3(rect.maxX, 0, newZ2);
+ return true;
}
private int GetDistanceToExistingDoors(IntVec3 cell, CellRect rect)
{
Map map = BaseGen.globalSettings.map;
int num = 2147483647;
- foreach (IntVec3 current in rect.EdgeCells)
+ foreach (IntVec3 edgeCell in rect.EdgeCells)
{
+ IntVec3 current = edgeCell;
if (current.GetDoor(map) != null)
{
num = Mathf.Min(num, Mathf.Abs(cell.x - current.x) + Mathf.Abs(cell.z - current.z));
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FactionBase.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FactionBase.cs
index 5d3d07205..47d1af4cd 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FactionBase.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FactionBase.cs
@@ -12,8 +12,7 @@ public class SymbolResolver_FactionBase : SymbolResolver
public override void Resolve(ResolveParams rp)
{
- SymbolResolver_FactionBase.c__AnonStorey300 c__AnonStorey = new SymbolResolver_FactionBase.c__AnonStorey300();
- c__AnonStorey.map = BaseGen.globalSettings.map;
+ Map map = BaseGen.globalSettings.map;
Faction faction = rp.faction ?? Find.FactionManager.RandomEnemyFaction(false, false, true);
int num = 0;
int? edgeDefenseWidth = rp.edgeDefenseWidth;
@@ -21,20 +20,21 @@ public override void Resolve(ResolveParams rp)
{
num = rp.edgeDefenseWidth.Value;
}
- else if (rp.rect.Width >= 20 && rp.rect.Height >= 20 && (faction.def.techLevel >= TechLevel.Industrial || Rand.Bool))
+ else if (rp.rect.Width >= 20 && rp.rect.Height >= 20 && ((int)faction.def.techLevel >= 4 || Rand.Bool))
{
num = ((!Rand.Bool) ? 4 : 2);
}
- float num2 = (float)rp.rect.Area / 144f * 0.17f;
- BaseGen.globalSettings.minEmptyNodes = ((num2 >= 1f) ? GenMath.RoundRandom(num2) : 0);
- Lord singlePawnLord = rp.singlePawnLord ?? LordMaker.MakeNewLord(faction, new LordJob_DefendBase(faction, rp.rect.CenterCell), c__AnonStorey.map, null);
+ float num2 = (float)((float)rp.rect.Area / 144.0 * 0.17000000178813934);
+ BaseGen.globalSettings.minEmptyNodes = ((!(num2 < 1.0)) ? GenMath.RoundRandom(num2) : 0);
+ Lord singlePawnLord = rp.singlePawnLord ?? LordMaker.MakeNewLord(faction, new LordJob_DefendBase(faction, rp.rect.CenterCell), map, null);
TraverseParms traverseParms = TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false);
ResolveParams resolveParams = rp;
resolveParams.rect = rp.rect;
resolveParams.faction = faction;
resolveParams.singlePawnLord = singlePawnLord;
resolveParams.pawnGroupKindDef = (rp.pawnGroupKindDef ?? PawnGroupKindDefOf.FactionBase);
- resolveParams.singlePawnSpawnCellExtraPredicate = (rp.singlePawnSpawnCellExtraPredicate ?? ((IntVec3 x) => c__AnonStorey.map.reachability.CanReachMapEdge(x, traverseParms)));
+ object obj = rp.singlePawnSpawnCellExtraPredicate;
+ obj = (resolveParams.singlePawnSpawnCellExtraPredicate = (Predicate)((IntVec3 x) => map.reachability.CanReachMapEdge(x, traverseParms)));
if (resolveParams.pawnGroupMakerParams == null)
{
float num3 = (!faction.def.techLevel.IsNeolithicOrWorse()) ? SymbolResolver_FactionBase.NonNeolithicPawnsPoints.RandomInRange : SymbolResolver_FactionBase.NeolithicPawnsPoints.RandomInRange;
@@ -44,16 +44,16 @@ public override void Resolve(ResolveParams rp)
num3 *= rp.factionBasePawnGroupPointsFactor.Value;
}
resolveParams.pawnGroupMakerParams = new PawnGroupMakerParms();
- resolveParams.pawnGroupMakerParams.tile = c__AnonStorey.map.Tile;
+ resolveParams.pawnGroupMakerParams.tile = map.Tile;
resolveParams.pawnGroupMakerParams.faction = faction;
resolveParams.pawnGroupMakerParams.points = num3;
resolveParams.pawnGroupMakerParams.inhabitants = true;
}
BaseGen.symbolStack.Push("pawnGroup", resolveParams);
- if (faction.def.techLevel >= TechLevel.Industrial)
+ if ((int)faction.def.techLevel >= 4)
{
- int num4 = (!Rand.Chance(0.75f)) ? 0 : GenMath.RoundRandom((float)rp.rect.Area / 400f);
- for (int i = 0; i < num4; i++)
+ int num4 = Rand.Chance(0.75f) ? GenMath.RoundRandom((float)((float)rp.rect.Area / 400.0)) : 0;
+ for (int num5 = 0; num5 < num4; num5++)
{
ResolveParams resolveParams2 = rp;
resolveParams2.faction = faction;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Farm.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Farm.cs
index ab92dc14b..a7ee3d4c7 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Farm.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Farm.cs
@@ -1,4 +1,3 @@
-using System;
using UnityEngine;
using Verse;
@@ -14,13 +13,12 @@ public override bool CanResolve(ResolveParams rp)
public override void Resolve(ResolveParams rp)
{
ThingDef thingDef = rp.cultivatedPlantDef ?? SymbolResolver_CultivatedPlants.DeterminePlantDef(rp.rect);
- bool flag = rp.rect.Width >= 7 && rp.rect.Height >= 7 && (rp.rect.Width > 12 || rp.rect.Height > 12 || Rand.Bool) && thingDef.plant.Harvestable;
- if (flag)
+ if (rp.rect.Width >= 7 && rp.rect.Height >= 7 && (rp.rect.Width > 12 || rp.rect.Height > 12 || Rand.Bool) && thingDef.plant.Harvestable)
{
CellRect rect = new CellRect(rp.rect.maxX - 3, rp.rect.maxZ - 3, 4, 4);
ThingDef harvestedThingDef = thingDef.plant.harvestedThingDef;
int num = Rand.RangeInclusive(2, 3);
- for (int i = 0; i < num; i++)
+ for (int num2 = 0; num2 < num; num2++)
{
ResolveParams resolveParams = rp;
resolveParams.rect = rect.ContractedBy(1);
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FillWithBeds.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FillWithBeds.cs
index 3d2c784ee..1371ff18c 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FillWithBeds.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FillWithBeds.cs
@@ -10,33 +10,29 @@ public override void Resolve(ResolveParams rp)
Map map = BaseGen.globalSettings.map;
bool @bool = Rand.Bool;
ThingDef thingDef = rp.singleThingDef ?? ((!Rand.Bool) ? ThingDefOf.SleepingSpot : ThingDefOf.Bed);
- foreach (IntVec3 current in rp.rect)
+ foreach (IntVec3 item in rp.rect)
{
+ IntVec3 current = item;
if (@bool)
{
- if (current.x % 3 != 0 || current.z % 2 != 0)
- {
- continue;
- }
- }
- else if (current.x % 2 != 0 || current.z % 3 != 0)
- {
- continue;
+ if (current.x % 3 == 0 && current.z % 2 == 0)
+ goto IL_00a1;
}
+ else if (current.x % 2 == 0 && current.z % 3 == 0)
+ goto IL_00a1;
+ continue;
+ IL_00a1:
Rot4 rot = (!@bool) ? Rot4.North : Rot4.West;
- if (!GenSpawn.WouldWipeAnythingWith(current, rot, thingDef, map, (Thing x) => x.def.category == ThingCategory.Building))
+ if (!GenSpawn.WouldWipeAnythingWith(current, rot, thingDef, map, (Predicate)((Thing x) => x.def.category == ThingCategory.Building)) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(GenAdj.OccupiedRect(current, rot, thingDef.Size), map))
{
- if (!BaseGenUtility.AnyDoorCardinalAdjacentTo(GenAdj.OccupiedRect(current, rot, thingDef.Size), map))
+ ThingDef stuff = null;
+ if (thingDef.MadeFromStuff)
{
- ThingDef stuff = null;
- if (thingDef.MadeFromStuff)
- {
- stuff = ThingDefOf.WoodLog;
- }
- Thing thing = ThingMaker.MakeThing(thingDef, stuff);
- thing.SetFaction(rp.faction, null);
- GenSpawn.Spawn(thing, current, map, rot, false);
+ stuff = ThingDefOf.WoodLog;
}
+ Thing thing = ThingMaker.MakeThing(thingDef, stuff);
+ thing.SetFaction(rp.faction, null);
+ GenSpawn.Spawn(thing, current, map, rot, false);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FillWithThings.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FillWithThings.cs
index 117bc574a..0ebf15dbb 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FillWithThings.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FillWithThings.cs
@@ -23,30 +23,28 @@ public override bool CanResolve(ResolveParams rp)
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)
+ if (rp.rect.Width >= size.x && rp.rect.Height >= size.z)
{
- return false;
+ goto IL_009d;
}
+ return false;
}
+ goto IL_009d;
+ IL_009d:
return true;
}
public override void Resolve(ResolveParams rp)
{
- ThingDef arg_3A_0;
- if ((arg_3A_0 = rp.singleThingDef) == null)
- {
- arg_3A_0 = (from x in ItemCollectionGeneratorUtility.allGeneratableItems
- where x.IsWeapon || x.IsMedicine || x.IsDrug
- select x).RandomElement();
- }
- ThingDef thingDef = arg_3A_0;
+ ThingDef thingDef = rp.singleThingDef ?? (from x in ItemCollectionGeneratorUtility.allGeneratableItems
+ where x.IsWeapon || x.IsMedicine || x.IsDrug
+ select x).RandomElement();
Rot4? thingRot = rp.thingRot;
Rot4 rot = (!thingRot.HasValue) ? Rot4.North : thingRot.Value;
IntVec3 zero = IntVec3.Zero;
IntVec2 size = thingDef.size;
int? fillWithThingsPadding = rp.fillWithThingsPadding;
- int num = (!fillWithThingsPadding.HasValue) ? 0 : fillWithThingsPadding.Value;
+ int num = fillWithThingsPadding.HasValue ? fillWithThingsPadding.Value : 0;
if (num < 0)
{
num = 0;
@@ -55,20 +53,22 @@ where x.IsWeapon || x.IsMedicine || x.IsDrug
if (size.x <= 0 || size.z <= 0)
{
Log.Error("Thing has 0 size.");
- return;
}
- for (int i = rp.rect.minX; i <= rp.rect.maxX - size.x + 1; i += size.x + num)
+ else
{
- for (int j = rp.rect.minZ; j <= rp.rect.maxZ - size.z + 1; j += size.z + num)
+ for (int num2 = rp.rect.minX; num2 <= rp.rect.maxX - size.x + 1; num2 += size.x + num)
{
- ResolveParams resolveParams = rp;
- resolveParams.rect = new CellRect(i, j, size.x, size.z);
- resolveParams.singleThingDef = thingDef;
- resolveParams.thingRot = new Rot4?(rot);
- BaseGen.symbolStack.Push("thing", resolveParams);
+ for (int num3 = rp.rect.minZ; num3 <= rp.rect.maxZ - size.z + 1; num3 += size.z + num)
+ {
+ ResolveParams resolveParams = rp;
+ resolveParams.rect = new CellRect(num2, num3, size.x, size.z);
+ resolveParams.singleThingDef = thingDef;
+ resolveParams.thingRot = new Rot4?(rot);
+ BaseGen.symbolStack.Push("thing", resolveParams);
+ }
}
+ BaseGen.symbolStack.Push("clear", rp);
}
- BaseGen.symbolStack.Push("clear", rp);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FirefoamPopper.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FirefoamPopper.cs
index af65000b6..f86be4a98 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FirefoamPopper.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FirefoamPopper.cs
@@ -7,38 +7,33 @@ public class SymbolResolver_FirefoamPopper : SymbolResolver
{
public override bool CanResolve(ResolveParams rp)
{
- IntVec3 intVec;
- return base.CanResolve(rp) && this.TryFindSpawnCell(rp.rect, out intVec);
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ IntVec3 intVec = default(IntVec3);
+ if (!this.TryFindSpawnCell(rp.rect, out intVec))
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
{
- IntVec3 loc;
- if (!this.TryFindSpawnCell(rp.rect, out loc))
+ IntVec3 loc = default(IntVec3);
+ if (this.TryFindSpawnCell(rp.rect, out loc))
{
- return;
+ Thing thing = ThingMaker.MakeThing(ThingDefOf.FirefoamPopper, null);
+ thing.SetFaction(rp.faction, null);
+ GenSpawn.Spawn(thing, loc, BaseGen.globalSettings.map);
}
- Thing thing = ThingMaker.MakeThing(ThingDefOf.FirefoamPopper, null);
- thing.SetFaction(rp.faction, null);
- GenSpawn.Spawn(thing, loc, BaseGen.globalSettings.map);
}
private bool TryFindSpawnCell(CellRect rect, out IntVec3 result)
{
Map map = BaseGen.globalSettings.map;
- return CellFinder.TryFindRandomCellInsideWith(rect, delegate(IntVec3 c)
- {
- bool arg_6C_0;
- if (c.Standable(map) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(c, map) && c.GetFirstItem(map) == null)
- {
- arg_6C_0 = !GenSpawn.WouldWipeAnythingWith(c, Rot4.North, ThingDefOf.FirefoamPopper, map, (Thing x) => x.def.category == ThingCategory.Building);
- }
- else
- {
- arg_6C_0 = false;
- }
- return arg_6C_0;
- }, out result);
+ return CellFinder.TryFindRandomCellInsideWith(rect, (Predicate)((IntVec3 c) => c.Standable(map) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(c, map) && c.GetFirstItem(map) == null && !GenSpawn.WouldWipeAnythingWith(c, Rot4.North, ThingDefOf.FirefoamPopper, map, (Predicate)((Thing x) => x.def.category == ThingCategory.Building))), out result);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FloorFill.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FloorFill.cs
index 5c2c24fdd..94f334c9c 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FloorFill.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_FloorFill.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Hives.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Hives.cs
index e274489e8..d1714075f 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Hives.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Hives.cs
@@ -10,32 +10,39 @@ public class SymbolResolver_Hives : SymbolResolver
public override bool CanResolve(ResolveParams rp)
{
- IntVec3 intVec;
- return base.CanResolve(rp) && this.TryFindFirstHivePos(rp.rect, out intVec);
- }
-
- public override void Resolve(ResolveParams rp)
- {
- IntVec3 loc;
- if (!this.TryFindFirstHivePos(rp.rect, out loc))
+ if (!base.CanResolve(rp))
{
- return;
+ return false;
}
- int? hivesCount = rp.hivesCount;
- int num = (!hivesCount.HasValue) ? SymbolResolver_Hives.DefaultHivesCountRange.RandomInRange : hivesCount.Value;
- Hive hive = (Hive)ThingMaker.MakeThing(ThingDefOf.Hive, null);
- hive.SetFaction(Faction.OfInsects, null);
- if (rp.disableHives.HasValue && rp.disableHives.Value)
+ IntVec3 intVec = default(IntVec3);
+ if (!this.TryFindFirstHivePos(rp.rect, out intVec))
{
- hive.active = false;
+ return false;
}
- hive = (Hive)GenSpawn.Spawn(hive, loc, BaseGen.globalSettings.map);
- for (int i = 0; i < num - 1; i++)
+ return true;
+ }
+
+ public override void Resolve(ResolveParams rp)
+ {
+ IntVec3 loc = default(IntVec3);
+ if (this.TryFindFirstHivePos(rp.rect, out loc))
{
- Hive hive2;
- if (hive.GetComp().TrySpawnChildHive(true, out hive2))
+ int? hivesCount = rp.hivesCount;
+ int num = (!hivesCount.HasValue) ? SymbolResolver_Hives.DefaultHivesCountRange.RandomInRange : hivesCount.Value;
+ Hive hive = (Hive)ThingMaker.MakeThing(ThingDefOf.Hive, null);
+ hive.SetFaction(Faction.OfInsects, null);
+ if (rp.disableHives.HasValue && rp.disableHives.Value)
+ {
+ hive.active = false;
+ }
+ hive = (Hive)GenSpawn.Spawn(hive, loc, BaseGen.globalSettings.map);
+ for (int i = 0; i < num - 1; i++)
{
- hive = hive2;
+ Hive hive2 = default(Hive);
+ if (hive.GetComp().TrySpawnChildHive(true, out hive2))
+ {
+ hive = hive2;
+ }
}
}
}
@@ -45,7 +52,7 @@ private bool TryFindFirstHivePos(CellRect rect, out IntVec3 pos)
Map map = BaseGen.globalSettings.map;
return (from mc in rect.Cells
where mc.Standable(map)
- select mc).TryRandomElement(out pos);
+ select mc).TryRandomElement(out pos);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_IndoorLighting.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_IndoorLighting.cs
index dc61c7926..623e22afc 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_IndoorLighting.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_IndoorLighting.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
@@ -10,19 +9,7 @@ public class SymbolResolver_IndoorLighting : SymbolResolver
public override void Resolve(ResolveParams rp)
{
Map map = BaseGen.globalSettings.map;
- ThingDef thingDef;
- if (rp.faction == null || rp.faction.def.techLevel >= TechLevel.Industrial)
- {
- thingDef = ThingDefOf.StandingLamp;
- }
- else if (map.mapTemperature.OutdoorTemp > 18f)
- {
- thingDef = null;
- }
- else
- {
- thingDef = ThingDefOf.TorchLamp;
- }
+ ThingDef thingDef = (rp.faction == null || (int)rp.faction.def.techLevel >= 4) ? ThingDefOf.StandingLamp : ((!(map.mapTemperature.OutdoorTemp > 18.0)) ? ThingDefOf.TorchLamp : null);
if (thingDef != null)
{
ResolveParams resolveParams = rp;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_AncientTemple.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_AncientTemple.cs
index ed51620e4..e64e18bd6 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_AncientTemple.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_AncientTemple.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
@@ -41,9 +40,9 @@ public override void Resolve(ResolveParams rp)
}
}
int? ancientTempleEntranceHeight = rp.ancientTempleEntranceHeight;
- int num = (!ancientTempleEntranceHeight.HasValue) ? 0 : ancientTempleEntranceHeight.Value;
+ int num = ancientTempleEntranceHeight.HasValue ? ancientTempleEntranceHeight.Value : 0;
ResolveParams resolveParams4 = rp;
- resolveParams4.rect.minZ = resolveParams4.rect.minZ + num;
+ resolveParams4.rect.minZ += num;
BaseGen.symbolStack.Push("ancientShrinesGroup", resolveParams4);
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Barracks.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Barracks.cs
index 2ed753ffa..efd02bc8a 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Barracks.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Barracks.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
@@ -16,27 +15,27 @@ public class SymbolResolver_Interior_Barracks : SymbolResolver
public override void Resolve(ResolveParams rp)
{
Map map = BaseGen.globalSettings.map;
- if (map.mapTemperature.OutdoorTemp > 22f)
+ if (map.mapTemperature.OutdoorTemp > 22.0)
{
ResolveParams resolveParams = rp;
resolveParams.singleThingDef = ThingDefOf.PassiveCooler;
BaseGen.symbolStack.Push("edgeThing", resolveParams);
}
bool flag = false;
- if (map.mapTemperature.OutdoorTemp < 3f)
+ if (map.mapTemperature.OutdoorTemp < 3.0)
{
ThingDef singleThingDef;
- if (rp.faction == null || rp.faction.def.techLevel >= TechLevel.Industrial)
+ if (rp.faction == null || (int)rp.faction.def.techLevel >= 4)
{
singleThingDef = ThingDefOf.Heater;
}
else
{
- singleThingDef = ((map.mapTemperature.OutdoorTemp >= -20f) ? ThingDefOf.TorchLamp : ThingDefOf.Campfire);
+ singleThingDef = ((!(map.mapTemperature.OutdoorTemp < -20.0)) ? ThingDefOf.TorchLamp : ThingDefOf.Campfire);
flag = true;
}
- int num = (map.mapTemperature.OutdoorTemp >= -45f) ? 1 : 2;
- for (int i = 0; i < num; i++)
+ int num = (!(map.mapTemperature.OutdoorTemp < -45.0)) ? 1 : 2;
+ for (int num2 = 0; num2 < num; num2++)
{
ResolveParams resolveParams2 = rp;
resolveParams2.singleThingDef = singleThingDef;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_BatteryRoom.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_BatteryRoom.cs
index 0de9042a1..ca8db4b45 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_BatteryRoom.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_BatteryRoom.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Brewery.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Brewery.cs
index b9ff52eba..e0b48d7e9 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Brewery.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Brewery.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
@@ -24,17 +23,9 @@ public override void Resolve(ResolveParams rp)
resolveParams.singleThingDef = ThingDefOf.PassiveCooler;
BaseGen.symbolStack.Push("edgeThing", resolveParams);
}
- if (map.mapTemperature.OutdoorTemp < 7f)
+ if (map.mapTemperature.OutdoorTemp < 7.0)
{
- ThingDef singleThingDef;
- if (rp.faction == null || rp.faction.def.techLevel >= TechLevel.Industrial)
- {
- singleThingDef = ThingDefOf.Heater;
- }
- else
- {
- singleThingDef = ThingDefOf.Campfire;
- }
+ ThingDef singleThingDef = (rp.faction != null && (int)rp.faction.def.techLevel < 4) ? ThingDefOf.Campfire : ThingDefOf.Heater;
ResolveParams resolveParams2 = rp;
resolveParams2.singleThingDef = singleThingDef;
BaseGen.symbolStack.Push("edgeThing", resolveParams2);
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_DiningRoom.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_DiningRoom.cs
index 648411ec4..409637d0d 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_DiningRoom.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_DiningRoom.cs
@@ -1,4 +1,3 @@
-using System;
using UnityEngine;
using Verse;
@@ -11,8 +10,8 @@ public override void Resolve(ResolveParams rp)
BaseGen.symbolStack.Push("indoorLighting", rp);
BaseGen.symbolStack.Push("randomlyPlaceMealsOnTables", rp);
BaseGen.symbolStack.Push("placeChairsNearTables", rp);
- int num = Mathf.Max(GenMath.RoundRandom((float)rp.rect.Area / 20f), 1);
- for (int i = 0; i < num; i++)
+ int num = Mathf.Max(GenMath.RoundRandom((float)((float)rp.rect.Area / 20.0)), 1);
+ for (int num2 = 0; num2 < num; num2++)
{
ResolveParams resolveParams = rp;
resolveParams.singleThingDef = ThingDefOf.TableShort;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Storage.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Storage.cs
index 6d9e8e571..f64a088b1 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Storage.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Interior_Storage.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
@@ -11,7 +10,7 @@ public override void Resolve(ResolveParams rp)
{
Map map = BaseGen.globalSettings.map;
BaseGen.symbolStack.Push("stockpile", rp);
- if (map.mapTemperature.OutdoorTemp > 15f)
+ if (map.mapTemperature.OutdoorTemp > 15.0)
{
ResolveParams resolveParams = rp;
resolveParams.singleThingDef = ThingDefOf.PassiveCooler;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ItemCollection.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ItemCollection.cs
index fd707dfe9..c6e03989d 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ItemCollection.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_ItemCollection.cs
@@ -12,17 +12,11 @@ public override void Resolve(ResolveParams rp)
Map map = BaseGen.globalSettings.map;
ItemCollectionGeneratorDef itemCollectionGeneratorDef = rp.itemCollectionGeneratorDef ?? ItemCollectionGeneratorDefOf.RandomGeneralGoods;
ItemCollectionGeneratorParams? itemCollectionGeneratorParams = rp.itemCollectionGeneratorParams;
- ItemCollectionGeneratorParams parms;
- if (itemCollectionGeneratorParams.HasValue)
+ ItemCollectionGeneratorParams parms = (!itemCollectionGeneratorParams.HasValue) ? new ItemCollectionGeneratorParams
{
- parms = rp.itemCollectionGeneratorParams.Value;
- }
- else
- {
- parms = default(ItemCollectionGeneratorParams);
- parms.count = rp.rect.Cells.Count((IntVec3 x) => x.Standable(map) && x.GetFirstItem(map) == null);
- parms.techLevel = TechLevel.Spacer;
- }
+ count = rp.rect.Cells.Count((Func)((IntVec3 x) => x.Standable(map) && x.GetFirstItem(map) == null)),
+ techLevel = TechLevel.Spacer
+ } : rp.itemCollectionGeneratorParams.Value;
List list = itemCollectionGeneratorDef.Worker.Generate(parms);
for (int i = 0; i < list.Count; i++)
{
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_MannedMortar.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_MannedMortar.cs
index e1cedb39d..075e09c04 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_MannedMortar.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_MannedMortar.cs
@@ -25,7 +25,11 @@ public override bool CanResolve(ResolveParams rp)
}
iterator.MoveNext();
}
- return num >= 2;
+ if (num < 2)
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
@@ -34,46 +38,40 @@ public override void Resolve(ResolveParams rp)
Faction faction = rp.faction ?? Find.FactionManager.RandomEnemyFaction(false, false, true);
Rot4? thingRot = rp.thingRot;
Rot4 rot = (!thingRot.HasValue) ? Rot4.Random : thingRot.Value;
- ThingDef arg_88_0;
- if ((arg_88_0 = rp.mortarDef) == null)
- {
- arg_88_0 = (from x in DefDatabase.AllDefsListForReading
- where x.category == ThingCategory.Building && x.building.IsMortar && x != ThingDefOf.Turret_MortarEMP
- select x).RandomElement();
- }
- ThingDef thingDef = arg_88_0;
- IntVec3 intVec;
- if (!this.TryFindMortarSpawnCell(rp.rect, rot, thingDef, out intVec))
- {
- return;
- }
- if (thingDef.HasComp(typeof(CompMannable)))
+ ThingDef thingDef = rp.mortarDef ?? (from x in DefDatabase.AllDefsListForReading
+ where x.category == ThingCategory.Building && x.building.IsMortar && x != ThingDefOf.Turret_MortarEMP
+ select x).RandomElement();
+ IntVec3 intVec = default(IntVec3);
+ if (this.TryFindMortarSpawnCell(rp.rect, rot, thingDef, out intVec))
{
- IntVec3 c = Thing.InteractionCellWhenAt(thingDef, intVec, rot, map);
- Lord singlePawnLord = LordMaker.MakeNewLord(faction, new LordJob_ManTurrets(), map, null);
- int tile = map.Tile;
- PawnGenerationRequest value = new PawnGenerationRequest(faction.RandomPawnKind(), faction, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, true, 1f, false, true, true, true, false, null, null, null, null, null, null);
- ResolveParams resolveParams = rp;
- resolveParams.faction = faction;
- resolveParams.singlePawnGenerationRequest = new PawnGenerationRequest?(value);
- resolveParams.rect = CellRect.SingleCell(c);
- resolveParams.singlePawnLord = singlePawnLord;
- BaseGen.symbolStack.Push("pawn", resolveParams);
- }
- if (thingDef.building.turretShellDef != null)
- {
- ResolveParams resolveParams2 = rp;
- resolveParams2.faction = faction;
- resolveParams2.singleThingDef = thingDef.building.turretShellDef;
- resolveParams2.singleThingStackCount = new int?(Rand.RangeInclusive(5, Mathf.Min(8, thingDef.building.turretShellDef.stackLimit)));
- BaseGen.symbolStack.Push("thing", resolveParams2);
+ if (thingDef.HasComp(typeof(CompMannable)))
+ {
+ IntVec3 c = Thing.InteractionCellWhenAt(thingDef, intVec, rot, map);
+ Lord singlePawnLord = LordMaker.MakeNewLord(faction, new LordJob_ManTurrets(), map, null);
+ int tile = map.Tile;
+ PawnGenerationRequest value = new PawnGenerationRequest(faction.RandomPawnKind(), faction, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, true, 1f, false, true, true, true, false, null, default(float?), default(float?), default(Gender?), default(float?), (string)null);
+ ResolveParams resolveParams = rp;
+ resolveParams.faction = faction;
+ resolveParams.singlePawnGenerationRequest = new PawnGenerationRequest?(value);
+ resolveParams.rect = CellRect.SingleCell(c);
+ resolveParams.singlePawnLord = singlePawnLord;
+ BaseGen.symbolStack.Push("pawn", resolveParams);
+ }
+ if (thingDef.building.turretShellDef != null)
+ {
+ ResolveParams resolveParams2 = rp;
+ resolveParams2.faction = faction;
+ resolveParams2.singleThingDef = thingDef.building.turretShellDef;
+ resolveParams2.singleThingStackCount = new int?(Rand.RangeInclusive(5, Mathf.Min(8, thingDef.building.turretShellDef.stackLimit)));
+ BaseGen.symbolStack.Push("thing", resolveParams2);
+ }
+ ResolveParams resolveParams3 = rp;
+ resolveParams3.faction = faction;
+ resolveParams3.singleThingDef = thingDef;
+ resolveParams3.rect = CellRect.SingleCell(intVec);
+ resolveParams3.thingRot = new Rot4?(rot);
+ BaseGen.symbolStack.Push("thing", resolveParams3);
}
- ResolveParams resolveParams3 = rp;
- resolveParams3.faction = faction;
- resolveParams3.singleThingDef = thingDef;
- resolveParams3.rect = CellRect.SingleCell(intVec);
- resolveParams3.thingRot = new Rot4?(rot);
- BaseGen.symbolStack.Push("thing", resolveParams3);
}
private bool TryFindMortarSpawnCell(CellRect rect, Rot4 rot, ThingDef mortarDef, out IntVec3 cell)
@@ -82,24 +80,32 @@ private bool TryFindMortarSpawnCell(CellRect rect, Rot4 rot, ThingDef mortarDef,
Predicate edgeTouchCheck;
if (rot == Rot4.North)
{
- edgeTouchCheck = ((CellRect x) => x.Cells.Any((IntVec3 y) => y.z == rect.maxZ));
+ CellRect rect5;
+ edgeTouchCheck = (Predicate)((CellRect x) => x.Cells.Any((Func)((IntVec3 y) => y.z == rect5.maxZ)));
}
else if (rot == Rot4.South)
{
- edgeTouchCheck = ((CellRect x) => x.Cells.Any((IntVec3 y) => y.z == rect.minZ));
+ CellRect rect4;
+ edgeTouchCheck = (Predicate)((CellRect x) => x.Cells.Any((Func)((IntVec3 y) => y.z == rect4.minZ)));
}
else if (rot == Rot4.West)
{
- edgeTouchCheck = ((CellRect x) => x.Cells.Any((IntVec3 y) => y.x == rect.minX));
+ CellRect rect3;
+ edgeTouchCheck = (Predicate)((CellRect x) => x.Cells.Any((Func)((IntVec3 y) => y.x == rect3.minX)));
}
else
{
- edgeTouchCheck = ((CellRect x) => x.Cells.Any((IntVec3 y) => y.x == rect.maxX));
+ CellRect rect2;
+ edgeTouchCheck = (Predicate)((CellRect x) => x.Cells.Any((Func)((IntVec3 y) => y.x == rect2.maxX)));
}
- return CellFinder.TryFindRandomCellInsideWith(rect, delegate(IntVec3 x)
+ return CellFinder.TryFindRandomCellInsideWith(rect, (Predicate)delegate(IntVec3 x)
{
CellRect obj = GenAdj.OccupiedRect(x, rot, mortarDef.size);
- return Thing.InteractionCellWhenAt(mortarDef, x, rot, map).Standable(map) && obj.FullyContainedWithin(rect) && edgeTouchCheck(obj);
+ if (!Thing.InteractionCellWhenAt(mortarDef, x, rot, map).Standable(map))
+ {
+ return false;
+ }
+ return obj.FullyContainedWithin(rect) && edgeTouchCheck(obj);
}, out cell);
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_OutdoorsCampfire.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_OutdoorsCampfire.cs
index d2f97fb91..5b0d959d5 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_OutdoorsCampfire.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_OutdoorsCampfire.cs
@@ -7,38 +7,33 @@ public class SymbolResolver_OutdoorsCampfire : SymbolResolver
{
public override bool CanResolve(ResolveParams rp)
{
- IntVec3 intVec;
- return base.CanResolve(rp) && this.TryFindSpawnCell(rp.rect, out intVec);
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ IntVec3 intVec = default(IntVec3);
+ if (!this.TryFindSpawnCell(rp.rect, out intVec))
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
{
- IntVec3 loc;
- if (!this.TryFindSpawnCell(rp.rect, out loc))
+ IntVec3 loc = default(IntVec3);
+ if (this.TryFindSpawnCell(rp.rect, out loc))
{
- return;
+ Thing thing = ThingMaker.MakeThing(ThingDefOf.Campfire, null);
+ thing.SetFaction(rp.faction, null);
+ GenSpawn.Spawn(thing, loc, BaseGen.globalSettings.map);
}
- Thing thing = ThingMaker.MakeThing(ThingDefOf.Campfire, null);
- thing.SetFaction(rp.faction, null);
- GenSpawn.Spawn(thing, loc, BaseGen.globalSettings.map);
}
private bool TryFindSpawnCell(CellRect rect, out IntVec3 result)
{
Map map = BaseGen.globalSettings.map;
- return CellFinder.TryFindRandomCellInsideWith(rect, delegate(IntVec3 c)
- {
- bool arg_7D_0;
- if (c.Standable(map) && !c.Roofed(map) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(c, map) && c.GetFirstItem(map) == null)
- {
- arg_7D_0 = !GenSpawn.WouldWipeAnythingWith(c, Rot4.North, ThingDefOf.Campfire, map, (Thing x) => x.def.category == ThingCategory.Building);
- }
- else
- {
- arg_7D_0 = false;
- }
- return arg_7D_0;
- }, out result);
+ return CellFinder.TryFindRandomCellInsideWith(rect, (Predicate)((IntVec3 c) => c.Standable(map) && !c.Roofed(map) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(c, map) && c.GetFirstItem(map) == null && !GenSpawn.WouldWipeAnythingWith(c, Rot4.North, ThingDefOf.Campfire, map, (Predicate)((Thing x) => x.def.category == ThingCategory.Building))), out result);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_PawnGroup.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_PawnGroup.cs
index 4af5d30cd..76d56d0b7 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_PawnGroup.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_PawnGroup.cs
@@ -14,9 +14,13 @@ public override bool CanResolve(ResolveParams rp)
{
return false;
}
- return (from x in rp.rect.Cells
+ if (!(from x in rp.rect.Cells
where x.Standable(BaseGen.globalSettings.map)
- select x).Any();
+ select x).Any())
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
@@ -31,10 +35,10 @@ public override void Resolve(ResolveParams rp)
pawnGroupMakerParms.points = 250f;
}
PawnGroupKindDef groupKind = rp.pawnGroupKindDef ?? PawnGroupKindDefOf.Normal;
- foreach (Pawn current in PawnGroupMakerUtility.GeneratePawns(groupKind, pawnGroupMakerParms, true))
+ foreach (Pawn item in PawnGroupMakerUtility.GeneratePawns(groupKind, pawnGroupMakerParms, true))
{
ResolveParams resolveParams = rp;
- resolveParams.singlePawnToSpawn = current;
+ resolveParams.singlePawnToSpawn = item;
BaseGen.symbolStack.Push("pawn", resolveParams);
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_PlaceChairsNearTables.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_PlaceChairsNearTables.cs
index 61a8a553f..64004fd60 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_PlaceChairsNearTables.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_PlaceChairsNearTables.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
@@ -29,40 +28,19 @@ public override void Resolve(ResolveParams rp)
{
CellRect cellRect = SymbolResolver_PlaceChairsNearTables.tables[j].OccupiedRect().ExpandedBy(1);
bool flag = false;
- foreach (IntVec3 current in cellRect.EdgeCells.InRandomOrder(null))
+ foreach (IntVec3 item in cellRect.EdgeCells.InRandomOrder(null))
{
- if (!cellRect.IsCorner(current) && rp.rect.Contains(current))
+ IntVec3 current = item;
+ if (!cellRect.IsCorner(current) && rp.rect.Contains(current) && current.Standable(map) && current.GetEdifice(map) == null && (!flag || !Rand.Bool))
{
- if (current.Standable(map) && current.GetEdifice(map) == null)
- {
- if (!flag || !Rand.Bool)
- {
- Rot4 value;
- if (current.x == cellRect.minX)
- {
- value = Rot4.East;
- }
- else if (current.x == cellRect.maxX)
- {
- value = Rot4.West;
- }
- else if (current.z == cellRect.minZ)
- {
- value = Rot4.North;
- }
- else
- {
- value = Rot4.South;
- }
- ResolveParams resolveParams = rp;
- resolveParams.rect = CellRect.SingleCell(current);
- resolveParams.singleThingDef = ThingDefOf.DiningChair;
- resolveParams.singleThingStuff = (rp.singleThingStuff ?? ThingDefOf.WoodLog);
- resolveParams.thingRot = new Rot4?(value);
- BaseGen.symbolStack.Push("thing", resolveParams);
- flag = true;
- }
- }
+ Rot4 value = (current.x != cellRect.minX) ? ((current.x != cellRect.maxX) ? ((current.z != cellRect.minZ) ? Rot4.South : Rot4.North) : Rot4.West) : Rot4.East;
+ ResolveParams resolveParams = rp;
+ resolveParams.rect = CellRect.SingleCell(current);
+ resolveParams.singleThingDef = ThingDefOf.DiningChair;
+ resolveParams.singleThingStuff = (rp.singleThingStuff ?? ThingDefOf.WoodLog);
+ resolveParams.thingRot = new Rot4?(value);
+ BaseGen.symbolStack.Push("thing", resolveParams);
+ flag = true;
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_RandomMechanoidGroup.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_RandomMechanoidGroup.cs
index f7fa3bfbf..6c18bb73b 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_RandomMechanoidGroup.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_RandomMechanoidGroup.cs
@@ -17,28 +17,20 @@ public override void Resolve(ResolveParams rp)
if (lord == null && num > 0)
{
Map map = BaseGen.globalSettings.map;
- IntVec3 point;
- LordJob lordJob;
- if (Rand.Bool && (from x in rp.rect.Cells
+ IntVec3 point = default(IntVec3);
+ LordJob lordJob = (LordJob)((!Rand.Bool || !(from x in rp.rect.Cells
where !x.Impassable(map)
- select x).TryRandomElement(out point))
- {
- lordJob = new LordJob_DefendPoint(point);
- }
- else
- {
- lordJob = new LordJob_AssaultColony(Faction.OfMechanoids, false, false, false, false, false);
- }
+ select x).TryRandomElement(out point)) ? ((object)new LordJob_AssaultColony(Faction.OfMechanoids, false, false, false, false, false)) : ((object)new LordJob_DefendPoint(point)));
lord = LordMaker.MakeNewLord(Faction.OfMechanoids, lordJob, map, null);
}
- for (int i = 0; i < num; i++)
+ for (int num2 = 0; num2 < num; num2++)
{
PawnKindDef pawnKindDef = rp.singlePawnKindDef;
if (pawnKindDef == null)
{
pawnKindDef = (from kind in DefDatabase.AllDefsListForReading
where kind.RaceProps.IsMechanoid
- select kind).RandomElementByWeight((PawnKindDef kind) => 1f / kind.combatPower);
+ select kind).RandomElementByWeight((Func)((PawnKindDef kind) => (float)(1.0 / kind.combatPower)));
}
ResolveParams resolveParams = rp;
resolveParams.singlePawnKindDef = pawnKindDef;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_RandomlyPlaceMealsOnTables.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_RandomlyPlaceMealsOnTables.cs
index f33b33fc2..e266dc361 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_RandomlyPlaceMealsOnTables.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_RandomlyPlaceMealsOnTables.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Refuel.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Refuel.cs
index 19ca50e46..e91583aeb 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Refuel.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Refuel.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
@@ -29,7 +28,7 @@ public override void Resolve(ResolveParams rp)
for (int j = 0; j < SymbolResolver_Refuel.refuelables.Count; j++)
{
float fuelCapacity = SymbolResolver_Refuel.refuelables[j].Props.fuelCapacity;
- float amount = Rand.Range(fuelCapacity / 2f, fuelCapacity);
+ float amount = Rand.Range((float)(fuelCapacity / 2.0), fuelCapacity);
SymbolResolver_Refuel.refuelables[j].Refuel(amount);
}
SymbolResolver_Refuel.refuelables.Clear();
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Roof.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Roof.cs
index e13380ede..dda8a85c2 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Roof.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Roof.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.BaseGen
@@ -8,9 +7,7 @@ public class SymbolResolver_Roof : SymbolResolver
public override void Resolve(ResolveParams rp)
{
if (rp.noRoof.HasValue && rp.noRoof.Value)
- {
return;
- }
RoofGrid roofGrid = BaseGen.globalSettings.map.roofGrid;
RoofDef def = rp.roofDef ?? RoofDefOf.RoofConstructed;
CellRect.CellRectIterator iterator = rp.rect.GetIterator();
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_SinglePawn.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_SinglePawn.cs
index a37fc8c5c..b4f4cce51 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_SinglePawn.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_SinglePawn.cs
@@ -9,86 +9,89 @@ public class SymbolResolver_SinglePawn : SymbolResolver
{
public override bool CanResolve(ResolveParams rp)
{
- IntVec3 intVec;
- return base.CanResolve(rp) && ((rp.singlePawnToSpawn != null && rp.singlePawnToSpawn.Spawned) || SymbolResolver_SinglePawn.TryFindSpawnCell(rp, out intVec));
+ if (!base.CanResolve(rp))
+ {
+ return false;
+ }
+ if (rp.singlePawnToSpawn != null && rp.singlePawnToSpawn.Spawned)
+ {
+ return true;
+ }
+ IntVec3 intVec = default(IntVec3);
+ if (!SymbolResolver_SinglePawn.TryFindSpawnCell(rp, out intVec))
+ {
+ return false;
+ }
+ return true;
}
public override void Resolve(ResolveParams rp)
{
if (rp.singlePawnToSpawn != null && rp.singlePawnToSpawn.Spawned)
- {
return;
- }
Map map = BaseGen.globalSettings.map;
- IntVec3 loc;
+ IntVec3 loc = default(IntVec3);
if (!SymbolResolver_SinglePawn.TryFindSpawnCell(rp, out loc))
{
if (rp.singlePawnToSpawn != null)
{
Find.WorldPawns.PassToWorld(rp.singlePawnToSpawn, PawnDiscardDecideMode.Discard);
}
- return;
}
- Pawn pawn;
- if (rp.singlePawnToSpawn == null)
+ else
{
- PawnGenerationRequest value;
- if (rp.singlePawnGenerationRequest.HasValue)
- {
- value = rp.singlePawnGenerationRequest.Value;
- }
- else
+ Pawn pawn;
+ if (rp.singlePawnToSpawn == null)
{
- PawnKindDef arg_BE_0;
- if ((arg_BE_0 = rp.singlePawnKindDef) == null)
+ PawnGenerationRequest request = default(PawnGenerationRequest);
+ if (rp.singlePawnGenerationRequest.HasValue)
{
- arg_BE_0 = (from x in DefDatabase.AllDefsListForReading
- where x.defaultFactionType == null || !x.defaultFactionType.isPlayer
- select x).RandomElement();
+ request = rp.singlePawnGenerationRequest.Value;
}
- PawnKindDef pawnKindDef = arg_BE_0;
- Faction faction = rp.faction;
- if (faction == null && pawnKindDef.RaceProps.Humanlike)
+ else
{
- if (pawnKindDef.defaultFactionType != null)
+ PawnKindDef pawnKindDef = rp.singlePawnKindDef ?? (from x in DefDatabase.AllDefsListForReading
+ where x.defaultFactionType == null || !x.defaultFactionType.isPlayer
+ select x).RandomElement();
+ Faction faction = rp.faction;
+ if (faction == null && pawnKindDef.RaceProps.Humanlike)
{
- faction = FactionUtility.DefaultFactionFrom(pawnKindDef.defaultFactionType);
- if (faction == null)
+ if (pawnKindDef.defaultFactionType != null)
{
- return;
+ faction = FactionUtility.DefaultFactionFrom(pawnKindDef.defaultFactionType);
+ if (faction == null)
+ return;
}
+ else if (!(from x in Find.FactionManager.AllFactions
+ where !x.IsPlayer
+ select x).TryRandomElement(out faction))
+ return;
}
- else if (!(from x in Find.FactionManager.AllFactions
- where !x.IsPlayer
- select x).TryRandomElement(out faction))
- {
- return;
- }
+ int tile = map.Tile;
+ request = new PawnGenerationRequest(pawnKindDef, faction, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, false, 1f, false, true, true, false, false, null, default(float?), default(float?), default(Gender?), default(float?), (string)null);
}
- int tile = map.Tile;
- value = new PawnGenerationRequest(pawnKindDef, faction, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, false, 1f, false, true, true, false, false, null, null, null, null, null, null);
+ pawn = PawnGenerator.GeneratePawn(request);
+ }
+ else
+ {
+ pawn = rp.singlePawnToSpawn;
+ }
+ if (!pawn.Dead && rp.disableSinglePawn.HasValue && rp.disableSinglePawn.Value)
+ {
+ pawn.mindState.Active = false;
+ }
+ GenSpawn.Spawn(pawn, loc, map);
+ if (rp.singlePawnLord != null)
+ {
+ rp.singlePawnLord.AddPawn(pawn);
}
- pawn = PawnGenerator.GeneratePawn(value);
- }
- else
- {
- pawn = rp.singlePawnToSpawn;
- }
- if (!pawn.Dead && rp.disableSinglePawn.HasValue && rp.disableSinglePawn.Value)
- {
- pawn.mindState.Active = false;
- }
- GenSpawn.Spawn(pawn, loc, map);
- if (rp.singlePawnLord != null)
- {
- rp.singlePawnLord.AddPawn(pawn);
}
}
public static bool TryFindSpawnCell(ResolveParams rp, out IntVec3 cell)
{
Map map = BaseGen.globalSettings.map;
- return CellFinder.TryFindRandomCellInsideWith(rp.rect, (IntVec3 x) => x.Standable(map) && (rp.singlePawnSpawnCellExtraPredicate == null || rp.singlePawnSpawnCellExtraPredicate(x)), out cell);
+ return CellFinder.TryFindRandomCellInsideWith(rp.rect, (Predicate)((IntVec3 x) => x.Standable(map) && ((object)rp.singlePawnSpawnCellExtraPredicate == null || rp.singlePawnSpawnCellExtraPredicate(x))), out cell);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_SingleThing.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_SingleThing.cs
index 7c0cbf958..e9574f5aa 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_SingleThing.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_SingleThing.cs
@@ -16,7 +16,7 @@ public override bool CanResolve(ResolveParams rp)
{
return true;
}
- IntVec3 intVec;
+ IntVec3 intVec = default(IntVec3);
if (rp.singleThingToSpawn is Pawn)
{
ResolveParams rp2 = rp;
@@ -26,7 +26,21 @@ public override bool CanResolve(ResolveParams rp)
return false;
}
}
- return ((rp.singleThingDef == null || rp.singleThingDef.category != ThingCategory.Item) && (rp.singleThingToSpawn == null || rp.singleThingToSpawn.def.category != ThingCategory.Item)) || this.TryFindSpawnCellForItem(rp.rect, out intVec);
+ if (rp.singleThingDef != null && rp.singleThingDef.category == ThingCategory.Item)
+ {
+ goto IL_00a3;
+ }
+ if (rp.singleThingToSpawn != null && rp.singleThingToSpawn.def.category == ThingCategory.Item)
+ goto IL_00a3;
+ goto IL_00b9;
+ IL_00b9:
+ return true;
+ IL_00a3:
+ if (!this.TryFindSpawnCellForItem(rp.rect, out intVec))
+ {
+ return false;
+ }
+ goto IL_00b9;
}
public override void Resolve(ResolveParams rp)
@@ -36,87 +50,74 @@ public override void Resolve(ResolveParams rp)
ResolveParams resolveParams = rp;
resolveParams.singlePawnToSpawn = (Pawn)rp.singleThingToSpawn;
BaseGen.symbolStack.Push("pawn", resolveParams);
- return;
}
- if (rp.singleThingToSpawn != null && rp.singleThingToSpawn.Spawned)
- {
- return;
- }
- ThingDef thingDef;
- if (rp.singleThingToSpawn == null)
+ else
{
- ThingDef arg_9B_0;
- if ((arg_9B_0 = rp.singleThingDef) == null)
+ 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? thingRot = rp.thingRot;
+ Rot4 rot = (!thingRot.HasValue) ? Rot4.North : thingRot.Value;
+ if (!thingDef.rotatable)
{
- arg_9B_0 = (from x in ItemCollectionGeneratorUtility.allGeneratableItems
- where x.IsWeapon || x.IsMedicine || x.IsDrug
- select x).RandomElement();
+ rot = Rot4.North;
}
- thingDef = arg_9B_0;
- }
- else
- {
- thingDef = rp.singleThingToSpawn.def;
- }
- Rot4? thingRot = rp.thingRot;
- Rot4 rot = (!thingRot.HasValue) ? Rot4.North : thingRot.Value;
- if (!thingDef.rotatable)
- {
- rot = Rot4.North;
- }
- IntVec3 loc;
- if (thingDef.category == ThingCategory.Item)
- {
- if (!this.TryFindSpawnCellForItem(rp.rect, out loc))
+ IntVec3 loc = default(IntVec3);
+ if (thingDef.category == ThingCategory.Item)
{
- if (rp.singleThingToSpawn != null)
+ if (!this.TryFindSpawnCellForItem(rp.rect, out loc))
{
- rp.singleThingToSpawn.Destroy(DestroyMode.Vanish);
+ if (rp.singleThingToSpawn != null)
+ {
+ rp.singleThingToSpawn.Destroy(DestroyMode.Vanish);
+ }
+ return;
}
- return;
}
- }
- else
- {
- loc = this.FindBestSpawnCellForNonItem(rp.rect, thingDef, rot);
- }
- Thing thing;
- if (rp.singleThingToSpawn == null)
- {
- ThingDef stuff = rp.singleThingStuff ?? GenStuff.DefaultStuffFor(thingDef);
- thing = ThingMaker.MakeThing(thingDef, stuff);
- Thing arg_185_0 = thing;
- int? singleThingStackCount = rp.singleThingStackCount;
- arg_185_0.stackCount = ((!singleThingStackCount.HasValue) ? 1 : singleThingStackCount.Value);
- if (thing.stackCount <= 0)
+ else
{
- thing.stackCount = 1;
+ loc = this.FindBestSpawnCellForNonItem(rp.rect, thingDef, rot);
}
- if (thing.def.CanHaveFaction && thing.Faction != rp.faction)
+ Thing thing;
+ if (rp.singleThingToSpawn == null)
{
- thing.SetFaction(rp.faction, null);
+ ThingDef stuff = rp.singleThingStuff ?? GenStuff.DefaultStuffFor(thingDef);
+ thing = ThingMaker.MakeThing(thingDef, stuff);
+ Thing obj = thing;
+ int? singleThingStackCount = rp.singleThingStackCount;
+ obj.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();
+ if (compQuality != null)
+ {
+ compQuality.SetQuality(QualityUtility.RandomBaseGenItemQuality(), ArtGenerationContext.Outsider);
+ }
}
- CompQuality compQuality = thing.TryGetComp();
- if (compQuality != null)
+ else
{
- compQuality.SetQuality(QualityUtility.RandomBaseGenItemQuality(), ArtGenerationContext.Outsider);
+ thing = rp.singleThingToSpawn;
+ }
+ thing = GenSpawn.Spawn(thing, loc, BaseGen.globalSettings.map, rot, false);
+ if (thing != null && thing.def.category == ThingCategory.Item)
+ {
+ thing.SetForbidden(true, false);
}
- }
- else
- {
- thing = rp.singleThingToSpawn;
- }
- thing = GenSpawn.Spawn(thing, loc, BaseGen.globalSettings.map, rot, false);
- if (thing != null && thing.def.category == ThingCategory.Item)
- {
- thing.SetForbidden(true, false);
}
}
private bool TryFindSpawnCellForItem(CellRect rect, out IntVec3 result)
{
Map map = BaseGen.globalSettings.map;
- return CellFinder.TryFindRandomCellInsideWith(rect, delegate(IntVec3 c)
+ return CellFinder.TryFindRandomCellInsideWith(rect, (Predicate)delegate(IntVec3 c)
{
if (c.GetFirstItem(map) != null)
{
@@ -139,40 +140,36 @@ private IntVec3 FindBestSpawnCellForNonItem(CellRect rect, ThingDef thingDef, Ro
Map map = BaseGen.globalSettings.map;
if (thingDef.category == ThingCategory.Building)
{
- foreach (IntVec3 current in rect.Cells.InRandomOrder(null))
+ foreach (IntVec3 item in rect.Cells.InRandomOrder(null))
{
- CellRect rect2 = GenAdj.OccupiedRect(current, rot, thingDef.size);
+ CellRect rect2 = GenAdj.OccupiedRect(item, rot, thingDef.size);
if (rect2.FullyContainedWithin(rect) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(rect2, map) && !this.AnyNonStandableCellOrAnyBuildingInside(rect2) && GenConstruct.TerrainCanSupport(rect2, map, thingDef))
{
- IntVec3 result = current;
- return result;
+ return item;
}
}
- foreach (IntVec3 current2 in rect.Cells.InRandomOrder(null))
+ foreach (IntVec3 item2 in rect.Cells.InRandomOrder(null))
{
- CellRect rect3 = GenAdj.OccupiedRect(current2, rot, thingDef.size);
+ CellRect rect3 = GenAdj.OccupiedRect(item2, rot, thingDef.size);
if (rect3.FullyContainedWithin(rect) && !BaseGenUtility.AnyDoorCardinalAdjacentTo(rect3, map) && !this.AnyNonStandableCellOrAnyBuildingInside(rect3))
{
- IntVec3 result = current2;
- return result;
+ return item2;
}
}
}
- foreach (IntVec3 current3 in rect.Cells.InRandomOrder(null))
+ foreach (IntVec3 item3 in rect.Cells.InRandomOrder(null))
{
- CellRect rect4 = GenAdj.OccupiedRect(current3, rot, thingDef.size);
+ CellRect rect4 = GenAdj.OccupiedRect(item3, rot, thingDef.size);
if (rect4.FullyContainedWithin(rect) && !this.AnyNonStandableCellOrAnyBuildingInside(rect4))
{
- IntVec3 result = current3;
- return result;
+ return item3;
}
}
- foreach (IntVec3 current4 in rect.Cells.InRandomOrder(null))
+ foreach (IntVec3 item4 in rect.Cells.InRandomOrder(null))
{
- if (GenAdj.OccupiedRect(current4, rot, thingDef.size).FullyContainedWithin(rect))
+ if (GenAdj.OccupiedRect(item4, rot, thingDef.size).FullyContainedWithin(rect))
{
- IntVec3 result = current4;
- return result;
+ return item4;
}
}
IntVec3 centerCell = rect.CenterCell;
@@ -185,13 +182,23 @@ private IntVec3 FindBestSpawnCellForNonItem(CellRect rect, ThingDef thingDef, Ro
{
centerCell.z += -cellRect.minZ;
}
- if (cellRect.maxX >= map.Size.x)
+ int maxX = cellRect.maxX;
+ IntVec3 size = map.Size;
+ if (maxX >= size.x)
{
- centerCell.x -= cellRect.maxX - map.Size.x + 1;
+ int x = centerCell.x;
+ int maxX2 = cellRect.maxX;
+ IntVec3 size2 = map.Size;
+ centerCell.x = x - (maxX2 - size2.x + 1);
}
- if (cellRect.maxZ >= map.Size.z)
+ int maxZ = cellRect.maxZ;
+ IntVec3 size3 = map.Size;
+ if (maxZ >= size3.z)
{
- centerCell.z -= cellRect.maxZ - map.Size.z + 1;
+ int z = centerCell.z;
+ int maxZ2 = cellRect.maxZ;
+ IntVec3 size4 = map.Size;
+ centerCell.z = z - (maxZ2 - size4.z + 1);
}
return centerCell;
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Stockpile.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Stockpile.cs
index 0e8e05a17..8ae50a4f9 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Stockpile.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Stockpile.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@@ -15,31 +14,29 @@ public class SymbolResolver_Stockpile : SymbolResolver
public override void Resolve(ResolveParams rp)
{
Map map = BaseGen.globalSettings.map;
- if (rp.stockpileConcreteContents != null && rp.stockpileConcreteContents.Any())
+ if (rp.stockpileConcreteContents != null && rp.stockpileConcreteContents.Any())
{
this.CalculateFreeCells(rp.rect, 0f);
int num = 0;
- for (int i = rp.stockpileConcreteContents.Count - 1; i >= 0; i--)
+ int num2 = rp.stockpileConcreteContents.Count - 1;
+ while (num2 >= 0 && num < this.cells.Count)
{
- if (num >= this.cells.Count)
- {
- break;
- }
- GenSpawn.Spawn(rp.stockpileConcreteContents[i], this.cells[num], map);
+ GenSpawn.Spawn(rp.stockpileConcreteContents[num2], this.cells[num], map);
num++;
+ num2--;
}
- for (int j = rp.stockpileConcreteContents.Count - 1; j >= 0; j--)
+ for (int num3 = rp.stockpileConcreteContents.Count - 1; num3 >= 0; num3--)
{
- if (!rp.stockpileConcreteContents[j].Spawned)
+ if (!rp.stockpileConcreteContents[num3].Spawned)
{
- rp.stockpileConcreteContents[j].Destroy(DestroyMode.Vanish);
+ rp.stockpileConcreteContents[num3].Destroy(DestroyMode.Vanish);
}
}
rp.stockpileConcreteContents.Clear();
}
else
{
- ItemCollectionGeneratorDef itemCollectionGeneratorDef = rp.itemCollectionGeneratorDef ?? Rand.Element(ItemCollectionGeneratorDefOf.RandomGeneralGoods, ItemCollectionGeneratorDefOf.Weapons, ItemCollectionGeneratorDefOf.Apparel, ItemCollectionGeneratorDefOf.RawResources);
+ ItemCollectionGeneratorDef itemCollectionGeneratorDef = rp.itemCollectionGeneratorDef ?? Rand.Element(ItemCollectionGeneratorDefOf.RandomGeneralGoods, ItemCollectionGeneratorDefOf.Weapons, ItemCollectionGeneratorDefOf.Apparel, ItemCollectionGeneratorDefOf.RawResources);
ItemCollectionGeneratorParams? itemCollectionGeneratorParams = rp.itemCollectionGeneratorParams;
ItemCollectionGeneratorParams value;
if (itemCollectionGeneratorParams.HasValue)
@@ -49,14 +46,15 @@ public override void Resolve(ResolveParams rp)
else
{
this.CalculateFreeCells(rp.rect, 0.41f);
- value = default(ItemCollectionGeneratorParams);
- value.count = this.cells.Count;
- value.techLevel = ((rp.faction == null) ? TechLevel.Spacer : rp.faction.def.techLevel);
+ value = new ItemCollectionGeneratorParams
+ {
+ count = this.cells.Count,
+ techLevel = ((rp.faction == null) ? TechLevel.Spacer : rp.faction.def.techLevel)
+ };
if (itemCollectionGeneratorDef.Worker is ItemCollectionGenerator_Standard)
{
float? stockpileMarketValue = rp.stockpileMarketValue;
- float totalMarketValue = (!stockpileMarketValue.HasValue) ? Mathf.Min((float)this.cells.Count * 120f, 1800f) : stockpileMarketValue.Value;
- value.totalMarketValue = totalMarketValue;
+ float num4 = value.totalMarketValue = ((!stockpileMarketValue.HasValue) ? Mathf.Min((float)((float)this.cells.Count * 120.0), 1800f) : stockpileMarketValue.Value);
}
}
ResolveParams resolveParams = rp;
@@ -70,19 +68,19 @@ private void CalculateFreeCells(CellRect rect, float freeCellsFraction)
{
Map map = BaseGen.globalSettings.map;
this.cells.Clear();
- foreach (IntVec3 current in rect)
+ foreach (IntVec3 item in rect)
{
- if (current.Standable(map) && current.GetFirstItem(map) == null)
+ if (item.Standable(map) && item.GetFirstItem(map) == null)
{
- this.cells.Add(current);
+ this.cells.Add(item);
}
}
int num = (int)(freeCellsFraction * (float)this.cells.Count);
- for (int i = 0; i < num; i++)
+ for (int num2 = 0; num2 < num; num2++)
{
this.cells.RemoveAt(Rand.Range(0, this.cells.Count));
}
- this.cells.Shuffle();
+ this.cells.Shuffle();
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Storage.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Storage.cs
index 74ff0d7cd..64e074721 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Storage.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Storage.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace RimWorld.BaseGen
{
public class SymbolResolver_Storage : SymbolResolver
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Street.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Street.cs
index d04daf7ba..6c3cce7d3 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Street.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Street.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
@@ -24,15 +23,15 @@ private void CalculateStreet(CellRect rect, bool horizontal, TerrainDef floorDef
{
SymbolResolver_Street.street.Clear();
int num = (!horizontal) ? rect.Height : rect.Width;
- for (int i = 0; i < num; i++)
+ for (int num2 = 0; num2 < num; num2++)
{
if (horizontal)
{
- SymbolResolver_Street.street.Add(this.CausesStreet(new IntVec3(rect.minX + i, 0, rect.minZ - 1), floorDef) && this.CausesStreet(new IntVec3(rect.minX + i, 0, rect.maxZ + 1), floorDef));
+ SymbolResolver_Street.street.Add(this.CausesStreet(new IntVec3(rect.minX + num2, 0, rect.minZ - 1), floorDef) && this.CausesStreet(new IntVec3(rect.minX + num2, 0, rect.maxZ + 1), floorDef));
}
else
{
- SymbolResolver_Street.street.Add(this.CausesStreet(new IntVec3(rect.minX - 1, 0, rect.minZ + i), floorDef) && this.CausesStreet(new IntVec3(rect.maxX + 1, 0, rect.minZ + i), floorDef));
+ SymbolResolver_Street.street.Add(this.CausesStreet(new IntVec3(rect.minX - 1, 0, rect.minZ + num2), floorDef) && this.CausesStreet(new IntVec3(rect.maxX + 1, 0, rect.minZ + num2), floorDef));
}
}
}
@@ -48,17 +47,16 @@ private void FillStreetGaps(bool horizontal, int width)
}
else if (num != -1 && i - num <= width)
{
- for (int j = i + 1; j < i + width + 1; j++)
+ int num2 = i + 1;
+ while (num2 < i + width + 1 && num2 < SymbolResolver_Street.street.Count)
{
- if (j >= SymbolResolver_Street.street.Count)
+ if (!SymbolResolver_Street.street[num2])
{
- break;
- }
- if (SymbolResolver_Street.street[j])
- {
- SymbolResolver_Street.street[i] = true;
- break;
+ num2++;
+ continue;
}
+ SymbolResolver_Street.street[i] = true;
+ break;
}
}
}
@@ -71,25 +69,21 @@ private void RemoveShortStreetParts(bool horizontal, int width)
if (SymbolResolver_Street.street[i])
{
int num = 0;
- for (int j = i; j < SymbolResolver_Street.street.Count; j++)
+ int num2 = i;
+ while (num2 < SymbolResolver_Street.street.Count && SymbolResolver_Street.street[num2])
{
- if (!SymbolResolver_Street.street[j])
- {
- break;
- }
num++;
+ num2++;
}
- int num2 = 0;
- for (int k = i; k >= 0; k--)
+ int num3 = 0;
+ int num4 = i;
+ while (num4 >= 0 && SymbolResolver_Street.street[num4])
{
- if (!SymbolResolver_Street.street[k])
- {
- break;
- }
- num2++;
+ num3++;
+ num4--;
}
- int num3 = num2 + num - 1;
- if (num3 < width)
+ int num5 = num3 + num - 1;
+ if (num5 < width)
{
SymbolResolver_Street.street[i] = false;
}
@@ -102,14 +96,18 @@ private void SpawnFloor(CellRect rect, bool horizontal, TerrainDef floorDef)
Map map = BaseGen.globalSettings.map;
TerrainGrid terrainGrid = map.terrainGrid;
CellRect.CellRectIterator iterator = rect.GetIterator();
- while (!iterator.Done())
+ for (; !iterator.Done(); iterator.MoveNext())
{
IntVec3 current = iterator.Current;
- if ((horizontal && SymbolResolver_Street.street[current.x - rect.minX]) || (!horizontal && SymbolResolver_Street.street[current.z - rect.minZ]))
+ if (horizontal && SymbolResolver_Street.street[current.x - rect.minX])
{
- terrainGrid.SetTerrain(current, floorDef);
+ goto IL_006f;
}
- iterator.MoveNext();
+ if (!horizontal && SymbolResolver_Street.street[current.z - rect.minZ])
+ goto IL_006f;
+ continue;
+ IL_006f:
+ terrainGrid.SetTerrain(current, floorDef);
}
}
@@ -121,7 +119,19 @@ private bool CausesStreet(IntVec3 c, TerrainDef floorDef)
return false;
}
Building edifice = c.GetEdifice(map);
- return (edifice != null && edifice.def == ThingDefOf.Wall) || c.GetDoor(map) != null || c.GetTerrain(map) == floorDef;
+ if (edifice != null && edifice.def == ThingDefOf.Wall)
+ {
+ return true;
+ }
+ if (c.GetDoor(map) != null)
+ {
+ return true;
+ }
+ if (c.GetTerrain(map) == floorDef)
+ {
+ return true;
+ }
+ return false;
}
}
}
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Symbol.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Symbol.cs
index f8034ff84..29c0b2afb 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Symbol.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolResolver_Symbol.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
diff --git a/Assembly-CSharp/RimWorld.BaseGen/SymbolStack.cs b/Assembly-CSharp/RimWorld.BaseGen/SymbolStack.cs
index c6e21ec42..2b7fd794c 100644
--- a/Assembly-CSharp/RimWorld.BaseGen/SymbolStack.cs
+++ b/Assembly-CSharp/RimWorld.BaseGen/SymbolStack.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
diff --git a/Assembly-CSharp/RimWorld.Planet/Caravan.cs b/Assembly-CSharp/RimWorld.Planet/Caravan.cs
index bf993bb82..25ba203f4 100644
--- a/Assembly-CSharp/RimWorld.Planet/Caravan.cs
+++ b/Assembly-CSharp/RimWorld.Planet/Caravan.cs
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
+using System.Linq;
using System.Text;
using UnityEngine;
using Verse;
@@ -62,22 +62,10 @@ public override Material Material
{
get
{
- if (this.cachedMat == null)
+ if ((UnityEngine.Object)this.cachedMat == (UnityEngine.Object)null)
{
- Color color;
- if (base.Faction == null)
- {
- color = Color.white;
- }
- else if (base.Faction.IsPlayer)
- {
- color = Caravan.PlayerCaravanColor;
- }
- else
- {
- color = base.Faction.Color;
- }
- this.cachedMat = MaterialPool.MatFrom(this.def.texture, ShaderDatabase.WorldOverlayTransparentLit, color, WorldMaterials.DynamicObjectRenderQueue);
+ Color color = (base.Faction != null) ? ((!base.Faction.IsPlayer) ? base.Faction.Color : Caravan.PlayerCaravanColor) : Color.white;
+ this.cachedMat = MaterialPool.MatFrom(base.def.texture, ShaderDatabase.WorldOverlayTransparentLit, color, WorldMaterials.DynamicObjectRenderQueue);
}
return this.cachedMat;
}
@@ -151,7 +139,7 @@ public float MassCapacity
{
get
{
- return CollectionsMassCalculator.Capacity(this.PawnsListForReading);
+ return CollectionsMassCalculator.Capacity(this.PawnsListForReading);
}
}
@@ -159,7 +147,7 @@ public float MassUsage
{
get
{
- return CollectionsMassCalculator.MassUsage(this.PawnsListForReading, IgnorePawnsInventoryMode.DontIgnore, false, false);
+ return CollectionsMassCalculator.MassUsage(this.PawnsListForReading, IgnorePawnsInventoryMode.DontIgnore, false, false);
}
}
@@ -371,23 +359,23 @@ public override void ExposeData()
base.ExposeData();
if (Scribe.mode == LoadSaveMode.Saving)
{
- this.pawns.RemoveAll((Pawn x) => x.Destroyed);
+ this.pawns.RemoveAll((Predicate)((Pawn x) => x.Destroyed));
}
- Scribe_Values.Look(ref this.nameInt, "name", null, false);
- Scribe_Deep.Look>(ref this.pawns, "pawns", new object[]
+ Scribe_Values.Look(ref this.nameInt, "name", (string)null, false);
+ Scribe_Deep.Look>(ref this.pawns, "pawns", new object[1]
{
this
});
Scribe_Values.Look(ref this.autoJoinable, "autoJoinable", false, false);
- Scribe_Deep.Look(ref this.pather, "pather", new object[]
+ Scribe_Deep.Look(ref this.pather, "pather", new object[1]
{
this
});
- Scribe_Deep.Look(ref this.trader, "trader", new object[]
+ Scribe_Deep.Look(ref this.trader, "trader", new object[1]
{
this
});
- Scribe_Deep.Look(ref this.storyState, "storyState", new object[]
+ Scribe_Deep.Look(ref this.storyState, "storyState", new object[1]
{
this
});
@@ -448,21 +436,12 @@ public void AddPawn(Pawn p, bool addCarriedPawnToWorldPawnsIfAny)
if (p == null)
{
Log.Warning("Tried to add a null pawn to " + this);
- return;
}
- if (p.Dead)
+ else if (p.Dead)
{
- Log.Warning(string.Concat(new object[]
- {
- "Tried to add ",
- p,
- " to ",
- this,
- ", but this pawn is dead."
- }));
- return;
+ Log.Warning("Tried to add " + p + " to " + this + ", but this pawn is dead.");
}
- if (this.pawns.TryAdd(p, true))
+ else if (this.pawns.TryAdd(p, true))
{
Pawn pawn = p.carryTracker.CarriedThing as Pawn;
if (pawn != null)
@@ -526,10 +505,7 @@ public override string GetInspectString()
}
else if (this.AnyPawnHasExtremeMentalBreak)
{
- stringBuilder.Append("CaravanMemberMentalBreak".Translate(new object[]
- {
- this.FirstPawnWithExtremeMentalBreak.LabelShort
- }));
+ stringBuilder.Append("CaravanMemberMentalBreak".Translate(this.FirstPawnWithExtremeMentalBreak.LabelShort));
}
else if (this.AllOwnersDowned)
{
@@ -555,10 +531,7 @@ public override string GetInspectString()
Settlement settlement = CaravanVisitUtility.SettlementVisitedNow(this);
if (settlement != null)
{
- stringBuilder.Append("CaravanVisiting".Translate(new object[]
- {
- settlement.Label
- }));
+ stringBuilder.Append("CaravanVisiting".Translate(settlement.Label));
}
else
{
@@ -567,19 +540,16 @@ public override string GetInspectString()
}
if (this.pather.Moving)
{
- float num = (float)CaravanArrivalTimeEstimator.EstimatedTicksToArrive(this, true) / 60000f;
+ float num = (float)((float)CaravanArrivalTimeEstimator.EstimatedTicksToArrive(this, true) / 60000.0);
stringBuilder.AppendLine();
- stringBuilder.Append("CaravanEstimatedTimeToDestination".Translate(new object[]
- {
- num.ToString("0.#")
- }));
+ stringBuilder.Append("CaravanEstimatedTimeToDestination".Translate(num.ToString("0.#")));
}
if (this.ImmobilizedByMass)
{
stringBuilder.AppendLine();
stringBuilder.Append("CaravanImmobilizedByMass".Translate());
}
- string text;
+ string text = default(string);
if (CaravanPawnsNeedsUtility.AnyPawnOutOfFood(this, out text))
{
stringBuilder.AppendLine();
@@ -591,47 +561,154 @@ public override string GetInspectString()
stringBuilder.Append(".");
}
}
- else if (this.DaysWorthOfFood.First < 1000f)
+ else if (this.DaysWorthOfFood.First < 1000.0)
{
Pair daysWorthOfFood = this.DaysWorthOfFood;
stringBuilder.AppendLine();
- if (daysWorthOfFood.Second < 1000f)
+ if (daysWorthOfFood.Second < 1000.0)
{
- stringBuilder.Append("CaravanDaysOfFoodRot".Translate(new object[]
- {
- daysWorthOfFood.First.ToString("0.#"),
- daysWorthOfFood.Second.ToString("0.#")
- }));
+ stringBuilder.Append("CaravanDaysOfFoodRot".Translate(daysWorthOfFood.First.ToString("0.#"), daysWorthOfFood.Second.ToString("0.#")));
}
else
{
- stringBuilder.Append("CaravanDaysOfFood".Translate(new object[]
- {
- daysWorthOfFood.First.ToString("0.#")
- }));
+ stringBuilder.Append("CaravanDaysOfFood".Translate(daysWorthOfFood.First.ToString("0.#")));
}
}
stringBuilder.AppendLine();
- stringBuilder.AppendLine(string.Concat(new string[]
- {
- "CaravanBaseMovementTime".Translate(),
- ": ",
- ((float)this.TicksPerMove / 2500f).ToString("0.##"),
- " ",
- "CaravanHoursPerTile".Translate()
- }));
+ stringBuilder.AppendLine("CaravanBaseMovementTime".Translate() + ": " + ((float)((float)this.TicksPerMove / 2500.0)).ToString("0.##") + " " + "CaravanHoursPerTile".Translate());
stringBuilder.Append("CurrentTileMovementTime".Translate() + ": " + Caravan_PathFollower.CostToDisplay(this, base.Tile, this.pather.nextTile, -1f).ToStringTicksToPeriod(true, false, true));
return stringBuilder.ToString();
}
- [DebuggerHidden]
public override IEnumerable GetGizmos()
{
- Caravan.c__IteratorFF c__IteratorFF = new Caravan.c__IteratorFF();
- c__IteratorFF.<>f__this = this;
- Caravan.c__IteratorFF expr_0E = c__IteratorFF;
- expr_0E.$PC = -2;
- return expr_0E;
+ foreach (Gizmo gizmo in base.GetGizmos())
+ {
+ yield return gizmo;
+ }
+ if (this.IsPlayerControlled)
+ {
+ if (CaravanMergeUtility.CanMergeAnySelectedCaravans)
+ {
+ yield return (Gizmo)CaravanMergeUtility.MergeCommand(this);
+ }
+ if (Find.WorldSelector.SingleSelectedObject == this && this.PawnsListForReading.Count((Func)((Pawn x) => x.IsColonist)) >= 2)
+ {
+ yield return (Gizmo)new Command_Action
+ {
+ defaultLabel = "CommandSplitCaravan".Translate(),
+ defaultDesc = "CommandSplitCaravanDesc".Translate(),
+ icon = Caravan.SplitCommand,
+ action = (Action)delegate
+ {
+ Find.WindowStack.Add(new Dialog_SplitCaravan(((_003CGetGizmos_003Ec__IteratorFF)/*Error near IL_01a0: stateMachine*/)._003C_003Ef__this));
+ }
+ };
+ }
+ if (Find.WorldSelector.SingleSelectedObject == this)
+ {
+ yield return (Gizmo)SettleInEmptyTileUtility.SettleCommand(this);
+ }
+ Settlement settlementVisitedNow = CaravanVisitUtility.SettlementVisitedNow(this);
+ if (settlementVisitedNow != null && settlementVisitedNow.CanTradeNow)
+ {
+ yield return (Gizmo)CaravanVisitUtility.TradeCommand(this);
+ }
+ if (settlementVisitedNow != null && ((WorldObject)settlementVisitedNow).GetComponent() != null && ((WorldObject)settlementVisitedNow).GetComponent().ActiveRequest)
+ {
+ yield return (Gizmo)CaravanVisitUtility.FulfillRequestCommand(this);
+ }
+ if (CaravanJourneyDestinationUtility.AnyJurneyDestinationAt(base.Tile))
+ {
+ yield return (Gizmo)CaravanJourneyDestinationUtility.TakeOffCommand(base.Tile);
+ }
+ }
+ if (Prefs.DevMode)
+ {
+ yield return (Gizmo)new Command_Action
+ {
+ defaultLabel = "Dev: Mental break",
+ action = (Action)delegate()
+ {
+ Pawn pawn6 = default(Pawn);
+ if ((from x in ((_003CGetGizmos_003Ec__IteratorFF)/*Error near IL_02f3: stateMachine*/)._003C_003Ef__this.PawnsListForReading
+ where x.RaceProps.Humanlike && !x.InMentalState
+ select x).TryRandomElement(out pawn6))
+ {
+ pawn6.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.WanderSad, (string)null, false, false, null);
+ }
+ }
+ };
+ yield return (Gizmo)new Command_Action
+ {
+ defaultLabel = "Dev: Extreme mental break",
+ action = (Action)delegate()
+ {
+ Pawn pawn5 = default(Pawn);
+ if ((from x in ((_003CGetGizmos_003Ec__IteratorFF)/*Error near IL_033d: stateMachine*/)._003C_003Ef__this.PawnsListForReading
+ where x.RaceProps.Humanlike && !x.InMentalState
+ select x).TryRandomElement(out pawn5))
+ {
+ pawn5.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, (string)null, false, false, null);
+ }
+ }
+ };
+ yield return (Gizmo)new Command_Action
+ {
+ defaultLabel = "Dev: Make random pawn hungry",
+ action = (Action)delegate()
+ {
+ Pawn pawn4 = default(Pawn);
+ if ((from x in ((_003CGetGizmos_003Ec__IteratorFF)/*Error near IL_0388: stateMachine*/)._003C_003Ef__this.PawnsListForReading
+ where x.needs.food != null
+ select x).TryRandomElement(out pawn4))
+ {
+ pawn4.needs.food.CurLevelPercentage = 0f;
+ }
+ }
+ };
+ yield return (Gizmo)new Command_Action
+ {
+ defaultLabel = "Dev: Kill random pawn",
+ action = (Action)delegate
+ {
+ Pawn pawn3 = default(Pawn);
+ if (((IEnumerable)((_003CGetGizmos_003Ec__IteratorFF)/*Error near IL_03d3: stateMachine*/)._003C_003Ef__this.PawnsListForReading).TryRandomElement(out pawn3))
+ {
+ pawn3.Kill(default(DamageInfo?));
+ Messages.Message("Dev: Killed " + pawn3.LabelShort, (WorldObject)((_003CGetGizmos_003Ec__IteratorFF)/*Error near IL_03d3: stateMachine*/)._003C_003Ef__this, MessageSound.Benefit);
+ }
+ }
+ };
+ yield return (Gizmo)new Command_Action
+ {
+ defaultLabel = "Dev: Harm random pawn",
+ action = (Action)delegate
+ {
+ Pawn pawn2 = default(Pawn);
+ if (((IEnumerable)((_003CGetGizmos_003Ec__IteratorFF)/*Error near IL_041e: stateMachine*/)._003C_003Ef__this.PawnsListForReading).TryRandomElement(out pawn2))
+ {
+ DamageInfo dinfo = new DamageInfo(DamageDefOf.Scratch, 10, -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown);
+ pawn2.TakeDamage(dinfo);
+ }
+ }
+ };
+ yield return (Gizmo)new Command_Action
+ {
+ defaultLabel = "Dev: Down random pawn",
+ action = (Action)delegate()
+ {
+ Pawn pawn = default(Pawn);
+ if ((from x in ((_003CGetGizmos_003Ec__IteratorFF)/*Error near IL_0469: stateMachine*/)._003C_003Ef__this.PawnsListForReading
+ where !x.Downed
+ select x).TryRandomElement(out pawn))
+ {
+ HealthUtility.DamageUntilDowned(pawn);
+ Messages.Message("Dev: Downed " + pawn.LabelShort, (WorldObject)((_003CGetGizmos_003Ec__IteratorFF)/*Error near IL_0469: stateMachine*/)._003C_003Ef__this, MessageSound.Benefit);
+ }
+ }
+ };
+ }
}
public void RecacheImmobilizedNow()
@@ -646,12 +723,12 @@ public void RecacheDaysWorthOfFood()
public virtual void Notify_MemberDied(Pawn member)
{
- if (!this.PawnsListForReading.Any((Pawn x) => x != member && this.IsOwner(x)))
+ if (!this.PawnsListForReading.Any((Predicate)((Pawn x) => x != member && this.IsOwner(x))))
{
this.RemovePawn(member);
if (base.Faction == Faction.OfPlayer)
{
- Find.LetterStack.ReceiveLetter("LetterLabelAllCaravanColonistsDied".Translate(), "LetterAllCaravanColonistsDied".Translate(), LetterDefOf.BadNonUrgent, new GlobalTargetInfo(base.Tile), null);
+ Find.LetterStack.ReceiveLetter("LetterLabelAllCaravanColonistsDied".Translate(), "LetterAllCaravanColonistsDied".Translate(), LetterDefOf.BadNonUrgent, new GlobalTargetInfo(base.Tile), (string)null);
}
this.RemoveAllPawnsAndDiscardIfUnimportant();
Find.WorldObjects.Remove(this);
@@ -665,12 +742,12 @@ public virtual void Notify_MemberDied(Pawn member)
private void CheckAnyNonWorldPawns()
{
- for (int i = this.pawns.Count - 1; i >= 0; i--)
+ for (int num = this.pawns.Count - 1; num >= 0; num--)
{
- if (!this.pawns[i].IsWorldPawn())
+ if (!this.pawns[num].IsWorldPawn())
{
- Log.Error("Caravan member " + this.pawns[i] + " is not a world pawn. Removing...");
- this.pawns.Remove(this.pawns[i]);
+ Log.Error("Caravan member " + this.pawns[num] + " is not a world pawn. Removing...");
+ this.pawns.Remove(this.pawns[num]);
}
}
}
@@ -704,14 +781,32 @@ virtual IThingHolder get_ParentHolder()
return base.ParentHolder;
}
+ IThingHolder IThingHolder.get_ParentHolder()
+ {
+ //ILSpy generated this explicit interface implementation from .override directive in get_ParentHolder
+ return this.get_ParentHolder();
+ }
+
virtual int get_Tile()
{
return base.Tile;
}
+ int IIncidentTarget.get_Tile()
+ {
+ //ILSpy generated this explicit interface implementation from .override directive in get_Tile
+ return this.get_Tile();
+ }
+
virtual Faction get_Faction()
{
return base.Faction;
}
+
+ Faction ITrader.get_Faction()
+ {
+ //ILSpy generated this explicit interface implementation from .override directive in get_Faction
+ return this.get_Faction();
+ }
}
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction.cs b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction.cs
index c5fdff623..ebbc36d34 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.Planet
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_AttackSettlement.cs b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_AttackSettlement.cs
index d9d4ea0aa..5bdb4ff43 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_AttackSettlement.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_AttackSettlement.cs
@@ -11,10 +11,7 @@ public override string ReportString
{
get
{
- return "CaravanAttacking".Translate(new object[]
- {
- this.settlement.Label
- });
+ return "CaravanAttacking".Translate(this.settlement.Label);
}
}
@@ -39,7 +36,7 @@ public override void Arrived(Caravan caravan)
{
if (!this.settlement.HasMap)
{
- LongEventHandler.QueueLongEvent(delegate
+ LongEventHandler.QueueLongEvent((Action)delegate()
{
this.DoArrivalAction(caravan);
}, "GeneratingMapForNewEncounter", false, null);
@@ -65,20 +62,11 @@ private void DoArrivalAction(Caravan caravan)
if (!this.settlement.Faction.HostileTo(Faction.OfPlayer))
{
this.settlement.Faction.SetHostileTo(Faction.OfPlayer, true);
- Find.LetterStack.ReceiveLetter("LetterLabelCaravanEnteredEnemyBase".Translate(), "LetterCaravanEnteredEnemyBaseBecameHostile".Translate(new object[]
- {
- caravan.Label,
- this.settlement.Label,
- this.settlement.Faction.Name
- }).CapitalizeFirst(), LetterDefOf.Good, t, null);
+ Find.LetterStack.ReceiveLetter("LetterLabelCaravanEnteredEnemyBase".Translate(), "LetterCaravanEnteredEnemyBaseBecameHostile".Translate(caravan.Label, this.settlement.Label, this.settlement.Faction.Name).CapitalizeFirst(), LetterDefOf.Good, (Thing)t, (string)null);
}
else
{
- Find.LetterStack.ReceiveLetter("LetterLabelCaravanEnteredEnemyBase".Translate(), "LetterCaravanEnteredEnemyBase".Translate(new object[]
- {
- caravan.Label,
- this.settlement.Label
- }).CapitalizeFirst(), LetterDefOf.Good, t, null);
+ Find.LetterStack.ReceiveLetter("LetterLabelCaravanEnteredEnemyBase".Translate(), "LetterCaravanEnteredEnemyBase".Translate(caravan.Label, this.settlement.Label).CapitalizeFirst(), LetterDefOf.Good, (Thing)t, (string)null);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_Enter.cs b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_Enter.cs
index ed1b5c4b1..2d3ca3e91 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_Enter.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_Enter.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.Planet
@@ -11,10 +10,7 @@ public override string ReportString
{
get
{
- return "CaravanEntering".Translate(new object[]
- {
- this.mapParent.Label
- });
+ return "CaravanEntering".Translate(this.mapParent.Label);
}
}
@@ -38,29 +34,23 @@ public CaravanArrivalAction_Enter(MapParent mapParent)
public override void Arrived(Caravan caravan)
{
Map map = this.mapParent.Map;
- if (map == null)
- {
- return;
- }
- Pawn t = caravan.PawnsListForReading[0];
- CaravanDropInventoryMode dropInventoryMode = (!map.IsPlayerHome) ? CaravanDropInventoryMode.DoNotDrop : CaravanDropInventoryMode.UnloadIndividually;
- bool draftColonists = this.mapParent.Faction != null && this.mapParent.Faction.HostileTo(Faction.OfPlayer);
- CaravanEnterMapUtility.Enter(caravan, map, CaravanEnterMode.Edge, dropInventoryMode, draftColonists, null);
- if (this.mapParent.def == WorldObjectDefOf.Ambush)
+ if (map != null)
{
- Find.TickManager.CurTimeSpeed = TimeSpeed.Paused;
- Find.LetterStack.ReceiveLetter("LetterLabelCaravanEnteredAmbushMap".Translate(), "LetterCaravanEnteredAmbushMap".Translate(new object[]
+ Pawn t = caravan.PawnsListForReading[0];
+ CaravanDropInventoryMode dropInventoryMode = (CaravanDropInventoryMode)(map.IsPlayerHome ? 2 : 0);
+ bool draftColonists = this.mapParent.Faction != null && this.mapParent.Faction.HostileTo(Faction.OfPlayer);
+ CaravanEnterMapUtility.Enter(caravan, map, CaravanEnterMode.Edge, dropInventoryMode, draftColonists, null);
+ if (this.mapParent.def == WorldObjectDefOf.Ambush)
{
- caravan.Label
- }).CapitalizeFirst(), LetterDefOf.Good, t, null);
- }
- else if (caravan.IsPlayerControlled || this.mapParent.Faction == Faction.OfPlayer)
- {
- Messages.Message("MessageCaravanEnteredWorldObject".Translate(new object[]
+ Find.TickManager.CurTimeSpeed = TimeSpeed.Paused;
+ Find.LetterStack.ReceiveLetter("LetterLabelCaravanEnteredAmbushMap".Translate(), "LetterCaravanEnteredAmbushMap".Translate(caravan.Label).CapitalizeFirst(), LetterDefOf.Good, (Thing)t, (string)null);
+ }
+ else
{
- caravan.Label,
- this.mapParent.Label
- }).CapitalizeFirst(), t, MessageSound.Benefit);
+ if (!caravan.IsPlayerControlled && this.mapParent.Faction != Faction.OfPlayer)
+ return;
+ Messages.Message("MessageCaravanEnteredWorldObject".Translate(caravan.Label, this.mapParent.Label).CapitalizeFirst(), (Thing)t, MessageSound.Benefit);
+ }
}
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_VisitSettlement.cs b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_VisitSettlement.cs
index f0b0a55d0..240aa8f5c 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_VisitSettlement.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_VisitSettlement.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.Planet
@@ -11,10 +10,7 @@ public override string ReportString
{
get
{
- return "CaravanVisiting".Translate(new object[]
- {
- this.settlement.Label
- });
+ return "CaravanVisiting".Translate(this.settlement.Label);
}
}
@@ -39,11 +35,7 @@ public override void Arrived(Caravan caravan)
{
if (caravan.IsPlayerControlled)
{
- Messages.Message("MessageCaravanIsVisitingSettlement".Translate(new object[]
- {
- caravan.Label,
- this.settlement.Label
- }).CapitalizeFirst(), caravan, MessageSound.Benefit);
+ Messages.Message("MessageCaravanIsVisitingSettlement".Translate(caravan.Label, this.settlement.Label).CapitalizeFirst(), (WorldObject)caravan, MessageSound.Benefit);
}
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_VisitSite.cs b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_VisitSite.cs
index bbf3159e0..b9908c2f0 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_VisitSite.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalAction_VisitSite.cs
@@ -1,4 +1,3 @@
-using System;
using Verse;
namespace RimWorld.Planet
@@ -11,13 +10,7 @@ public override string ReportString
{
get
{
- return (!this.site.KnownDanger) ? "CaravanVisiting".Translate(new object[]
- {
- this.site.Label
- }) : "CaravanAttacking".Translate(new object[]
- {
- this.site.Label
- });
+ return (!this.site.KnownDanger) ? "CaravanVisiting".Translate(this.site.Label) : "CaravanAttacking".Translate(this.site.Label);
}
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalTimeEstimator.cs b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalTimeEstimator.cs
index 42c347f9e..b986d7f79 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanArrivalTimeEstimator.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanArrivalTimeEstimator.cs
@@ -1,4 +1,3 @@
-using System;
using UnityEngine;
using Verse;
@@ -48,19 +47,17 @@ public static int EstimatedTicksToArrive(Caravan caravan, bool allowCaching)
public static int EstimatedTicksToArrive(int from, int to, Caravan caravan)
{
- int result;
using (WorldPath worldPath = Find.WorldPathFinder.FindPath(from, to, caravan, null))
{
if (worldPath == WorldPath.NotFound)
{
- result = 0;
- }
- else
- {
- result = CaravanArrivalTimeEstimator.EstimatedTicksToArrive(from, to, worldPath, 0f, CaravanTicksPerMoveUtility.GetTicksPerMove(caravan), Find.TickManager.TicksAbs);
+ return 0;
}
+ return CaravanArrivalTimeEstimator.EstimatedTicksToArrive(from, to, worldPath, 0f, CaravanTicksPerMoveUtility.GetTicksPerMove(caravan), Find.TickManager.TicksAbs);
+ IL_0044:
+ int result;
+ return result;
}
- return result;
}
public static int EstimatedTicksToArrive(int from, int to, WorldPath path, float nextTileCostLeft, int caravanTicksPerMove, int curTicksAbs)
@@ -73,27 +70,28 @@ public static int EstimatedTicksToArrive(int from, int to, WorldPath path, float
int num6 = 0;
int num7 = 0;
int num8;
- if (CaravanRestUtility.WouldBeRestingAt(from, (long)curTicksAbs))
+ if (CaravanRestUtility.WouldBeRestingAt(from, curTicksAbs))
{
- num += CaravanRestUtility.LeftRestTicksAt(from, (long)curTicksAbs);
+ num += CaravanRestUtility.LeftRestTicksAt(from, curTicksAbs);
num8 = num5;
}
else
{
- num8 = CaravanRestUtility.LeftNonRestTicksAt(from, (long)curTicksAbs);
+ num8 = CaravanRestUtility.LeftNonRestTicksAt(from, curTicksAbs);
}
while (true)
{
num7++;
if (num7 >= 10000)
{
- break;
+ Log.ErrorOnce("Could not calculate estimated ticks to arrive. Too many iterations.", 1837451324);
+ return num;
}
if (num6 <= 0)
{
if (num2 == to)
{
- return num;
+ break;
}
bool flag = num3 == 0;
int start = num2;
@@ -107,10 +105,10 @@ public static int EstimatedTicksToArrive(int from, int to, WorldPath path, float
else
{
int num10 = curTicksAbs + num;
- float yearPercent = (float)GenDate.DayOfYear((long)num10, 0f) / 60f;
+ float yearPercent = (float)((float)GenDate.DayOfYear(num10, 0f) / 60.0);
num9 = (float)Caravan_PathFollower.CostToMove(caravanTicksPerMove, start, num2, yearPercent);
}
- num6 = Mathf.CeilToInt(num9 / 1f);
+ num6 = Mathf.CeilToInt((float)(num9 / 1.0));
}
if (num8 < num6)
{
@@ -126,7 +124,6 @@ public static int EstimatedTicksToArrive(int from, int to, WorldPath path, float
num6 = 0;
}
}
- Log.ErrorOnce("Could not calculate estimated ticks to arrive. Too many iterations.", 1837451324);
return num;
}
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanDropInventoryMode.cs b/Assembly-CSharp/RimWorld.Planet/CaravanDropInventoryMode.cs
index 269a39792..cc94d53a8 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanDropInventoryMode.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanDropInventoryMode.cs
@@ -1,11 +1,9 @@
-using System;
-
namespace RimWorld.Planet
{
public enum CaravanDropInventoryMode
{
- DoNotDrop,
- DropInstantly,
- UnloadIndividually
+ DoNotDrop = 0,
+ DropInstantly = 1,
+ UnloadIndividually = 2
}
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanDrugPolicyUtility.cs b/Assembly-CSharp/RimWorld.Planet/CaravanDrugPolicyUtility.cs
index 623d28a93..97123fd75 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanDrugPolicyUtility.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanDrugPolicyUtility.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Verse;
@@ -17,18 +16,14 @@ public static void TryTakeScheduledDrugs(Caravan caravan)
private static void TryTakeScheduledDrugs(Pawn pawn, Caravan caravan)
{
- if (pawn.drugs == null)
+ if (pawn.drugs != null)
{
- return;
- }
- DrugPolicy currentPolicy = pawn.drugs.CurrentPolicy;
- for (int i = 0; i < currentPolicy.Count; i++)
- {
- if (pawn.drugs.ShouldTryToTakeScheduledNow(currentPolicy[i].drug))
+ DrugPolicy currentPolicy = pawn.drugs.CurrentPolicy;
+ for (int i = 0; i < currentPolicy.Count; i++)
{
- Thing drug;
- Pawn drugOwner;
- if (CaravanInventoryUtility.TryGetThingOfDef(caravan, currentPolicy[i].drug, out drug, out drugOwner))
+ Thing drug = default(Thing);
+ Pawn drugOwner = default(Pawn);
+ if (pawn.drugs.ShouldTryToTakeScheduledNow(currentPolicy[i].drug) && CaravanInventoryUtility.TryGetThingOfDef(caravan, currentPolicy[i].drug, out drug, out drugOwner))
{
CaravanPawnsNeedsUtility.IngestDrug(pawn, drug, drugOwner, caravan);
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanEnterMapUtility.cs b/Assembly-CSharp/RimWorld.Planet/CaravanEnterMapUtility.cs
index 622046fde..022225703 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanEnterMapUtility.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanEnterMapUtility.cs
@@ -12,19 +12,11 @@ public static void Enter(Caravan caravan, Map map, CaravanEnterMode enterMode, C
{
if (enterMode == CaravanEnterMode.None)
{
- Log.Error(string.Concat(new object[]
- {
- "Caravan ",
- caravan,
- " tried to enter map ",
- map,
- " with enter mode ",
- enterMode
- }));
+ Log.Error("Caravan " + caravan + " tried to enter map " + map + " with enter mode " + enterMode);
enterMode = CaravanEnterMode.Edge;
}
IntVec3 enterCell = CaravanEnterMapUtility.GetEnterCell(caravan, map, enterMode, extraCellValidator);
- Func spawnCellGetter = (Pawn p) => CellFinder.RandomSpawnCellForPawnNear(enterCell, map, 4);
+ Func spawnCellGetter = (Func)((Pawn p) => CellFinder.RandomSpawnCellForPawnNear(enterCell, map, 4));
CaravanEnterMapUtility.Enter(caravan, map, spawnCellGetter, dropInventoryMode, draftColonists);
}
@@ -37,16 +29,21 @@ public static void Enter(Caravan caravan, Map map, Func spawnCell
IntVec3 loc = spawnCellGetter(CaravanEnterMapUtility.tmpPawns[i]);
GenSpawn.Spawn(CaravanEnterMapUtility.tmpPawns[i], loc, map, Rot4.Random, false);
}
- if (dropInventoryMode == CaravanDropInventoryMode.DropInstantly)
+ switch (dropInventoryMode)
+ {
+ case CaravanDropInventoryMode.DropInstantly:
{
CaravanEnterMapUtility.DropAllInventory(CaravanEnterMapUtility.tmpPawns);
+ break;
}
- else if (dropInventoryMode == CaravanDropInventoryMode.UnloadIndividually)
+ case CaravanDropInventoryMode.UnloadIndividually:
{
for (int j = 0; j < CaravanEnterMapUtility.tmpPawns.Count; j++)
{
CaravanEnterMapUtility.tmpPawns[j].inventory.UnloadEverything = true;
}
+ break;
+ }
}
if (draftColonists)
{
@@ -72,22 +69,28 @@ public static void Enter(Caravan caravan, Map map, Func spawnCell
private static IntVec3 GetEnterCell(Caravan caravan, Map map, CaravanEnterMode enterMode, Predicate extraCellValidator)
{
- if (enterMode == CaravanEnterMode.Edge)
+ switch (enterMode)
+ {
+ case CaravanEnterMode.Edge:
{
return CaravanEnterMapUtility.FindNearEdgeCell(map, extraCellValidator);
}
- if (enterMode != CaravanEnterMode.Center)
+ case CaravanEnterMode.Center:
+ {
+ return CaravanEnterMapUtility.FindCenterCell(map, extraCellValidator);
+ }
+ default:
{
throw new NotImplementedException("CaravanEnterMode");
}
- return CaravanEnterMapUtility.FindCenterCell(map, extraCellValidator);
+ }
}
private static IntVec3 FindNearEdgeCell(Map map, Predicate extraCellValidator)
{
- Predicate baseValidator = (IntVec3 x) => x.Standable(map) && !x.Fogged(map);
- IntVec3 root;
- if (extraCellValidator != null && CellFinder.TryFindRandomEdgeCellWith((IntVec3 x) => baseValidator(x) && extraCellValidator(x), map, CellFinder.EdgeRoadChance_Neutral, out root))
+ Predicate baseValidator = (Predicate)((IntVec3 x) => x.Standable(map) && !x.Fogged(map));
+ IntVec3 root = default(IntVec3);
+ if ((object)extraCellValidator != null && CellFinder.TryFindRandomEdgeCellWith((Predicate)((IntVec3 x) => baseValidator(x) && extraCellValidator(x)), map, CellFinder.EdgeRoadChance_Neutral, out root))
{
return CellFinder.RandomClosewalkCellNear(root, map, 5, null);
}
@@ -102,9 +105,9 @@ private static IntVec3 FindNearEdgeCell(Map map, Predicate extraCellVal
private static IntVec3 FindCenterCell(Map map, Predicate extraCellValidator)
{
TraverseParms traverseParms = TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false);
- Predicate baseValidator = (IntVec3 x) => x.Standable(map) && !x.Fogged(map) && map.reachability.CanReachMapEdge(x, traverseParms);
- IntVec3 result;
- if (extraCellValidator != null && RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith((IntVec3 x) => baseValidator(x) && extraCellValidator(x), map, out result))
+ Predicate baseValidator = (Predicate)((IntVec3 x) => x.Standable(map) && !x.Fogged(map) && map.reachability.CanReachMapEdge(x, traverseParms));
+ IntVec3 result = default(IntVec3);
+ if ((object)extraCellValidator != null && RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith((Predicate)((IntVec3 x) => baseValidator(x) && extraCellValidator(x)), map, out result))
{
return result;
}
@@ -137,7 +140,7 @@ private static void DraftColonists(List pawns)
private static bool TryRandomNonOccupiedClosewalkCellNear(IntVec3 root, Map map, int radius, out IntVec3 result)
{
- return CellFinder.TryFindRandomReachableCellNear(root, map, (float)radius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), (IntVec3 c) => c.Standable(map) && c.GetFirstPawn(map) == null, null, out result, 999999);
+ return CellFinder.TryFindRandomReachableCellNear(root, map, (float)radius, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), (Predicate)((IntVec3 c) => c.Standable(map) && c.GetFirstPawn(map) == null), (Predicate)null, out result, 999999);
}
}
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanEnterMode.cs b/Assembly-CSharp/RimWorld.Planet/CaravanEnterMode.cs
index bee2f6a6e..858a85f15 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanEnterMode.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanEnterMode.cs
@@ -1,11 +1,9 @@
-using System;
-
namespace RimWorld.Planet
{
public enum CaravanEnterMode
{
- None,
- Edge,
- Center
+ None = 0,
+ Edge = 1,
+ Center = 2
}
}
diff --git a/Assembly-CSharp/RimWorld.Planet/CaravanExitMapUtility.cs b/Assembly-CSharp/RimWorld.Planet/CaravanExitMapUtility.cs
index 78ecb0986..18f0c9b55 100644
--- a/Assembly-CSharp/RimWorld.Planet/CaravanExitMapUtility.cs
+++ b/Assembly-CSharp/RimWorld.Planet/CaravanExitMapUtility.cs
@@ -51,25 +51,28 @@ public static Caravan ExitMapAndCreateCaravan(IEnumerable pawns, Faction f
CaravanExitMapUtility.tmpPawns.Clear();
CaravanExitMapUtility.tmpPawns.AddRange(pawns);
Map map = null;
- for (int i = 0; i < CaravanExitMapUtility.tmpPawns.Count; i++)
+ int num = 0;
+ while (num < CaravanExitMapUtility.tmpPawns.Count)
{
- map = CaravanExitMapUtility.tmpPawns[i].MapHeld;
- if (map != null)
+ map = CaravanExitMapUtility.tmpPawns[num].MapHeld;
+ if (map == null)
{
- break;
+ num++;
+ continue;
}
+ break;
}
Caravan caravan = CaravanMaker.MakeCaravan(CaravanExitMapUtility.tmpPawns, faction, startingTile, false);
- for (int j = 0; j < CaravanExitMapUtility.tmpPawns.Count; j++)
+ for (int i = 0; i < CaravanExitMapUtility.tmpPawns.Count; i++)
{
- CaravanExitMapUtility.tmpPawns[j].ExitMap(false);
+ CaravanExitMapUtility.tmpPawns[i].ExitMap(false);
}
List pawnsListForReading = caravan.PawnsListForReading;
- for (int k = 0; k < pawnsListForReading.Count; k++)
+ for (int j = 0; j < pawnsListForReading.Count; j++)
{
- if (!pawnsListForReading[k].IsWorldPawn())
+ if (!pawnsListForReading[j].IsWorldPawn())
{
- Find.WorldPawns.PassToWorld(pawnsListForReading[k], PawnDiscardDecideMode.Decide);
+ Find.WorldPawns.PassToWorld(pawnsListForReading[j], PawnDiscardDecideMode.Decide);
}
}
if (map != null)
@@ -91,14 +94,11 @@ public static void ExitMapAndJoinOrCreateCaravan(Pawn pawn)
else if (pawn.IsColonist)
{
List list = CaravanExitMapUtility.AvailableExitTilesAt(pawn.Map);
- Caravan caravan2 = CaravanExitMapUtility.ExitMapAndCreateCaravan(Gen.YieldSingle(pawn), pawn.Faction, pawn.Map.Tile, (!list.Any()) ? pawn.Map.Tile : list.RandomElement());
+ Caravan caravan2 = CaravanExitMapUtility.ExitMapAndCreateCaravan(Gen.YieldSingle(pawn), pawn.Faction, pawn.Map.Tile, (!list.Any()) ? pawn.Map.Tile : list.RandomElement());
caravan2.autoJoinable = true;
if (pawn.Faction == Faction.OfPlayer)
{
- Messages.Message("MessagePawnLeftMapAndCreatedCaravan".Translate(new object[]
- {
- pawn.LabelShort
- }).CapitalizeFirst(), caravan2, MessageSound.Benefit);
+ Messages.Message("MessagePawnLeftMapAndCreatedCaravan".Translate(pawn.LabelShort).CapitalizeFirst(), (WorldObject)caravan2, MessageSound.Benefit);
}
}
else
@@ -109,7 +109,15 @@ public static void ExitMapAndJoinOrCreateCaravan(Pawn pawn)
public static bool CanExitMapAndJoinOrCreateCaravanNow(Pawn pawn)
{
- return pawn.Spawned && pawn.Map.exitMapGrid.MapUsesExitGrid && (pawn.IsColonist || CaravanExitMapUtility.FindCaravanToJoinFor(pawn) != null);
+ if (!pawn.Spawned)
+ {
+ return false;
+ }
+ if (!pawn.Map.exitMapGrid.MapUsesExitGrid)
+ {
+ return false;
+ }
+ return pawn.IsColonist || CaravanExitMapUtility.FindCaravanToJoinFor(pawn) != null;
}
public static List AvailableExitTilesAt(Map map)
@@ -125,48 +133,70 @@ public static List AvailableExitTilesAt(Map map)
if (CaravanExitMapUtility.IsGoodCaravanStartingTile(num))
{
Rot4 rotFromTo = grid.GetRotFromTo(currentTileID, num);
- IntVec3 intVec;
- if (CellFinder.TryFindRandomEdgeCellWith((IntVec3 x) => x.Walkable(map) && !x.Fogged(map), map, rotFromTo, CellFinder.EdgeRoadChance_Ignore, out intVec))
+ IntVec3 intVec = default(IntVec3);
+ if (CellFinder.TryFindRandomEdgeCellWith((Predicate)((IntVec3 x) => x.Walkable(map) && !x.Fogged(map)), map, rotFromTo, CellFinder.EdgeRoadChance_Ignore, out intVec))
{
CaravanExitMapUtility.retTiles.Add(num);
}
}
}
- CaravanExitMapUtility.retTiles.SortBy((int x) => grid.GetHeadingFromTo(currentTileID, x));
+ CaravanExitMapUtility.retTiles.SortBy((Func)((int x) => grid.GetHeadingFromTo(currentTileID, x)));
return CaravanExitMapUtility.retTiles;
}
public static int RandomBestExitTileFrom(Map map)
{
- CaravanExitMapUtility.c__AnonStorey388 c__AnonStorey = new CaravanExitMapUtility.c__AnonStorey388();
- c__AnonStorey.tile = map.TileInfo;
- c__AnonStorey.options = CaravanExitMapUtility.AvailableExitTilesAt(map);
- if (!c__AnonStorey.options.Any())
+ Tile tile = map.TileInfo;
+ List options = CaravanExitMapUtility.AvailableExitTilesAt(map);
+ if (!options.Any())
{
return -1;
}
- if (c__AnonStorey.tile.roads == null)
+ if (tile.roads == null)
{
- return c__AnonStorey.options.RandomElement();
+ return options.RandomElement();
}
int bestRoadIndex = -1;
- for (int i = 0; i < c__AnonStorey.tile.roads.Count; i++)
+ for (int i = 0; i < tile.roads.Count; i++)
{
- if (c__AnonStorey.options.Contains(c__AnonStorey.tile.roads[i].neighbor))
+ List obj = options;
+ Tile.RoadLink roadLink = tile.roads[i];
+ if (obj.Contains(roadLink.neighbor))
{
- if (bestRoadIndex == -1 || c__AnonStorey.tile.roads[i].road.priority > c__AnonStorey.tile.roads[bestRoadIndex].road.priority)
+ if (bestRoadIndex == -1)
{
- bestRoadIndex = i;
+ goto IL_00e9;
}
+ Tile.RoadLink roadLink2 = tile.roads[i];
+ int priority = roadLink2.road.priority;
+ Tile.RoadLink roadLink3 = tile.roads[bestRoadIndex];
+ if (priority > roadLink3.road.priority)
+ goto IL_00e9;
}
+ continue;
+ IL_00e9:
+ bestRoadIndex = i;
}
if (bestRoadIndex == -1)
{
- return c__AnonStorey.options.RandomElement();
+ return options.RandomElement();
}
- return (from rl in c__AnonStorey.tile.roads
- where c__AnonStorey.options.Contains(rl.neighbor) && rl.road == c__AnonStorey.tile.roads[bestRoadIndex].road
- select rl).RandomElement().neighbor;
+ Tile.RoadLink roadLink4 = tile.roads.Where((Func)delegate(Tile.RoadLink rl)
+ {
+ int result;
+ if (options.Contains(rl.neighbor))
+ {
+ RoadDef road = rl.road;
+ Tile.RoadLink roadLink5 = tile.roads[bestRoadIndex];
+ result = ((road == roadLink5.road) ? 1 : 0);
+ }
+ else
+ {
+ result = 0;
+ }
+ return (byte)result != 0;
+ }).RandomElement();
+ return roadLink4.neighbor;
}
private static int FindRandomStartingTileBasedOnExitDir(int tileID, Direction8Way exitDir)
@@ -187,14 +217,14 @@ private static int FindRandomStartingTileBasedOnExitDir(int tileID, Direction8Wa
{
return tileID;
}
- int result;
+ int result = default(int);
if ((from x in CaravanExitMapUtility.tileCandidates
where CaravanExitMapUtility.IsGoodCaravanStartingTile(x)
- select x).TryRandomElement(out result))
+ select x).TryRandomElement(out result))
{
return result;
}
- return CaravanExitMapUtility.tileCandidates.RandomElement();
+ return CaravanExitMapUtility.tileCandidates.RandomElement();
}
private static bool IsGoodCaravanStartingTile(int tile)
@@ -215,22 +245,19 @@ public static Caravan FindCaravanToJoinFor(Pawn pawn)
for (int i = 0; i < caravans.Count; i++)
{
Caravan caravan = caravans[i];
- if (CaravanExitMapUtility.tmpNeighbors.Contains(caravan.Tile))
+ if (CaravanExitMapUtility.tmpNeighbors.Contains(caravan.Tile) && caravan.autoJoinable)
{
- if (caravan.autoJoinable)
+ if (pawn.HostFaction == null)
{
- if (pawn.HostFaction == null)
- {
- if (caravan.Faction == pawn.Faction)
- {
- return caravan;
- }
- }
- else if (caravan.Faction == pawn.HostFaction)
+ if (caravan.Faction == pawn.Faction)
{
return caravan;
}
}
+ else if (caravan.Faction == pawn.HostFaction)
+ {
+ return caravan;
+ }
}
}
return null;
@@ -250,41 +277,33 @@ public static bool IsTheOnlyJoinableCaravanForAnyPrisonerOrAnimal(Caravan c)
}
List