Decompiled source of Population Rebalance v0.8.0

RealPop.dll

Decompiled 16 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Colossal;
using Colossal.Collections;
using Colossal.Entities;
using Colossal.Logging;
using Colossal.Mathematics;
using Game;
using Game.Achievements;
using Game.Agents;
using Game.Buildings;
using Game.Citizens;
using Game.City;
using Game.Common;
using Game.Companies;
using Game.Creatures;
using Game.Debug;
using Game.Economy;
using Game.Notifications;
using Game.Prefabs;
using Game.Simulation;
using Game.Tools;
using Game.Triggers;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RealPop.Systems;
using Unity.Burst;
using Unity.Burst.Intrinsics;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Scripting;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RealPop")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Rebalanced Population and Education")]
[assembly: AssemblyFileVersion("0.8.0.0")]
[assembly: AssemblyInformationalVersion("0.8.0+b37aff94464a5bfe7af3ec5531a9442f8f4ecc61")]
[assembly: AssemblyProduct("RealPop")]
[assembly: AssemblyTitle("RealPop")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.8.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RealPop
{
	[BepInPlugin("RealPop", "RealPop", "0.8.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private static ILog s_Log;

		public static ConfigEntry<int> TeenAgeLimitInDays;

		public static ConfigEntry<int> AdultAgeLimitInDays;

		public static ConfigEntry<int> ElderAgeLimitInDays;

		public static ConfigEntry<int> Education2InDays;

		public static ConfigEntry<int> Education3InDays;

		public static ConfigEntry<int> Education4InDays;

		public static ConfigEntry<float> GraduationLevel1;

		public static ConfigEntry<float> GraduationLevel2;

		public static ConfigEntry<float> GraduationLevel3;

		public static ConfigEntry<float> GraduationLevel4;

		public static ConfigEntry<bool> NewAdultsAnyEducation;

		public static ConfigEntry<bool> NoChildrenWhenTooOld;

		public static ConfigEntry<bool> AllowTeenStudents;

		public static ConfigEntry<int> BirthChanceSingle;

		public static ConfigEntry<int> BirthChanceFamily;

		public static ConfigEntry<int> NextBirthChance;

		public static ConfigEntry<int> FreeRatioTreshold;

		public static ConfigEntry<int> FreeRatioFullSpeed;

		public static ConfigEntry<int> DeathChanceIncrease;

		public static ConfigEntry<int> CorpseVanishChance;

		public static void Log(string text, bool bMethod = false)
		{
			if (bMethod)
			{
				text = GetCallingMethod(2) + ": " + text;
			}
			Logger.LogInfo((object)text);
			s_Log.Info((object)text);
		}

		public static void LogStack(string text)
		{
			Logger.LogInfo((object)(text + " STACKTRACE"));
			s_Log.logStackTrace = true;
			s_Log.Info((object)(text + "STACKTRACE"));
			s_Log.logStackTrace = false;
		}

		public static string GetCallingMethod(int frame)
		{
			MethodBase method = new StackTrace().GetFrame(frame).GetMethod();
			return method.DeclaringType?.ToString() + "." + method.Name;
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			s_Log = LogManager.GetLogger("RealPop", true);
			TeenAgeLimitInDays = ((BaseUnityPlugin)this).Config.Bind<int>("Lifecycle", "TeenAgeLimitInDays", 12, "When Children become Teens; Vanilla 21");
			AdultAgeLimitInDays = ((BaseUnityPlugin)this).Config.Bind<int>("Lifecycle", "AdultAgeLimitInDays", 20, "When Teens become Adults; Vanilla 36");
			ElderAgeLimitInDays = ((BaseUnityPlugin)this).Config.Bind<int>("Lifecycle", "ElderAgeLimitInDays", 75, "When Adults become Seniors; Vanilla 84");
			Education2InDays = ((BaseUnityPlugin)this).Config.Bind<int>("Schools", "Education2InDays", 3, "How long High School should typically last (only for Teens)");
			Education3InDays = ((BaseUnityPlugin)this).Config.Bind<int>("Schools", "Education3InDays", 4, "How long College should typically last (for both Teens and Adults)");
			Education4InDays = ((BaseUnityPlugin)this).Config.Bind<int>("Schools", "Education4InDays", 5, "How long University should typically last (only for Adults)");
			GraduationLevel1 = ((BaseUnityPlugin)this).Config.Bind<float>("Graduation", "Level1", 90f, "Elementary School; Vanilla 100");
			GraduationLevel2 = ((BaseUnityPlugin)this).Config.Bind<float>("Graduation", "Level2", 80f, "High School; Vanilla 60");
			GraduationLevel3 = ((BaseUnityPlugin)this).Config.Bind<float>("Graduation", "Level3", 80f, "College; Vanilla 90");
			GraduationLevel4 = ((BaseUnityPlugin)this).Config.Bind<float>("Graduation", "Level4", 70f, "University; Vanilla 70");
			NewAdultsAnyEducation = ((BaseUnityPlugin)this).Config.Bind<bool>("NewCims", "NewAdultsAnyEducation", true, "Allow for newly spawned Adults and Seniors to have any education level; Vanilla allows only Educated");
			NoChildrenWhenTooOld = ((BaseUnityPlugin)this).Config.Bind<bool>("NewCims", "NoChildrenWhenTooOld", true, "Does not allow for Adults to have Children when they cannot raise them before becoming Senior; Vanilla doesn't have such a restriction");
			AllowTeenStudents = ((BaseUnityPlugin)this).Config.Bind<bool>("NewCims", "AllowTeenStudents", true, "Allow for Teens ready for College to be spawned as Students; Vanilla spawns always Adults");
			BirthChanceSingle = ((BaseUnityPlugin)this).Config.Bind<int>("Birth", "BirthChanceSingle", 35, "Base birth chance for a Single, rolled against 16000, 16x per day; Vanilla 20");
			BirthChanceFamily = ((BaseUnityPlugin)this).Config.Bind<int>("Birth", "BirthChanceFamily", 120, "Base birth chance for a Family, rolled against 16000, 16x per day; Vanilla 100");
			NextBirthChance = ((BaseUnityPlugin)this).Config.Bind<int>("Birth", "NextBirthChance", 97, "Set to less than 100 to lower the birth chance for each consecutive child; Vanilla 100");
			FreeRatioTreshold = ((BaseUnityPlugin)this).Config.Bind<int>("NewCims", "FreeRatioTreshold", 25, "Treshold for free properties ratio to start spawning new households (in 1/1000); Vanilla has no restrictions, set to -1 to turn off");
			FreeRatioFullSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("NewCims", "FreeRatioFullSpeed", 75, "Treshold for free properties ratio to spawn new households at full speed (in 1/1000); Vanilla has no restrictions");
			DeathChanceIncrease = ((BaseUnityPlugin)this).Config.Bind<int>("Lifecycle", "DeathChanceIncrease", 4, "Increase in death chance per mille per year; set to 0 to turn off and use Vanilla process");
			CorpseVanishChance = ((BaseUnityPlugin)this).Config.Bind<int>("Lifecycle", "CorpseVanishChance", 30, "Percent chance for a corpse to vanish after death; Vanilla has no such feature, set to 0 to turn off");
			Log("Plugin RealPop is loaded!");
			MethodBase[] array = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "RealPop_Cities2Harmony").GetPatchedMethods().ToArray();
			Log("Plugin RealPop made patches! Patched methods: " + array.Length);
			MethodBase[] array2 = array;
			foreach (MethodBase methodBase in array2)
			{
				Log("Patched method: " + methodBase.Module.Name + ":" + methodBase.Name);
			}
		}
	}
	public static class Debug
	{
		public static bool Logging { get; set; } = true;


		public static void Log(string text)
		{
			if (Logging)
			{
				Debug.Log((object)(GetCallingMethod(2) + ": " + text));
			}
		}

		public static void Log(StringBuilder text)
		{
			if (Logging)
			{
				Debug.Log((object)(GetCallingMethod(2) + ": " + text.ToString()));
			}
		}

		public static void Log(params object[] args)
		{
			StringBuilder stringBuilder = new StringBuilder();
			foreach (object obj in args)
			{
				stringBuilder.Append(obj.ToString());
			}
			if (Logging)
			{
				Debug.Log((object)(GetCallingMethod(2) + ": " + stringBuilder.ToString()));
			}
		}

		public static void LogError(string sText)
		{
			if (Logging)
			{
				Debug.Log((object)(GetCallingMethod(2) + " ERROR: " + sText));
			}
		}

		public static void LogWarning(string sText)
		{
			if (Logging)
			{
				Debug.Log((object)(GetCallingMethod(2) + " WARNING: " + sText));
			}
		}

		public static void Log(Exception ex)
		{
			if (Logging)
			{
				Log("EXCEPTION");
				Debug.LogException(ex);
				if (ex.InnerException != null)
				{
					Debug.LogException(ex.InnerException);
				}
			}
		}

		public static void Log(string sText, Exception ex)
		{
			if (Logging)
			{
				Log("EXCEPTION " + sText);
				Debug.LogException(ex);
				if (ex.InnerException != null)
				{
					Debug.LogException(ex.InnerException);
				}
			}
		}

		public static string GetCallingMethod(int frame)
		{
			MethodBase method = new StackTrace().GetFrame(frame).GetMethod();
			return method.DeclaringType?.ToString() + "." + method.Name;
		}

		public static string GetGameCallingMethod()
		{
			StackTrace stackTrace = new StackTrace();
			for (int i = 0; i < stackTrace.FrameCount; i++)
			{
				MethodBase method = stackTrace.GetFrame(i).GetMethod();
				string @namespace = method.DeclaringType.Namespace;
				if (@namespace == null || @namespace == "ICities" || @namespace.Substring(0, Math.Min(17, @namespace.Length)) == "ColossalFramework")
				{
					return method.DeclaringType?.ToString() + "." + method.Name;
				}
			}
			return "unknown";
		}

		public static string GetGameCallingStack(int numMethods = 4)
		{
			StringBuilder stringBuilder = new StringBuilder();
			int num = 0;
			StackTrace stackTrace = new StackTrace();
			for (int i = 0; i < stackTrace.FrameCount; i++)
			{
				MethodBase method = stackTrace.GetFrame(i).GetMethod();
				string @namespace = method.DeclaringType.Namespace;
				if (@namespace == null || @namespace == "ICities" || @namespace.Substring(0, Math.Min(17, @namespace.Length)) == "ColossalFramework")
				{
					if (num++ > 0)
					{
						stringBuilder.Append(",");
					}
					stringBuilder.Append(method.DeclaringType?.ToString() + "." + method.Name);
					if (num == numMethods)
					{
						return stringBuilder.ToString();
					}
				}
			}
			if (num <= 0)
			{
				return "unknown";
			}
			return stringBuilder.ToString();
		}
	}
	public static class Logging
	{
		private static readonly string m_CsvFileName = "c:/log.csv";

		private static void LogToFile(string line)
		{
			try
			{
				using StreamWriter streamWriter = new StreamWriter(m_CsvFileName, append: true, Encoding.UTF8);
				streamWriter.WriteLine(line);
				streamWriter.Close();
			}
			catch (Exception ex)
			{
				Debug.Log("Cannot write to " + m_CsvFileName, ex);
			}
		}

		public static void Add(string identifier, params object[] args)
		{
			TimeSpan timeOfDay = DateTime.Now.TimeOfDay;
			long num = timeOfDay.Ticks / 10000;
			long num2 = timeOfDay.Ticks % 10000;
			uint num3 = 0u;
			uint num4 = num3 >> 12;
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append($"{num}.{num2:D4}");
			stringBuilder.Append($",{num3:X}");
			stringBuilder.Append("," + num4);
			stringBuilder.Append("," + identifier);
			foreach (object obj in args)
			{
				stringBuilder.Append("," + obj.ToString());
			}
			Debug.Log((object)stringBuilder.ToString());
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "RealPop";

		public const string PLUGIN_NAME = "RealPop";

		public const string PLUGIN_VERSION = "0.8.0";
	}
}
namespace RealPop.Systems
{
	[CompilerGenerated]
	public class AgingSystem_RealPop : GameSystemBase
	{
		[BurstCompile]
		private struct MoveFromHomeJob : IJob
		{
			public NativeQueue<Entity> m_MoveFromHomeQueue;

			public EntityCommandBuffer m_CommandBuffer;

			[ReadOnly]
			public ComponentLookup<Household> m_Households;

			public ComponentLookup<HouseholdMember> m_HouseholdMembers;

			public BufferLookup<HouseholdCitizen> m_HouseholdCitizens;

			[ReadOnly]
			public ComponentLookup<ArchetypeData> m_ArchetypeDatas;

			[ReadOnly]
			public NativeList<Entity> m_HouseholdPrefabs;

			public RandomSeed m_RandomSeed;

			public NativeCounter m_BecomeTeenCounter;

			public NativeCounter m_BecomeAdultCounter;

			public NativeCounter m_BecomeElderCounter;

			public NativeValue<int> m_BecomeTeen;

			public NativeValue<int> m_BecomeAdult;

			public NativeValue<int> m_BecomeElder;

			public void Execute()
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0170: Unknown result type (might be due to invalid IL or missing references)
				//IL_0175: Unknown result type (might be due to invalid IL or missing references)
				//IL_017b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_0184: Unknown result type (might be due to invalid IL or missing references)
				//IL_0189: Unknown result type (might be due to invalid IL or missing references)
				//IL_019a: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				m_BecomeTeen.value = ((NativeCounter)(ref m_BecomeTeenCounter)).Count;
				m_BecomeAdult.value = ((NativeCounter)(ref m_BecomeAdultCounter)).Count;
				m_BecomeElder.value = ((NativeCounter)(ref m_BecomeElderCounter)).Count;
				Random random = ((RandomSeed)(ref m_RandomSeed)).GetRandom(62347);
				Entity val = default(Entity);
				while (m_MoveFromHomeQueue.TryDequeue(ref val))
				{
					Entity val2 = m_HouseholdPrefabs[((Random)(ref random)).NextInt(m_HouseholdPrefabs.Length)];
					ArchetypeData val3 = m_ArchetypeDatas[val2];
					HouseholdMember val4 = m_HouseholdMembers[val];
					Entity household = val4.m_Household;
					if (!m_HouseholdCitizens.HasBuffer(household))
					{
						continue;
					}
					DynamicBuffer<HouseholdCitizen> val5 = m_HouseholdCitizens[household];
					if (val5.Length <= 1)
					{
						continue;
					}
					Household val6 = m_Households[household];
					Entity val7 = ((EntityCommandBuffer)(ref m_CommandBuffer)).CreateEntity(val3.m_Archetype);
					((EntityCommandBuffer)(ref m_CommandBuffer)).SetComponent<Household>(val7, new Household
					{
						m_Flags = val6.m_Flags,
						m_Resources = 1000
					});
					((EntityCommandBuffer)(ref m_CommandBuffer)).AddComponent<PropertySeeker>(val7, default(PropertySeeker));
					((EntityCommandBuffer)(ref m_CommandBuffer)).SetComponent<PrefabRef>(val7, new PrefabRef
					{
						m_Prefab = val2
					});
					val4.m_Household = val7;
					((EntityCommandBuffer)(ref m_CommandBuffer)).SetComponent<HouseholdMember>(val, val4);
					((EntityCommandBuffer)(ref m_CommandBuffer)).SetBuffer<HouseholdCitizen>(val7).Add(new HouseholdCitizen
					{
						m_Citizen = val
					});
					for (int i = 0; i < val5.Length; i++)
					{
						if (val5[i].m_Citizen == val)
						{
							val5.RemoveAt(i);
							break;
						}
					}
				}
			}
		}

		[BurstCompile]
		private struct AgingJob : IJobChunk
		{
			public Concurrent m_BecomeTeenCounter;

			public Concurrent m_BecomeAdultCounter;

			public Concurrent m_BecomeElderCounter;

			[ReadOnly]
			public EntityTypeHandle m_EntityType;

			public ComponentTypeHandle<Citizen> m_CitizenType;

			[ReadOnly]
			public ComponentTypeHandle<Student> m_StudentType;

			[ReadOnly]
			public SharedComponentTypeHandle<UpdateFrame> m_UpdateFrameType;

			[ReadOnly]
			public BufferLookup<Student> m_Students;

			[ReadOnly]
			public ComponentLookup<TravelPurpose> m_Purposes;

			public TimeData m_TimeData;

			public ParallelWriter<Entity> m_MoveFromHomeQueue;

			public uint m_SimulationFrame;

			public uint m_UpdateFrameIndex;

			public ParallelWriter m_CommandBuffer;

			public bool m_DebugAgeAllCitizens;

			private void LeaveSchool(int chunkIndex, int i, Entity student, NativeArray<Student> students)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				Entity school = students[i].m_School;
				((ParallelWriter)(ref m_CommandBuffer)).RemoveComponent<Student>(chunkIndex, student);
				if (m_Students.HasBuffer(school))
				{
					((ParallelWriter)(ref m_CommandBuffer)).AddComponent<StudentsRemoved>(chunkIndex, school);
				}
			}

			public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Invalid comparison between Unknown and I4
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Invalid comparison between Unknown and I4
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Expected I4, but got Unknown
				//IL_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_012a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01db: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: Unknown result type (might be due to invalid IL or missing references)
				//IL_019c: Invalid comparison between Unknown and I4
				//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Invalid comparison between Unknown and I4
				if (!m_DebugAgeAllCitizens && ((ArchetypeChunk)(ref chunk)).GetSharedComponent<UpdateFrame>(m_UpdateFrameType).m_Index != m_UpdateFrameIndex)
				{
					return;
				}
				NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(m_EntityType);
				NativeArray<Citizen> nativeArray2 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Citizen>(ref m_CitizenType);
				NativeArray<Student> nativeArray3 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Student>(ref m_StudentType);
				int day = TimeSystem.GetDay(m_SimulationFrame, m_TimeData);
				for (int i = 0; i < nativeArray.Length; i++)
				{
					Citizen val = nativeArray2[i];
					CitizenAge age = ((Citizen)(ref val)).GetAge();
					int num = day - val.m_BirthDay;
					int num2;
					if ((int)age == 0)
					{
						num2 = GetTeenAgeLimitInDays();
					}
					else if ((int)age == 1)
					{
						num2 = GetAdultAgeLimitInDays();
					}
					else
					{
						if ((int)age != 2)
						{
							continue;
						}
						num2 = GetElderAgeLimitInDays();
					}
					if (num < num2)
					{
						continue;
					}
					Entity val2 = nativeArray[i];
					switch ((int)age)
					{
					case 0:
						if (((ArchetypeChunk)(ref chunk)).Has<Student>(ref m_StudentType))
						{
							LeaveSchool(unfilteredChunkIndex, i, val2, nativeArray3);
						}
						((Concurrent)(ref m_BecomeTeenCounter)).Increment();
						((Citizen)(ref val)).SetAge((CitizenAge)1);
						nativeArray2[i] = val;
						break;
					case 1:
					{
						if (((ArchetypeChunk)(ref chunk)).Has<Student>(ref m_StudentType))
						{
							LeaveSchool(unfilteredChunkIndex, i, val2, nativeArray3);
						}
						((Citizen)(ref val)).SetAge((CitizenAge)2);
						ref CitizenFlags state = ref val.m_State;
						state = (CitizenFlags)((uint)state | 0x1000u);
						nativeArray2[i] = val;
						m_MoveFromHomeQueue.Enqueue(val2);
						((Concurrent)(ref m_BecomeAdultCounter)).Increment();
						break;
					}
					case 2:
						((Concurrent)(ref m_BecomeElderCounter)).Increment();
						if (m_Purposes.HasComponent(val2) && ((int)m_Purposes[val2].m_Purpose == 4 || (int)m_Purposes[val2].m_Purpose == 5))
						{
							((ParallelWriter)(ref m_CommandBuffer)).RemoveComponent<TravelPurpose>(unfilteredChunkIndex, val2);
						}
						((ParallelWriter)(ref m_CommandBuffer)).RemoveComponent<Worker>(unfilteredChunkIndex, val2);
						((Citizen)(ref val)).SetAge((CitizenAge)3);
						nativeArray2[i] = val;
						break;
					}
				}
			}

			void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask);
			}
		}

		private struct TypeHandle
		{
			[ReadOnly]
			public EntityTypeHandle __Unity_Entities_Entity_TypeHandle;

			public ComponentTypeHandle<Citizen> __Game_Citizens_Citizen_RW_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<Student> __Game_Citizens_Student_RO_ComponentTypeHandle;

			public SharedComponentTypeHandle<UpdateFrame> __Game_Simulation_UpdateFrame_SharedComponentTypeHandle;

			[ReadOnly]
			public BufferLookup<Student> __Game_Buildings_Student_RO_BufferLookup;

			[ReadOnly]
			public ComponentLookup<TravelPurpose> __Game_Citizens_TravelPurpose_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Household> __Game_Citizens_Household_RO_ComponentLookup;

			public ComponentLookup<HouseholdMember> __Game_Citizens_HouseholdMember_RW_ComponentLookup;

			public BufferLookup<HouseholdCitizen> __Game_Citizens_HouseholdCitizen_RW_BufferLookup;

			[ReadOnly]
			public ComponentLookup<ArchetypeData> __Game_Prefabs_ArchetypeData_RO_ComponentLookup;

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				__Unity_Entities_Entity_TypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
				__Game_Citizens_Citizen_RW_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Citizen>(false);
				__Game_Citizens_Student_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Student>(true);
				__Game_Simulation_UpdateFrame_SharedComponentTypeHandle = ((SystemState)(ref state)).GetSharedComponentTypeHandle<UpdateFrame>();
				__Game_Buildings_Student_RO_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<Student>(true);
				__Game_Citizens_TravelPurpose_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<TravelPurpose>(true);
				__Game_Citizens_Household_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Household>(true);
				__Game_Citizens_HouseholdMember_RW_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<HouseholdMember>(false);
				__Game_Citizens_HouseholdCitizen_RW_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<HouseholdCitizen>(false);
				__Game_Prefabs_ArchetypeData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<ArchetypeData>(true);
			}
		}

		public static readonly int kUpdatesPerDay = 1;

		private EntityQuery m_CitizenGroup;

		private EntityQuery m_TimeDataQuery;

		private EntityQuery m_HouseholdPrefabQuery;

		private SimulationSystem m_SimulationSystem;

		private EndFrameBarrier m_EndFrameBarrier;

		private NativeQueue<Entity> m_MoveFromHomeQueue;

		public static bool s_DebugAgeAllCitizens = false;

		[DebugWatchValue]
		public NativeValue<int> m_BecomeTeen;

		[DebugWatchValue]
		public NativeValue<int> m_BecomeAdult;

		[DebugWatchValue]
		public NativeValue<int> m_BecomeElder;

		public NativeCounter m_BecomeTeenCounter;

		public NativeCounter m_BecomeAdultCounter;

		public NativeCounter m_BecomeElderCounter;

		private TypeHandle __TypeHandle;

		private static int s_TeenAgeLimitInDays;

		private static int s_AdultAgeLimitInDays;

		private static int s_ElderAgeLimitInDays;

		public override int GetUpdateInterval(SystemUpdatePhase phase)
		{
			return 262144 / (kUpdatesPerDay * 16);
		}

		[Preserve]
		protected override void OnCreate()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			((GameSystemBase)this).OnCreate();
			m_SimulationSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<SimulationSystem>();
			m_EndFrameBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<EndFrameBarrier>();
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = (ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<Citizen>() };
			val.None = (ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadOnly<Deleted>(),
				ComponentType.ReadOnly<Temp>()
			};
			array[0] = val;
			m_CitizenGroup = ((ComponentSystemBase)this).GetEntityQuery((EntityQueryDesc[])(object)array);
			m_TimeDataQuery = ((ComponentSystemBase)this).GetEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<TimeData>() });
			m_HouseholdPrefabQuery = ((ComponentSystemBase)this).GetEntityQuery((ComponentType[])(object)new ComponentType[3]
			{
				ComponentType.ReadOnly<ArchetypeData>(),
				ComponentType.ReadOnly<HouseholdData>(),
				ComponentType.ReadOnly<DynamicHousehold>()
			});
			m_MoveFromHomeQueue = new NativeQueue<Entity>(AllocatorHandle.op_Implicit((Allocator)4));
			m_BecomeTeen = new NativeValue<int>((Allocator)4);
			m_BecomeAdult = new NativeValue<int>((Allocator)4);
			m_BecomeElder = new NativeValue<int>((Allocator)4);
			m_BecomeTeenCounter = new NativeCounter((Allocator)4);
			m_BecomeAdultCounter = new NativeCounter((Allocator)4);
			m_BecomeElderCounter = new NativeCounter((Allocator)4);
			((ComponentSystemBase)this).RequireForUpdate(m_CitizenGroup);
			s_TeenAgeLimitInDays = Plugin.TeenAgeLimitInDays.Value;
			s_AdultAgeLimitInDays = Plugin.AdultAgeLimitInDays.Value;
			s_ElderAgeLimitInDays = Plugin.ElderAgeLimitInDays.Value;
			Plugin.Log($"Modded AgingSystem created. Age thresholds: {s_TeenAgeLimitInDays}, {s_AdultAgeLimitInDays}, {s_ElderAgeLimitInDays}.");
		}

		[Preserve]
		protected override void OnDestroy()
		{
			((GameSystemBase)this).OnDestroy();
			m_MoveFromHomeQueue.Dispose();
			m_BecomeTeen.Dispose();
			m_BecomeAdult.Dispose();
			m_BecomeElder.Dispose();
			((NativeCounter)(ref m_BecomeTeenCounter)).Dispose();
			((NativeCounter)(ref m_BecomeAdultCounter)).Dispose();
			((NativeCounter)(ref m_BecomeElderCounter)).Dispose();
		}

		public static int GetTeenAgeLimitInDays()
		{
			return s_TeenAgeLimitInDays;
		}

		public static int GetAdultAgeLimitInDays()
		{
			return s_AdultAgeLimitInDays;
		}

		public static int GetElderAgeLimitInDays()
		{
			return s_ElderAgeLimitInDays;
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			uint updateFrame = SimulationUtils.GetUpdateFrame(m_SimulationSystem.frameIndex, kUpdatesPerDay, 16);
			__TypeHandle.__Game_Citizens_TravelPurpose_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Buildings_Student_RO_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Simulation_UpdateFrame_SharedComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_Student_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_Citizen_RW_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			((EntityTypeHandle)(ref __TypeHandle.__Unity_Entities_Entity_TypeHandle)).Update(ref ((SystemBase)this).CheckedStateRef);
			AgingJob agingJob = default(AgingJob);
			agingJob.m_BecomeTeenCounter = ((NativeCounter)(ref m_BecomeTeenCounter)).ToConcurrent();
			agingJob.m_BecomeAdultCounter = ((NativeCounter)(ref m_BecomeAdultCounter)).ToConcurrent();
			agingJob.m_BecomeElderCounter = ((NativeCounter)(ref m_BecomeElderCounter)).ToConcurrent();
			agingJob.m_EntityType = __TypeHandle.__Unity_Entities_Entity_TypeHandle;
			agingJob.m_CitizenType = __TypeHandle.__Game_Citizens_Citizen_RW_ComponentTypeHandle;
			agingJob.m_StudentType = __TypeHandle.__Game_Citizens_Student_RO_ComponentTypeHandle;
			agingJob.m_UpdateFrameType = __TypeHandle.__Game_Simulation_UpdateFrame_SharedComponentTypeHandle;
			agingJob.m_Students = __TypeHandle.__Game_Buildings_Student_RO_BufferLookup;
			agingJob.m_Purposes = __TypeHandle.__Game_Citizens_TravelPurpose_RO_ComponentLookup;
			agingJob.m_MoveFromHomeQueue = m_MoveFromHomeQueue.AsParallelWriter();
			agingJob.m_SimulationFrame = m_SimulationSystem.frameIndex;
			agingJob.m_TimeData = ((EntityQuery)(ref m_TimeDataQuery)).GetSingleton<TimeData>();
			agingJob.m_UpdateFrameIndex = updateFrame;
			EntityCommandBuffer val = ((SafeCommandBufferSystem)m_EndFrameBarrier).CreateCommandBuffer();
			agingJob.m_CommandBuffer = ((EntityCommandBuffer)(ref val)).AsParallelWriter();
			agingJob.m_DebugAgeAllCitizens = s_DebugAgeAllCitizens;
			AgingJob agingJob2 = agingJob;
			((SystemBase)this).Dependency = JobChunkExtensions.ScheduleParallel<AgingJob>(agingJob2, m_CitizenGroup, ((SystemBase)this).Dependency);
			m_EndFrameBarrier.AddJobHandleForProducer(((SystemBase)this).Dependency);
			__TypeHandle.__Game_Prefabs_ArchetypeData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_HouseholdCitizen_RW_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_HouseholdMember_RW_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_Household_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			MoveFromHomeJob moveFromHomeJob = default(MoveFromHomeJob);
			moveFromHomeJob.m_Households = __TypeHandle.__Game_Citizens_Household_RO_ComponentLookup;
			moveFromHomeJob.m_HouseholdMembers = __TypeHandle.__Game_Citizens_HouseholdMember_RW_ComponentLookup;
			moveFromHomeJob.m_HouseholdCitizens = __TypeHandle.__Game_Citizens_HouseholdCitizen_RW_BufferLookup;
			moveFromHomeJob.m_ArchetypeDatas = __TypeHandle.__Game_Prefabs_ArchetypeData_RO_ComponentLookup;
			JobHandle val2 = default(JobHandle);
			moveFromHomeJob.m_HouseholdPrefabs = ((EntityQuery)(ref m_HouseholdPrefabQuery)).ToEntityListAsync(AllocatorHandle.op_Implicit(((RewindableAllocator)(ref ((ComponentSystemBase)this).World.UpdateAllocator)).ToAllocator), ref val2);
			moveFromHomeJob.m_RandomSeed = RandomSeed.Next();
			moveFromHomeJob.m_CommandBuffer = ((SafeCommandBufferSystem)m_EndFrameBarrier).CreateCommandBuffer();
			moveFromHomeJob.m_MoveFromHomeQueue = m_MoveFromHomeQueue;
			moveFromHomeJob.m_BecomeTeen = m_BecomeTeen;
			moveFromHomeJob.m_BecomeAdult = m_BecomeAdult;
			moveFromHomeJob.m_BecomeElder = m_BecomeElder;
			moveFromHomeJob.m_BecomeTeenCounter = m_BecomeTeenCounter;
			moveFromHomeJob.m_BecomeAdultCounter = m_BecomeAdultCounter;
			moveFromHomeJob.m_BecomeElderCounter = m_BecomeElderCounter;
			MoveFromHomeJob moveFromHomeJob2 = moveFromHomeJob;
			((SystemBase)this).Dependency = IJobExtensions.Schedule<MoveFromHomeJob>(moveFromHomeJob2, JobHandle.CombineDependencies(val2, ((SystemBase)this).Dependency));
			m_EndFrameBarrier.AddJobHandleForProducer(((SystemBase)this).Dependency);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void __AssignQueries(ref SystemState state)
		{
		}

		protected override void OnCreateForCompiler()
		{
			((ComponentSystemBase)this).OnCreateForCompiler();
			__AssignQueries(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__AssignHandles(ref ((SystemBase)this).CheckedStateRef);
		}

		[Preserve]
		public AgingSystem_RealPop()
		{
		}
	}
	[CompilerGenerated]
	public class ApplyToSchoolSystem_RealPop : GameSystemBase
	{
		[BurstCompile]
		public struct ApplyToSchoolJob : IJobChunk
		{
			[ReadOnly]
			public EntityTypeHandle m_EntityType;

			[ReadOnly]
			public SharedComponentTypeHandle<UpdateFrame> m_UpdateFrameType;

			public ComponentTypeHandle<Citizen> m_CitizenType;

			[ReadOnly]
			public ComponentTypeHandle<Worker> m_WorkerType;

			[ReadOnly]
			public ComponentLookup<PrefabRef> m_Prefabs;

			[ReadOnly]
			public ComponentLookup<SchoolData> m_SchoolDatas;

			[ReadOnly]
			public ComponentLookup<HouseholdMember> m_HouseholdMembers;

			[ReadOnly]
			public ComponentLookup<Household> m_HouseholdDatas;

			[ReadOnly]
			public BufferLookup<Resources> m_Resources;

			[ReadOnly]
			public ComponentLookup<PropertyRenter> m_PropertyRenters;

			[ReadOnly]
			public BufferLookup<CityModifier> m_CityModifiers;

			[ReadOnly]
			public BufferLookup<ServiceFee> m_Fees;

			[ReadOnly]
			public ComponentLookup<TouristHousehold> m_TouristHouseholds;

			[ReadOnly]
			public ComponentLookup<SchoolSeekerCooldown> m_SchoolSeekerCooldowns;

			[ReadOnly]
			public RandomSeed m_RandomSeed;

			public uint m_UpdateFrameIndex;

			public Entity m_City;

			public uint m_SimulationFrame;

			public EconomyParameterData m_EconomyParameters;

			public TimeData m_TimeData;

			public ParallelWriter m_CommandBuffer;

			public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Invalid comparison between Unknown and I4
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0100: Invalid comparison between Unknown and I4
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Invalid comparison between Unknown and I4
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: Unknown result type (might be due to invalid IL or missing references)
				//IL_0182: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0197: Unknown result type (might be due to invalid IL or missing references)
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0205: Unknown result type (might be due to invalid IL or missing references)
				//IL_020a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0215: Unknown result type (might be due to invalid IL or missing references)
				//IL_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_0229: Unknown result type (might be due to invalid IL or missing references)
				//IL_0340: Unknown result type (might be due to invalid IL or missing references)
				//IL_0352: Unknown result type (might be due to invalid IL or missing references)
				//IL_0359: Unknown result type (might be due to invalid IL or missing references)
				//IL_036c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0257: Unknown result type (might be due to invalid IL or missing references)
				//IL_0269: Unknown result type (might be due to invalid IL or missing references)
				//IL_027b: Unknown result type (might be due to invalid IL or missing references)
				//IL_027d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0282: Unknown result type (might be due to invalid IL or missing references)
				//IL_0287: Unknown result type (might be due to invalid IL or missing references)
				//IL_0290: Unknown result type (might be due to invalid IL or missing references)
				//IL_0295: Unknown result type (might be due to invalid IL or missing references)
				//IL_029e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_030c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0313: Unknown result type (might be due to invalid IL or missing references)
				//IL_031b: Unknown result type (might be due to invalid IL or missing references)
				//IL_031d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0322: Unknown result type (might be due to invalid IL or missing references)
				if (((ArchetypeChunk)(ref chunk)).GetSharedComponent<UpdateFrame>(m_UpdateFrameType).m_Index != m_UpdateFrameIndex)
				{
					return;
				}
				NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(m_EntityType);
				NativeArray<Citizen> nativeArray2 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Citizen>(ref m_CitizenType);
				NativeArray<Worker> nativeArray3 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Worker>(ref m_WorkerType);
				DynamicBuffer<CityModifier> val = m_CityModifiers[m_City];
				Random random = ((RandomSeed)(ref m_RandomSeed)).GetRandom(unfilteredChunkIndex);
				for (int i = 0; i < ((ArchetypeChunk)(ref chunk)).Count; i++)
				{
					Citizen val2 = nativeArray2[i];
					CitizenAge age = ((Citizen)(ref val2)).GetAge();
					if ((int)age == 3 || (m_SchoolSeekerCooldowns.HasComponent(nativeArray[i]) && m_SimulationFrame < m_SchoolSeekerCooldowns[nativeArray[i]].m_SimulationFrame + kCoolDown))
					{
						continue;
					}
					int num = ((Random)(ref random)).NextInt(100);
					int num2 = ((Random)(ref random)).NextInt(100);
					int num3 = (((int)age == 0) ? 1 : (((Citizen)(ref val2)).GetEducationLevel() + 1));
					int failedEducationCount = ((Citizen)(ref val2)).GetFailedEducationCount();
					bool num4 = (int)age == 0 || ((int)age == 1 && num3 >= 2 && num3 < 4) || ((int)age == 2 && num3 >= 3);
					Entity household = m_HouseholdMembers[nativeArray[i]].m_Household;
					if (!num4 || !m_HouseholdDatas.HasComponent(household) || (m_HouseholdDatas[household].m_Flags & 4) == 0 || failedEducationCount >= 3 || num3 < 1 || num3 > 4)
					{
						continue;
					}
					int householdWorth = EconomyUtils.GetHouseholdWorth(household, m_HouseholdDatas[household], m_Resources[household]);
					float fee = ServiceFeeSystem.GetFee(ServiceFeeSystem.GetEducationResource(num3), m_Fees[m_City]);
					SchoolData schoolData = default(SchoolData);
					float efficiency = 1f;
					float dropoutProbability = GraduationSystem_RealPop.GetDropoutProbability(val2, num3, 0f, fee, householdWorth, m_SimulationFrame, ref m_EconomyParameters, schoolData, val, efficiency, m_TimeData);
					Random pseudoRandom = ((Citizen)(ref val2)).GetPseudoRandom((CitizenPseudoRandom)1176609278);
					float willingness = ((Random)(ref pseudoRandom)).NextFloat();
					float enteringProbability = GetEnteringProbability(age, nativeArray3.IsCreated, num3, val2.m_WellBeing, willingness, val);
					if ((float)num2 > 100f * dropoutProbability && (float)num < 100f * enteringProbability)
					{
						if (m_PropertyRenters.HasComponent(household) && !m_TouristHouseholds.HasComponent(household))
						{
							Entity property = m_PropertyRenters[household].m_Property;
							Entity val3 = ((ParallelWriter)(ref m_CommandBuffer)).CreateEntity(unfilteredChunkIndex);
							((ParallelWriter)(ref m_CommandBuffer)).AddComponent<Owner>(unfilteredChunkIndex, val3, new Owner
							{
								m_Owner = nativeArray[i]
							});
							((ParallelWriter)(ref m_CommandBuffer)).AddComponent<SchoolSeeker>(unfilteredChunkIndex, val3, new SchoolSeeker
							{
								m_Level = num3
							});
							((ParallelWriter)(ref m_CommandBuffer)).AddComponent<CurrentBuilding>(unfilteredChunkIndex, val3, new CurrentBuilding
							{
								m_CurrentBuilding = property
							});
							((ParallelWriter)(ref m_CommandBuffer)).AddComponent<HasSchoolSeeker>(unfilteredChunkIndex, nativeArray[i], new HasSchoolSeeker
							{
								m_Seeker = val3
							});
						}
					}
					else
					{
						((Citizen)(ref val2)).SetFailedEducationCount(math.min(3, failedEducationCount + 1));
						nativeArray2[i] = val2;
						((ParallelWriter)(ref m_CommandBuffer)).AddComponent<SchoolSeekerCooldown>(unfilteredChunkIndex, nativeArray[i], new SchoolSeekerCooldown
						{
							m_SimulationFrame = m_SimulationFrame
						});
					}
				}
			}

			void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask);
			}
		}

		private struct TypeHandle
		{
			public SharedComponentTypeHandle<UpdateFrame> __Game_Simulation_UpdateFrame_SharedComponentTypeHandle;

			public ComponentTypeHandle<Citizen> __Game_Citizens_Citizen_RW_ComponentTypeHandle;

			[ReadOnly]
			public EntityTypeHandle __Unity_Entities_Entity_TypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<Worker> __Game_Citizens_Worker_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentLookup<HouseholdMember> __Game_Citizens_HouseholdMember_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<PropertyRenter> __Game_Buildings_PropertyRenter_RO_ComponentLookup;

			[ReadOnly]
			public BufferLookup<CityModifier> __Game_City_CityModifier_RO_BufferLookup;

			[ReadOnly]
			public ComponentLookup<PrefabRef> __Game_Prefabs_PrefabRef_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<SchoolData> __Game_Prefabs_SchoolData_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<Household> __Game_Citizens_Household_RO_ComponentLookup;

			[ReadOnly]
			public BufferLookup<Resources> __Game_Economy_Resources_RO_BufferLookup;

			[ReadOnly]
			public BufferLookup<ServiceFee> __Game_City_ServiceFee_RO_BufferLookup;

			[ReadOnly]
			public ComponentLookup<TouristHousehold> __Game_Citizens_TouristHousehold_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<SchoolSeekerCooldown> __Game_Citizens_SchoolSeekerCooldown_RO_ComponentLookup;

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				__Game_Simulation_UpdateFrame_SharedComponentTypeHandle = ((SystemState)(ref state)).GetSharedComponentTypeHandle<UpdateFrame>();
				__Game_Citizens_Citizen_RW_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Citizen>(false);
				__Unity_Entities_Entity_TypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
				__Game_Citizens_Worker_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Worker>(true);
				__Game_Citizens_HouseholdMember_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<HouseholdMember>(true);
				__Game_Buildings_PropertyRenter_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<PropertyRenter>(true);
				__Game_City_CityModifier_RO_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<CityModifier>(true);
				__Game_Prefabs_PrefabRef_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<PrefabRef>(true);
				__Game_Prefabs_SchoolData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<SchoolData>(true);
				__Game_Citizens_Household_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Household>(true);
				__Game_Economy_Resources_RO_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<Resources>(true);
				__Game_City_ServiceFee_RO_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<ServiceFee>(true);
				__Game_Citizens_TouristHousehold_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<TouristHousehold>(true);
				__Game_Citizens_SchoolSeekerCooldown_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<SchoolSeekerCooldown>(true);
			}
		}

		public static readonly int kCoolDown = 20000;

		public const uint UPDATE_INTERVAL = 8192u;

		private EntityQuery m_CitizenGroup;

		private SimulationSystem m_SimulationSystem;

		private EndFrameBarrier m_EndFrameBarrier;

		private CitySystem m_CitySystem;

		private TypeHandle __TypeHandle;

		private EntityQuery __query_2069025488_0;

		private EntityQuery __query_2069025488_1;

		public override int GetUpdateInterval(SystemUpdatePhase phase)
		{
			return 512;
		}

		[Preserve]
		protected override void OnCreate()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			((GameSystemBase)this).OnCreate();
			m_SimulationSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<SimulationSystem>();
			m_EndFrameBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<EndFrameBarrier>();
			m_CitySystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<CitySystem>();
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = (ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadWrite<Citizen>(),
				ComponentType.ReadOnly<UpdateFrame>()
			};
			val.None = (ComponentType[])(object)new ComponentType[5]
			{
				ComponentType.ReadOnly<HealthProblem>(),
				ComponentType.ReadOnly<HasJobSeeker>(),
				ComponentType.ReadOnly<HasSchoolSeeker>(),
				ComponentType.ReadOnly<Student>(),
				ComponentType.ReadOnly<Deleted>()
			};
			array[0] = val;
			m_CitizenGroup = ((ComponentSystemBase)this).GetEntityQuery((EntityQueryDesc[])(object)array);
			((ComponentSystemBase)this).RequireForUpdate(m_CitizenGroup);
			((ComponentSystemBase)this).RequireForUpdate<EconomyParameterData>();
			((ComponentSystemBase)this).RequireForUpdate<TimeData>();
			Plugin.Log("Modded ApplyToSchoolSystem created.");
		}

		[Preserve]
		protected override void OnUpdate()
		{
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			uint updateFrameWithInterval = SimulationUtils.GetUpdateFrameWithInterval(m_SimulationSystem.frameIndex, (uint)((GameSystemBase)this).GetUpdateInterval((SystemUpdatePhase)12), 16);
			__TypeHandle.__Game_Citizens_SchoolSeekerCooldown_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_TouristHousehold_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_City_ServiceFee_RO_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Economy_Resources_RO_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_Household_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Prefabs_SchoolData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_City_CityModifier_RO_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Buildings_PropertyRenter_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_HouseholdMember_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_Worker_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			((EntityTypeHandle)(ref __TypeHandle.__Unity_Entities_Entity_TypeHandle)).Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Citizens_Citizen_RW_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__Game_Simulation_UpdateFrame_SharedComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef);
			ApplyToSchoolJob applyToSchoolJob = default(ApplyToSchoolJob);
			applyToSchoolJob.m_UpdateFrameType = __TypeHandle.__Game_Simulation_UpdateFrame_SharedComponentTypeHandle;
			applyToSchoolJob.m_CitizenType = __TypeHandle.__Game_Citizens_Citizen_RW_ComponentTypeHandle;
			applyToSchoolJob.m_EntityType = __TypeHandle.__Unity_Entities_Entity_TypeHandle;
			applyToSchoolJob.m_WorkerType = __TypeHandle.__Game_Citizens_Worker_RO_ComponentTypeHandle;
			applyToSchoolJob.m_HouseholdMembers = __TypeHandle.__Game_Citizens_HouseholdMember_RO_ComponentLookup;
			applyToSchoolJob.m_PropertyRenters = __TypeHandle.__Game_Buildings_PropertyRenter_RO_ComponentLookup;
			applyToSchoolJob.m_CityModifiers = __TypeHandle.__Game_City_CityModifier_RO_BufferLookup;
			applyToSchoolJob.m_Prefabs = __TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentLookup;
			applyToSchoolJob.m_SchoolDatas = __TypeHandle.__Game_Prefabs_SchoolData_RO_ComponentLookup;
			applyToSchoolJob.m_HouseholdDatas = __TypeHandle.__Game_Citizens_Household_RO_ComponentLookup;
			applyToSchoolJob.m_Resources = __TypeHandle.__Game_Economy_Resources_RO_BufferLookup;
			applyToSchoolJob.m_Fees = __TypeHandle.__Game_City_ServiceFee_RO_BufferLookup;
			applyToSchoolJob.m_TouristHouseholds = __TypeHandle.__Game_Citizens_TouristHousehold_RO_ComponentLookup;
			applyToSchoolJob.m_SchoolSeekerCooldowns = __TypeHandle.__Game_Citizens_SchoolSeekerCooldown_RO_ComponentLookup;
			applyToSchoolJob.m_RandomSeed = RandomSeed.Next();
			applyToSchoolJob.m_SimulationFrame = m_SimulationSystem.frameIndex;
			applyToSchoolJob.m_EconomyParameters = ((EntityQuery)(ref __query_2069025488_0)).GetSingleton<EconomyParameterData>();
			applyToSchoolJob.m_TimeData = ((EntityQuery)(ref __query_2069025488_1)).GetSingleton<TimeData>();
			applyToSchoolJob.m_City = m_CitySystem.City;
			applyToSchoolJob.m_UpdateFrameIndex = updateFrameWithInterval;
			EntityCommandBuffer val = ((SafeCommandBufferSystem)m_EndFrameBarrier).CreateCommandBuffer();
			applyToSchoolJob.m_CommandBuffer = ((EntityCommandBuffer)(ref val)).AsParallelWriter();
			ApplyToSchoolJob applyToSchoolJob2 = applyToSchoolJob;
			((SystemBase)this).Dependency = JobChunkExtensions.ScheduleParallel<ApplyToSchoolJob>(applyToSchoolJob2, m_CitizenGroup, ((SystemBase)this).Dependency);
			m_EndFrameBarrier.AddJobHandleForProducer(((SystemBase)this).Dependency);
		}

		public static float GetEnteringProbability(CitizenAge age, bool worker, int level, int wellbeing, float willingness, DynamicBuffer<CityModifier> cityModifiers)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (level == 1)
			{
				if ((int)age != 0)
				{
					return 0f;
				}
				return 1f;
			}
			if ((int)age == 0 || (int)age == 3)
			{
				return 0f;
			}
			float num = (float)wellbeing / 60f * (0.5f + willingness);
			switch (level)
			{
			case 2:
				if ((int)age != 1)
				{
					return 0f;
				}
				return 0.77f * (worker ? 0.9f : 1f) * math.log(2.6f * num + 1f);
			case 3:
				return 0.5f * (worker ? 0.75f : 1f) * math.log(1.6f * num + 1f);
			case 4:
			{
				float result = 0.3f * (worker ? 0.6f : 1f) * num;
				CityUtils.ApplyModifier(ref result, cityModifiers, (CityModifierType)14);
				return result;
			}
			default:
				return 0f;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void __AssignQueries(ref SystemState state)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val = new EntityQueryDesc();
			val.All = (ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<EconomyParameterData>() };
			val.Any = (ComponentType[])(object)new ComponentType[0];
			val.None = (ComponentType[])(object)new ComponentType[0];
			val.Disabled = (ComponentType[])(object)new ComponentType[0];
			val.Absent = (ComponentType[])(object)new ComponentType[0];
			val.Options = (EntityQueryOptions)16;
			array[0] = val;
			__query_2069025488_0 = ((SystemState)(ref state)).GetEntityQuery((EntityQueryDesc[])(object)array);
			EntityQueryDesc[] array2 = new EntityQueryDesc[1];
			val = new EntityQueryDesc();
			val.All = (ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<TimeData>() };
			val.Any = (ComponentType[])(object)new ComponentType[0];
			val.None = (ComponentType[])(object)new ComponentType[0];
			val.Disabled = (ComponentType[])(object)new ComponentType[0];
			val.Absent = (ComponentType[])(object)new ComponentType[0];
			val.Options = (EntityQueryOptions)16;
			array2[0] = val;
			__query_2069025488_1 = ((SystemState)(ref state)).GetEntityQuery((EntityQueryDesc[])(object)array2);
		}

		protected override void OnCreateForCompiler()
		{
			((ComponentSystemBase)this).OnCreateForCompiler();
			__AssignQueries(ref ((SystemBase)this).CheckedStateRef);
			__TypeHandle.__AssignHandles(ref ((SystemBase)this).CheckedStateRef);
		}

		[Preserve]
		public ApplyToSchoolSystem_RealPop()
		{
		}
	}
	[CompilerGenerated]
	public class BirthSystem_RealPop : GameSystemBase
	{
		[BurstCompile]
		private struct CheckBirthJob : IJobChunk
		{
			public Concurrent m_DebugBirthCounter;

			[ReadOnly]
			public EntityTypeHandle m_EntityType;

			[ReadOnly]
			public ComponentTypeHandle<Citizen> m_CitizenType;

			[ReadOnly]
			public ComponentTypeHandle<HouseholdMember> m_MemberType;

			[ReadOnly]
			public SharedComponentTypeHandle<UpdateFrame> m_UpdateFrameType;

			[ReadOnly]
			public BufferLookup<HouseholdCitizen> m_HouseholdCitizens;

			[ReadOnly]
			public ComponentLookup<Citizen> m_Citizens;

			[ReadOnly]
			public ComponentLookup<Student> m_Students;

			[ReadOnly]
			public ComponentLookup<PropertyRenter> m_PropertyRenters;

			public uint m_UpdateFrameIndex;

			public RandomSeed m_RandomSeed;

			[ReadOnly]
			public int m_BirthChance;

			[ReadOnly]
			public NativeList<Entity> m_CitizenPrefabs;

			[ReadOnly]
			public NativeList<ArchetypeData> m_CitizenPrefabArchetypes;

			public ParallelWriter m_CommandBuffer;

			public ParallelWriter<StatisticsEvent> m_StatisticsEventQueue;

			public uint m_SimulationFrame;

			public TimeData m_TimeData;

			private Entity SpawnBaby(int index, Entity household, ref Random random, Entity building)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				((Concurrent)(ref m_DebugBirthCounter)).Increment();
				int num = ((Random)(ref random)).NextInt(m_CitizenPrefabs.Length);
				Entity prefab = m_CitizenPrefabs[num];
				ArchetypeData val = m_CitizenPrefabArchetypes[num];
				Entity val2 = ((ParallelWriter)(ref m_CommandBuffer)).CreateEntity(index, val.m_Archetype);
				PrefabRef val3 = default(PrefabRef);
				val3.m_Prefab = prefab;
				((ParallelWriter)(ref m_CommandBuffer)).SetComponent<PrefabRef>(index, val2, val3);
				HouseholdMember val4 = default(HouseholdMember);
				val4.m_Household = household;
				HouseholdMember val5 = val4;
				((ParallelWriter)(ref m_CommandBuffer)).AddComponent<HouseholdMember>(index, val2, val5);
				Citizen val6 = default(Citizen);
				val6.m_BirthDay = 0;
				val6.m_State = (CitizenFlags)0;
				Citizen val7 = val6;
				((ParallelWriter)(ref m_CommandBuffer)).SetComponent<Citizen>(index, val2, val7);
				((ParallelWriter)(ref m_CommandBuffer)).AddComponent<CurrentBuilding>(index, val2, new CurrentBuilding
				{
					m_CurrentBuilding = building
				});
				return val2;
			}

			public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Invalid comparison between Unknown and I4
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: Unknown result type (might be due to invalid IL or missing references)
				//IL_0167: Unknown result type (might be due to invalid IL or missing references)
				//IL_016d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Invalid comparison between Unknown and I4
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0192: Invalid comparison between Unknown and I4
				//IL_0207: Unknown result type (might be due to invalid IL or missing references)
				//IL_020b: Unknown result type (might be due to invalid IL or missing references)
				//IL_020d: Unknown result type (might be due to invalid IL or missing references)
				//IL_021b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0225: Unknown result type (might be due to invalid IL or missing references)
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				if (((ArchetypeChunk)(ref chunk)).GetSharedComponent<UpdateFrame>(m_UpdateFrameType).m_Index != m_UpdateFrameIndex)
				{
					return;
				}
				NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(m_EntityType);
				NativeArray<Citizen> nativeArray2 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Citizen>(ref m_CitizenType);
				NativeArray<HouseholdMember> nativeArray3 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<HouseholdMember>(ref m_MemberType);
				Random random = ((RandomSeed)(ref m_RandomSeed)).GetRandom(unfilteredChunkIndex);
				int day = TimeSystem.GetDay(m_SimulationFrame, m_TimeData);
				int num = AgingSystem_RealPop.GetElderAgeLimitInDays() - AgingSystem_RealPop.GetAdultAgeLimitInDays();
				for (int i = 0; i < nativeArray.Length; i++)
				{
					Entity val = nativeArray[i];
					Citizen val2 = nativeArray2[i];
					if ((int)((Citizen)(ref val2)).GetAge() != 2 || (val2.m_State & 0x608) != 0)
					{
						continue;
					}
					int num2 = day - val2.m_BirthDay;
					if (s_NoChildrenWhenTooOld && num2 > num)
					{
						continue;
					}
					Entity household = nativeArray3[i].m_Household;
					Entity val3 = Entity.Null;
					if (m_PropertyRenters.HasComponent(household))
					{
						val3 = m_PropertyRenters[household].m_Property;
					}
					if (val3 == Entity.Null)
					{
						continue;
					}
					DynamicBuffer<HouseholdCitizen> val4 = m_HouseholdCitizens[household];
					int num3 = s_BirthChanceSingle;
					Entity val5 = Entity.Null;
					int num4 = 0;
					for (int j = 0; j < val4.Length; j++)
					{
						val5 = val4[j].m_Citizen;
						if (m_Citizens.HasComponent(val5))
						{
							Citizen val6 = m_Citizens[val5];
							if ((val6.m_State & 8) != 0 && (int)((Citizen)(ref val6)).GetAge() == 2)
							{
								num3 = s_BirthChanceFamily;
							}
							if ((int)((Citizen)(ref val6)).GetAge() == 0 || (int)((Citizen)(ref val6)).GetAge() == 1)
							{
								num4++;
							}
						}
					}
					num3 = (int)math.round((float)num3 * math.pow((float)s_NextBirthChance / 100f, (float)num4));
					if (m_Students.HasComponent(val) || m_Students.HasComponent(val5))
					{
						num3 /= 2;
					}
					if (((Random)(ref random)).NextInt(1000 * kUpdatesPerDay) < num3)
					{
						SpawnBaby(unfilteredChunkIndex, household, ref random, val3);
						m_StatisticsEventQueue.Enqueue(new StatisticsEvent
						{
							m_Statistic = (StatisticType)27,
							m_Change = 1f
						});
					}
				}
			}

			void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
			{
				Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask);
			}
		}

		[BurstCompile]
		private struct SumBirthJob : IJob
		{
			public NativeCounter m_DebugBirthCount;

			public NativeValue<int> m_DebugBirth;

			public void Execute()
			{
				m_DebugBirth.value = ((NativeCounter)(ref m_DebugBirthCount)).Count;
			}
		}

		private struct TypeHandle
		{
			[ReadOnly]
			public EntityTypeHandle __Unity_Entities_Entity_TypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<Citizen> __Game_Citizens_Citizen_RO_ComponentTypeHandle;

			[ReadOnly]
			public ComponentTypeHandle<HouseholdMember> __Game_Citizens_HouseholdMember_RO_ComponentTypeHandle;

			public SharedComponentTypeHandle<UpdateFrame> __Game_Simulation_UpdateFrame_SharedComponentTypeHandle;

			[ReadOnly]
			public ComponentLookup<Citizen> __Game_Citizens_Citizen_RO_ComponentLookup;

			[ReadOnly]
			public BufferLookup<HouseholdCitizen> __Game_Citizens_HouseholdCitizen_RO_BufferLookup;

			[ReadOnly]
			public ComponentLookup<Student> __Game_Citizens_Student_RO_ComponentLookup;

			[ReadOnly]
			public ComponentLookup<PropertyRenter> __Game_Buildings_PropertyRenter_RO_ComponentLookup;

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public void __AssignHandles(ref SystemState state)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				__Unity_Entities_Entity_TypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle();
				__Game_Citizens_Citizen_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Citizen>(true);
				__Game_Citizens_HouseholdMember_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<HouseholdMember>(true);
				__Game_Simulation_UpdateFrame_SharedComponentTypeHandle = ((SystemState)(ref state)).GetSharedComponentTypeHandle<UpdateFrame>();
				__Game_Citizens_Citizen_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Citizen>(true);
				__Game_Citizens_HouseholdCitizen_RO_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<HouseholdCitizen>(true);
				__Game_Citizens_Student_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<Student>(true);
				__Game_Buildings_PropertyRenter_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<PropertyRenter>(true);
			}
		}

		public static readonly int kUpdatesPerDay = 16;

		private EndFrameBarrier m_EndFrameBarrier;

		private SimulationSystem m_SimulationSystem;

		private CityStatisticsSystem m_CityStatisticsSystem;

		private TriggerSystem m_TriggerSystem;

		[DebugWatchValue]
		private NativeValue<int> m_DebugBirth;

		private NativeCounter m_DebugBirthCounter;

		private EntityQuery m_CitizenQuery;

		private EntityQuery m_CitizenPrefabQuery;

		public int m_BirthChance = 20;

		private TypeHandle __TypeHandle;

		private EntityQuery m_TimeDataQuery;

		private static bool s_NoChildrenWhenTooOld;

		private static int s_BirthChanceSingle;

		private static int s_BirthChanceFamily;

		private static int s_NextBirthChance;

		public override int GetUpdateInterval(SystemUpdatePhase phase)
		{
			return 262144 / (kUpdatesPerDay * 16);
		}

		[Preserve]
		protected override void OnCreate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to