Decompiled source of RentControl v1.1.0
RentControl.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Colossal.Collections; using Colossal.Entities; using Colossal.Mathematics; using Colossal.Serialization.Entities; using Game; using Game.Agents; using Game.Areas; using Game.Buildings; using Game.Citizens; using Game.City; using Game.Common; using Game.Companies; using Game.Economy; using Game.Net; using Game.Notifications; using Game.Objects; using Game.Pathfind; using Game.Prefabs; using Game.Serialization; using Game.Simulation; using Game.Tools; using Game.Triggers; using Game.Vehicles; using Game.Zones; using HarmonyLib; using Microsoft.CodeAnalysis; 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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RentControl")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Set upper bound for land value.")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+cbfdb1707f02a28989158ae7b098a08455fde845")] [assembly: AssemblyProduct("RentControl")] [assembly: AssemblyTitle("RentControl")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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 RentControl { [BepInPlugin("RentControl", "RentControl", "1.1.0")] public class Plugin : BaseUnityPlugin { public static ConfigEntry<bool> enable_LandValueCap; public static ConfigEntry<int> m_LandValueCap; public static ConfigEntry<float> RentPaymentFactor; public static ConfigEntry<float> RentUpgradeFactor; public static ConfigEntry<float> BuildingUpkeepFactor; public static ConfigEntry<float> GarbageFeeFactor; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RentControl is loaded!"); enable_LandValueCap = ((BaseUnityPlugin)this).Config.Bind<bool>("LandValueCapEnabled", "LandValueCapEnabled", true, "是否启用地价上限 | Enable land value upper bound, true or false"); m_LandValueCap = ((BaseUnityPlugin)this).Config.Bind<int>("LandValueCap", "LandValueCap", 120000, "地价上限,需填整数(>0) | Land value upper bound, INTEGER needed(>0)"); RentPaymentFactor = ((BaseUnityPlugin)this).Config.Bind<float>("RentPaymentFactor", "RentPaymentFactor", 0.25f, "市民和企业实际支付租金的倍率(0-100) | Proportion% of RENT actually payed by residents and companies(0-100)"); RentUpgradeFactor = ((BaseUnityPlugin)this).Config.Bind<float>("RentUpgradeFactor", "RentUpgradeFactor", 1f, "租金加到建筑升级进度上的倍率(0-100) | Proportion% of RENT actually added to the building level-up progress(0-100)"); BuildingUpkeepFactor = ((BaseUnityPlugin)this).Config.Bind<float>("BuildingUpkeepFactor", "BuildingUpkeepFactor", 0.5f, "建筑升级进度扣除建筑维护费的倍率(0-100) | Proportion% of BUILDING UPKEEP actually subtracted from the building level-up progress(0-100)"); GarbageFeeFactor = ((BaseUnityPlugin)this).Config.Bind<float>("GarbageFeeFactor", "GarbageFeeFactor", 0.5f, "建筑升级进度扣除垃圾清运费的倍率(0-100) | Proportion% of GARBAGE FEE actually subtracted from the building level-up progress(0-100)"); Harmony val = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "RentControl_Cities2Harmony"); MethodBase[] array = val.GetPatchedMethods().ToArray(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin RentControl made patches! Patched methods: " + array.Length)); MethodBase[] array2 = array; foreach (MethodBase methodBase in array2) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched method: " + methodBase.Module.Name + ":" + methodBase.Name)); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "RentControl"; public const string PLUGIN_NAME = "RentControl"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace RentControl.Systems { [CompilerGenerated] public class BuildingUpkeepSystem_Custom : GameSystemBase { [BurstCompile] private struct LandlordUpkeepJob : IJob { public BufferLookup<Resources> m_Resources; public Entity m_Landlords; public NativeQueue<int> m_Queue; public void Execute() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (m_Resources.HasBuffer(m_Landlords)) { int num = 0; int num2 = default(int); while (m_Queue.TryDequeue(ref num2)) { num += num2; } EconomyUtils.AddResources((Resource)1, num, m_Resources[m_Landlords]); } } } [BurstCompile] private struct BuildingUpkeepJob : IJobChunk { [ReadOnly] public EntityTypeHandle m_EntityType; public ComponentTypeHandle<BuildingCondition> m_ConditionType; [ReadOnly] public SharedComponentTypeHandle<UpdateFrame> m_UpdateFrameType; [ReadOnly] public ComponentTypeHandle<PrefabRef> m_PrefabType; [ReadOnly] public ComponentTypeHandle<Building> m_BuildingType; [ReadOnly] public ResourcePrefabs m_ResourcePrefabs; [ReadOnly] public ComponentLookup<ResourceData> m_ResourceDatas; [ReadOnly] public ComponentLookup<BuildingData> m_BuildingDatas; [ReadOnly] public ComponentLookup<BuildingPropertyData> m_BuildingPropertyDatas; [ReadOnly] public ComponentLookup<SpawnableBuildingData> m_SpawnableBuildingData; [ReadOnly] public ComponentLookup<ZoneData> m_ZoneData; [ReadOnly] public ComponentLookup<ConsumptionData> m_ConsumptionDatas; [ReadOnly] public BufferLookup<ResourceAvailability> m_Availabilities; public uint m_UpdateFrameIndex; public uint m_SimulationFrame; public float m_TemperatureUpkeep; public ParallelWriter<int> m_LandlordExpenseQueue; public ParallelWriter m_CommandBuffer; public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask) { //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_002b: 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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_004a: 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_0057: 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_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_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_0082: 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_008c: 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_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_00a0: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_00f7: 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_0104: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_01d1: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024c: 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_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: 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_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: 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_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Invalid comparison between Unknown and I8 //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03db: 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<PrefabRef> nativeArray2 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<PrefabRef>(ref m_PrefabType); NativeArray<BuildingCondition> nativeArray3 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<BuildingCondition>(ref m_ConditionType); NativeArray<Building> nativeArray4 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Building>(ref m_BuildingType); int num = 0; Random val7 = default(Random); for (int i = 0; i < ((ArchetypeChunk)(ref chunk)).Count; i++) { Entity val = nativeArray[i]; Entity prefab = nativeArray2[i].m_Prefab; BuildingData val2 = m_BuildingDatas[prefab]; BuildingPropertyData val3 = m_BuildingPropertyDatas[prefab]; BuildingCondition val4 = nativeArray3[i]; int num2 = m_ConsumptionDatas[prefab].m_Upkeep / kUpdatesPerDay; if (val4.m_Condition < 0) { AreaType val5 = (AreaType)0; if (m_SpawnableBuildingData.HasComponent(prefab)) { SpawnableBuildingData val6 = m_SpawnableBuildingData[prefab]; val5 = m_ZoneData[val6.m_ZonePrefab].m_AreaType; } num2 = Mathf.RoundToInt((float)num2 / PropertyRenterSystem.GetUpkeepExponent(val5)); } if ((double)BuildingUpkeepFactor == 1.0) { val4.m_Condition -= num2; } else { val4.m_Condition -= (int)((float)num2 * BuildingUpkeepFactor); } nativeArray3[i] = val4; int num3 = num2 / kMaterialUpkeep; num += num2 - num3; ((Random)(ref val7))..ctor((uint)(1 + val.Index * m_SimulationFrame)); Resource val8 = (Resource)(((Random)(ref val7)).NextBool() ? 128 : 268435456); float price = m_ResourceDatas[((ResourcePrefabs)(ref m_ResourcePrefabs))[val8]].m_Price; float num4 = math.sqrt((float)(val2.m_LotSize.x * val2.m_LotSize.y * ((BuildingPropertyData)(ref val3)).CountProperties())) * m_TemperatureUpkeep / (float)kUpdatesPerDay; if (((Random)(ref val7)).NextInt(Mathf.RoundToInt(4000f * price)) < num3) { Entity val9 = ((ParallelWriter)(ref m_CommandBuffer)).CreateEntity(unfilteredChunkIndex); ((ParallelWriter)(ref m_CommandBuffer)).AddComponent<GoodsDeliveryRequest>(unfilteredChunkIndex, val9, new GoodsDeliveryRequest { m_Amount = math.max(num2, 4000), m_Flags = (GoodsDeliveryFlags)15, m_Resource = val8, m_Target = val }); } Building val10 = nativeArray4[i]; if (m_Availabilities.HasBuffer(val10.m_RoadEdge)) { float availability = NetUtils.GetAvailability(m_Availabilities[val10.m_RoadEdge], (AvailableResource)8, val10.m_CurvePosition); float availability2 = NetUtils.GetAvailability(m_Availabilities[val10.m_RoadEdge], (AvailableResource)14, val10.m_CurvePosition); float num5 = availability + availability2; if (num5 < 0.001f) { val8 = (Resource)(((Random)(ref val7)).NextBool() ? 64 : 65536); } else { val8 = (Resource)((((Random)(ref val7)).NextFloat(num5) <= availability) ? 64 : 65536); num2 = (((long)val8 == 64) ? 4000 : 800); } price = m_ResourceDatas[((ResourcePrefabs)(ref m_ResourcePrefabs))[val8]].m_Price; if (((Random)(ref val7)).NextFloat((float)num2 * price) < num4) { Entity val11 = ((ParallelWriter)(ref m_CommandBuffer)).CreateEntity(unfilteredChunkIndex); int num6 = Mathf.RoundToInt((float)num2 * price); ((ParallelWriter)(ref m_CommandBuffer)).AddComponent<GoodsDeliveryRequest>(unfilteredChunkIndex, val11, new GoodsDeliveryRequest { m_Amount = num2, m_Flags = (GoodsDeliveryFlags)15, m_Resource = val8, m_Target = val }); num += num6; } } } m_LandlordExpenseQueue.Enqueue(-num); } void IJobChunk.Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask) { Execute(in chunk, unfilteredChunkIndex, useEnabledMask, in chunkEnabledMask); } } private struct TypeHandle { public ComponentTypeHandle<BuildingCondition> __Game_Buildings_BuildingCondition_RW_ComponentTypeHandle; [ReadOnly] public ComponentTypeHandle<PrefabRef> __Game_Prefabs_PrefabRef_RO_ComponentTypeHandle; [ReadOnly] public EntityTypeHandle __Unity_Entities_Entity_TypeHandle; [ReadOnly] public ComponentTypeHandle<Building> __Game_Buildings_Building_RO_ComponentTypeHandle; public SharedComponentTypeHandle<UpdateFrame> __Game_Simulation_UpdateFrame_SharedComponentTypeHandle; [ReadOnly] public ComponentLookup<ConsumptionData> __Game_Prefabs_ConsumptionData_RO_ComponentLookup; [ReadOnly] public BufferLookup<ResourceAvailability> __Game_Net_ResourceAvailability_RO_BufferLookup; [ReadOnly] public ComponentLookup<BuildingData> __Game_Prefabs_BuildingData_RO_ComponentLookup; [ReadOnly] public ComponentLookup<BuildingPropertyData> __Game_Prefabs_BuildingPropertyData_RO_ComponentLookup; [ReadOnly] public ComponentLookup<SpawnableBuildingData> __Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup; [ReadOnly] public ComponentLookup<ZoneData> __Game_Prefabs_ZoneData_RO_ComponentLookup; [ReadOnly] public ComponentLookup<ResourceData> __Game_Prefabs_ResourceData_RO_ComponentLookup; public BufferLookup<Resources> __Game_Economy_Resources_RW_BufferLookup; [MethodImpl(MethodImplOptions.AggressiveInlining)] public void __AssignHandles(ref SystemState state) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_002f: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) __Game_Buildings_BuildingCondition_RW_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<BuildingCondition>(false); __Game_Prefabs_PrefabRef_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<PrefabRef>(true); __Unity_Entities_Entity_TypeHandle = ((SystemState)(ref state)).GetEntityTypeHandle(); __Game_Buildings_Building_RO_ComponentTypeHandle = ((SystemState)(ref state)).GetComponentTypeHandle<Building>(true); __Game_Simulation_UpdateFrame_SharedComponentTypeHandle = ((SystemState)(ref state)).GetSharedComponentTypeHandle<UpdateFrame>(); __Game_Prefabs_ConsumptionData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<ConsumptionData>(true); __Game_Net_ResourceAvailability_RO_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<ResourceAvailability>(true); __Game_Prefabs_BuildingData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<BuildingData>(true); __Game_Prefabs_BuildingPropertyData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<BuildingPropertyData>(true); __Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<SpawnableBuildingData>(true); __Game_Prefabs_ZoneData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<ZoneData>(true); __Game_Prefabs_ResourceData_RO_ComponentLookup = ((SystemState)(ref state)).GetComponentLookup<ResourceData>(true); __Game_Economy_Resources_RW_BufferLookup = ((SystemState)(ref state)).GetBufferLookup<Resources>(false); } } public static readonly int kUpdatesPerDay = 16; public static readonly int kMaterialUpkeep = 4; private SimulationSystem m_SimulationSystem; private EndFrameBarrier m_EndFrameBarrier; private CustomPropertyRenterSystem m_PropertyRenterSystem; private ResourceSystem m_ResourceSystem; private ClimateSystem m_ClimateSystem; private NativeQueue<int> m_ExpenseQueue; private EntityQuery m_BuildingGroup; private static float BuildingUpkeepFactor; private TypeHandle __TypeHandle; public override int GetUpdateInterval(SystemUpdatePhase phase) { return 262144 / (kUpdatesPerDay * 16); } public static float GetHeatingMultiplier(float temperature) { return math.max(0f, 15f - temperature); } [Preserve] protected override void OnCreate() { //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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00ed: 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_0111: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0146: Unknown result type (might be due to invalid IL or missing references) ((GameSystemBase)this).OnCreate(); BuildingUpkeepFactor = Plugin.BuildingUpkeepFactor.Value; BuildingUpkeepFactor = ((BuildingUpkeepFactor > 0f) ? BuildingUpkeepFactor : 0f); BuildingUpkeepFactor = ((BuildingUpkeepFactor < 100f) ? BuildingUpkeepFactor : 100f); m_SimulationSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<SimulationSystem>(); m_EndFrameBarrier = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<EndFrameBarrier>(); m_PropertyRenterSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<CustomPropertyRenterSystem>(); m_ResourceSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ResourceSystem>(); m_ClimateSystem = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ClimateSystem>(); m_ExpenseQueue = new NativeQueue<int>(AllocatorHandle.op_Implicit((Allocator)4)); EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val = new EntityQueryDesc(); val.All = (ComponentType[])(object)new ComponentType[3] { ComponentType.ReadOnly<BuildingCondition>(), ComponentType.ReadOnly<PrefabRef>(), ComponentType.ReadOnly<UpdateFrame>() }; val.Any = (ComponentType[])(object)new ComponentType[0]; val.None = (ComponentType[])(object)new ComponentType[4] { ComponentType.ReadOnly<Abandoned>(), ComponentType.ReadOnly<Destroyed>(), ComponentType.ReadOnly<Deleted>(), ComponentType.ReadOnly<Temp>() }; array[0] = val; m_BuildingGroup = ((ComponentSystemBase)this).GetEntityQuery((EntityQueryDesc[])(object)array); } [Preserve] protected override void OnDestroy() { ((GameSystemBase)this).OnDestroy(); m_ExpenseQueue.Dispose(); } [Preserve] protected override void OnUpdate() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: 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_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: 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_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0307: 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_0318: 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) uint updateFrame = SimulationUtils.GetUpdateFrame(m_SimulationSystem.frameIndex, kUpdatesPerDay, 16); __TypeHandle.__Game_Prefabs_ResourceData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Prefabs_ZoneData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Prefabs_BuildingPropertyData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Prefabs_BuildingData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Net_ResourceAvailability_RO_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Prefabs_ConsumptionData_RO_ComponentLookup.Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Simulation_UpdateFrame_SharedComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Buildings_Building_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef); ((EntityTypeHandle)(ref __TypeHandle.__Unity_Entities_Entity_TypeHandle)).Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef); __TypeHandle.__Game_Buildings_BuildingCondition_RW_ComponentTypeHandle.Update(ref ((SystemBase)this).CheckedStateRef); BuildingUpkeepJob buildingUpkeepJob = default(BuildingUpkeepJob); buildingUpkeepJob.m_ConditionType = __TypeHandle.__Game_Buildings_BuildingCondition_RW_ComponentTypeHandle; buildingUpkeepJob.m_PrefabType = __TypeHandle.__Game_Prefabs_PrefabRef_RO_ComponentTypeHandle; buildingUpkeepJob.m_EntityType = __TypeHandle.__Unity_Entities_Entity_TypeHandle; buildingUpkeepJob.m_BuildingType = __TypeHandle.__Game_Buildings_Building_RO_ComponentTypeHandle; buildingUpkeepJob.m_UpdateFrameType = __TypeHandle.__Game_Simulation_UpdateFrame_SharedComponentTypeHandle; buildingUpkeepJob.m_ConsumptionDatas = __TypeHandle.__Game_Prefabs_ConsumptionData_RO_ComponentLookup; buildingUpkeepJob.m_Availabilities = __TypeHandle.__Game_Net_ResourceAvailability_RO_BufferLookup; buildingUpkeepJob.m_BuildingDatas = __TypeHandle.__Game_Prefabs_BuildingData_RO_ComponentLookup; buildingUpkeepJob.m_BuildingPropertyDatas = __TypeHandle.__Game_Prefabs_BuildingPropertyData_RO_ComponentLookup; buildingUpkeepJob.m_SpawnableBuildingData = __TypeHandle.__Game_Prefabs_SpawnableBuildingData_RO_ComponentLookup; buildingUpkeepJob.m_ZoneData = __TypeHandle.__Game_Prefabs_ZoneData_RO_ComponentLookup; buildingUpkeepJob.m_ResourcePrefabs = m_ResourceSystem.GetPrefabs(); buildingUpkeepJob.m_ResourceDatas = __TypeHandle.__Game_Prefabs_ResourceData_RO_ComponentLookup; buildingUpkeepJob.m_UpdateFrameIndex = updateFrame; buildingUpkeepJob.m_SimulationFrame = m_SimulationSystem.frameIndex; EntityCommandBuffer val = ((SafeCommandBufferSystem)m_EndFrameBarrier).CreateCommandBuffer(); buildingUpkeepJob.m_CommandBuffer = ((EntityCommandBuffer)(ref val)).AsParallelWriter(); buildingUpkeepJob.m_LandlordExpenseQueue = m_ExpenseQueue.AsParallelWriter(); buildingUpkeepJob.m_TemperatureUpkeep = GetHeatingMultiplier(OverridableProperty<float>.op_Implicit(m_ClimateSystem.temperature)); BuildingUpkeepJob buildingUpkeepJob2 = buildingUpkeepJob; ((SystemBase)this).Dependency = JobChunkExtensions.ScheduleParallel<BuildingUpkeepJob>(buildingUpkeepJob2, m_BuildingGroup, ((SystemBase)this).Dependency); m_EndFrameBarrier.AddJobHandleForProducer(((SystemBase)this).Dependency); m_ResourceSystem.AddPrefabsReader(((SystemBase)this).Dependency); __TypeHandle.__Game_Economy_Resources_RW_BufferLookup.Update(ref ((SystemBase)this).CheckedStateRef); LandlordUpkeepJob landlordUpkeepJob = default(LandlordUpkeepJob); landlordUpkeepJob.m_Resources = __TypeHandle.__Game_Economy_Resources_RW_BufferLookup; landlordUpkeepJob.m_Landlords = m_PropertyRenterSystem.Landlords; landlordUpkeepJob.m_Queue = m_ExpenseQueue; LandlordUpkeepJob landlordUpkeepJob2 = landlordUpkeepJob; ((SystemBase)this).Dependency = IJobExtensions.Schedule<LandlordUpkeepJob>(landlordUpkeepJob2, ((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 BuildingUpkeepSystem_Custom() { } } [HarmonyPatch(typeof(BuildingUpkeepSystem), "OnCreate")] public class BuildingUpkeepSystem_OnCreatePatch { private static bool Prefix(BuildingUpkeepSystem __instance) { ((ComponentSystemBase)__instance).World.GetOrCreateSystemManaged<BuildingUpkeepSystem_Custom>(); ((ComponentSystemBase)__instance).World.GetOrCreateSystemManaged<UpdateSystem>().UpdateAt<BuildingUpkeepSystem_Custom>((SystemUpdatePhase)12); return true; } } [HarmonyPatch(typeof(BuildingUpkeepSystem), "OnCreateForCompiler")] public class BuildingUpkeepSystem_OnCreateForCompilerPatch { private static bool Prefix(BuildingUpkeepSystem __instance) { return false; } } [HarmonyPatch(typeof(BuildingUpkeepSystem), "OnUpdate")] public class BuildingUpkeepSystem_OnUpdatePatch { private static bool Prefix(BuildingUpkeepSystem __instance) { ((ComponentSystemBase)((ComponentSystemBase)__instance).World.GetOrCreateSystemManaged<BuildingUpkeepSystem_Custom>()).Update(); return false; } } [CompilerGenerated] public class CustomGarbageTruckAISystem : GameSystemBase { private enum GarbageActionType { Collect, Unload, AddRequest } private struct GarbageAction { public Entity m_Vehicle; public Entity m_Target; public Entity m_Request; public GarbageActionType m_Type; public int m_Capacity; public int m_MaxAmount; } [BurstCompile] private struct GarbageTruckTickJob : IJobChunk { [ReadOnly] public EntityTypeHandle m_EntityType; [ReadOnly] public ComponentTypeHandle<Owner> m_OwnerType; [ReadOnly] public ComponentTypeHandle<Unspawned> m_UnspawnedType; [ReadOnly] public ComponentTypeHandle<PrefabRef> m_PrefabRefType; [ReadOnly] public ComponentTypeHandle<PathInformation> m_PathInformationType; public ComponentTypeHandle<GarbageTruck> m_GarbageTruckType; public ComponentTypeHandle<Car> m_CarType; public ComponentTypeHandle<CarCurrentLane> m_CurrentLaneType; public ComponentTypeHandle<Target> m_TargetType; public ComponentTypeHandle<PathOwner> m_PathOwnerType; public BufferTypeHandle<CarNavigationLane> m_CarNavigationLaneType; public BufferTypeHandle<ServiceDispatch> m_ServiceDispatchType; [ReadOnly] public ComponentLookup<Owner> m_OwnerData; [ReadOnly] public ComponentLookup<PathInformation> m_PathInformationData; [ReadOnly] public ComponentLookup<Quantity> m_QuantityData; [ReadOnly] public ComponentLookup<SlaveLane> m_SlaveLaneData; [ReadOnly] public ComponentLookup<EdgeLane> m_EdgeLaneData; [ReadOnly] public ComponentLookup<PedestrianLane> m_PedestrianLaneData; [ReadOnly] public ComponentLookup<Curve> m_CurveData; [ReadOnly] public ComponentLookup<CarData> m_PrefabCarData; [ReadOnly] public ComponentLookup<GarbageTruckData> m_PrefabGarbageTruckData; [ReadOnly] public ComponentLookup<PrefabRef> m_PrefabRefData; [ReadOnly] public ComponentLookup<SpawnableBuildingData> m_PrefabSpawnableBuildingData; [ReadOnly] public ComponentLookup<ZoneData> m_PrefabZoneData; [ReadOnly] public ComponentLookup<GarbageCollectionRequest> m_GarbageCollectionRequestData; [ReadOnly] public ComponentLookup<GarbageProducer> m_GarbageProducerData; [ReadOnly] public ComponentLookup<GarbageFacility> m_GarbageFacilityData; [ReadOnly] public BufferLookup<SubObject> m_SubObjects; [ReadOnly] public BufferLookup<ConnectedBuilding> m_ConnectedBuildings; [ReadOnly] public BufferLookup<SubLane> m_SubLanes; [NativeDisableParallelForRestriction] public BufferLookup<PathElement> m_PathElements; [ReadOnly] public uint m_SimulationFrameIndex; [ReadOnly] public EntityArchetype m_GarbageCollectionRequestArchetype; [ReadOnly] public EntityArchetype m_HandleRequestArchetype; [ReadOnly] public GarbageParameterData m_GarbageParameters; public ParallelWriter m_CommandBuffer; public ParallelWriter<SetupQueueItem> m_PathfindQueue; public ParallelWriter<GarbageAction> m_ActionQueue; public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0079: 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_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_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_00bd: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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) //IL_00d8: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0120: 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_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_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_013e: 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_0142: 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_0146: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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) NativeArray<Entity> nativeArray = ((ArchetypeChunk)(ref chunk)).GetNativeArray(m_EntityType); NativeArray<Owner> nativeArray2 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Owner>(ref m_OwnerType); NativeArray<PrefabRef> nativeArray3 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<PrefabRef>(ref m_PrefabRefType); NativeArray<PathInformation> nativeArray4 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<PathInformation>(ref m_PathInformationType); NativeArray<CarCurrentLane> nativeArray5 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<CarCurrentLane>(ref m_CurrentLaneType); NativeArray<GarbageTruck> nativeArray6 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<GarbageTruck>(ref m_GarbageTruckType); NativeArray<Car> nativeArray7 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Car>(ref m_CarType); NativeArray<Target> nativeArray8 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<Target>(ref m_TargetType); NativeArray<PathOwner> nativeArray9 = ((ArchetypeChunk)(ref chunk)).GetNativeArray<PathOwner>(ref m_PathOwnerType); BufferAccessor<CarNavigationLane> bufferAccessor = ((ArchetypeChunk)(ref chunk)).GetBufferAccessor<CarNavigationLane>(ref m_CarNavigationLaneType); BufferAccessor<ServiceDispatch> bufferAccessor2 = ((ArchetypeChunk)(ref chunk)).GetBufferAccessor<ServiceDispatch>(ref m_ServiceDispatchType); bool flag = ((ArchetypeChunk)(ref chunk)).Has<Unspawned>(ref m_UnspawnedType); for (int i = 0; i < nativeArray.Length; i++) { Entity val = nativeArray[i]; Owner owner = nativeArray2[i]; PrefabRef prefabRef = nativeArray3[i]; PathInformation pathInformation = nativeArray4[i]; GarbageTruck garbageTruck = nativeArray6[i]; Car car = nativeArray7[i]; CarCurrentLane currentLane = nativeArray5[i]; PathOwner pathOwner = nativeArray9[i]; Target target = nativeArray8[i]; DynamicBuffer<CarNavigationLane> navigationLanes = bufferAccessor[i]; DynamicBuffer<ServiceDispatch> serviceDispatches = bufferAccessor2[i]; VehicleUtils.CheckUnspawned(unfilteredChunkIndex, val, currentLane, flag, m_CommandBuffer); Tick(unfilteredChunkIndex, val, owner, prefabRef, pathInformation, navigationLanes, serviceDispatches, ref garbageTruck, ref car, ref currentLane, ref pathOwner, ref target); nativeArray6[i] = garbageTruck; nativeArray7[i] = car; nativeArray5[i] = currentLane; nativeArray9[i] = pathOwner; nativeArray8[i] = target; } } private void Tick(int jobIndex, Entity vehicleEntity, Owner owner, PrefabRef prefabRef, PathInformation pathInformation, DynamicBuffer<CarNavigationLane> navigationLanes, DynamicBuffer<ServiceDispatch> serviceDispatches, ref GarbageTruck garbageTruck, ref Car car, ref CarCurrentLane currentLane, ref PathOwner pathOwner, ref Target target) { //IL_0027: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_00cf: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Invalid comparison between Unknown and I4 //IL_006c: 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_0074: Invalid comparison between Unknown and I4 //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Invalid comparison between Unknown and I4 //IL_01bd: 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_01c5: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_0156: 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_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_00f8: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_00b6: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Invalid comparison between Unknown and I4 //IL_009e: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0281: 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_0289: Invalid comparison between Unknown and I4 //IL_0226: 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_020b: 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_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Invalid comparison between Unknown and I4 //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030a: 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_02b9: 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_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Invalid comparison between Unknown and I4 //IL_02f1: Unknown result type (might be due to invalid IL or missing references) if (VehicleUtils.ResetUpdatedPath(ref pathOwner)) { ResetPath(jobIndex, vehicleEntity, pathInformation, serviceDispatches, ref garbageTruck, ref car, ref currentLane); } GarbageTruckData val = m_PrefabGarbageTruckData[prefabRef.m_Prefab]; if (!m_PrefabRefData.HasComponent(target.m_Target) || VehicleUtils.PathfindFailed(pathOwner)) { if (VehicleUtils.IsStuck(pathOwner) || (garbageTruck.m_State & 1) > 0) { if (UnloadGarbage(jobIndex, vehicleEntity, val, owner.m_Owner, ref garbageTruck, instant: true)) { ((ParallelWriter)(ref m_CommandBuffer)).AddComponent<Deleted>(jobIndex, vehicleEntity, default(Deleted)); } return; } ReturnToDepot(owner, serviceDispatches, ref garbageTruck, ref car, ref pathOwner, ref target); } else if (VehicleUtils.PathEndReached(currentLane)) { if ((garbageTruck.m_State & 1) > 0) { if (UnloadGarbage(jobIndex, vehicleEntity, val, owner.m_Owner, ref garbageTruck, instant: false)) { ((ParallelWriter)(ref m_CommandBuffer)).AddComponent<Deleted>(jobIndex, vehicleEntity, default(Deleted)); } return; } TryCollectGarbage(jobIndex, vehicleEntity, val, ref garbageTruck, ref car, ref currentLane, target.m_Target); TryCollectGarbage(jobIndex, vehicleEntity, val, ref garbageTruck, ref car, ref target); CheckServiceDispatches(vehicleEntity, serviceDispatches, ref garbageTruck, ref pathOwner); if (!SelectNextDispatch(jobIndex, vehicleEntity, navigationLanes, serviceDispatches, ref garbageTruck, ref car, ref currentLane, ref pathOwner, ref target)) { ReturnToDepot(owner, serviceDispatches, ref garbageTruck, ref car, ref pathOwner, ref target); } } else if (VehicleUtils.WaypointReached(currentLane)) { ref CarLaneFlags laneFlags = ref currentLane.m_LaneFlags; laneFlags = (CarLaneFlags)((uint)laneFlags & 0xFFFFFDFFu); TryCollectGarbage(jobIndex, vehicleEntity, val, ref garbageTruck, ref car, ref currentLane, Entity.Null); } if ((garbageTruck.m_State & 1) == 0) { if (garbageTruck.m_Garbage >= val.m_GarbageCapacity || (garbageTruck.m_State & 8) > 0) { ReturnToDepot(owner, serviceDispatches, ref garbageTruck, ref car, ref pathOwner, ref target); } else { CheckGarbagePresence(ref currentLane, ref garbageTruck, ref car, navigationLanes); } } if (garbageTruck.m_Garbage + garbageTruck.m_EstimatedGarbage >= val.m_GarbageCapacity) { ref GarbageTruckFlags state = ref garbageTruck.m_State; state = (GarbageTruckFlags)((uint)state | 0x10u); } else { ref GarbageTruckFlags state2 = ref garbageTruck.m_State; state2 = (GarbageTruckFlags)((uint)state2 & 0xFFFFFFEFu); } if (garbageTruck.m_Garbage < val.m_GarbageCapacity && (garbageTruck.m_State & 8) == 0) { CheckServiceDispatches(vehicleEntity, serviceDispatches, ref garbageTruck, ref pathOwner); if ((garbageTruck.m_State & 1) > 0) { SelectNextDispatch(jobIndex, vehicleEntity, navigationLanes, serviceDispatches, ref garbageTruck, ref car, ref currentLane, ref pathOwner, ref target); } if (garbageTruck.m_RequestCount <= 1 && (garbageTruck.m_State & 0x10) == 0) { RequestTargetIfNeeded(jobIndex, vehicleEntity, ref garbageTruck); } } else { serviceDispatches.Clear(); } FindPathIfNeeded(vehicleEntity, prefabRef, ref currentLane, ref pathOwner, ref target); } private void FindPathIfNeeded(Entity vehicleEntity, PrefabRef prefabRefData, ref CarCurrentLane currentLaneData, ref PathOwner pathOwnerData, ref Target target) { //IL_0003: 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_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_003c: 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_0068: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ae: 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_00bf: 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_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_00da: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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) if (VehicleUtils.RequireNewPath(pathOwnerData)) { CarData val = m_PrefabCarData[prefabRefData.m_Prefab]; PathfindParameters val2 = default(PathfindParameters); val2.m_MaxSpeed = float2.op_Implicit(val.m_MaxSpeed); val2.m_WalkSpeed = float2.op_Implicit(5.555556f); val2.m_Weights = new PathfindWeights(1f, 1f, 1f, 1f); val2.m_Methods = (PathMethod)2; val2.m_IgnoredFlags = (EdgeFlags)15872; PathfindParameters val3 = val2; SetupQueueTarget val4 = default(SetupQueueTarget); val4.m_Type = (SetupTargetType)0; val4.m_Methods = (PathMethod)2; val4.m_RoadTypes = (RoadTypes)1; SetupQueueTarget val5 = val4; val4 = default(SetupQueueTarget); val4.m_Type = (SetupTargetType)0; val4.m_Methods = (PathMethod)2; val4.m_RoadTypes = (RoadTypes)1; val4.m_Entity = target.m_Target; SetupQueueTarget val6 = val4; SetupQueueItem val7 = default(SetupQueueItem); ((SetupQueueItem)(ref val7))..ctor(vehicleEntity, val3, val5, val6); VehicleUtils.SetupPathfind(ref currentLaneData, ref pathOwnerData, m_PathfindQueue, val7); } } private void CheckServiceDispatches(Entity vehicleEntity, DynamicBuffer<ServiceDispatch> serviceDispatches, ref GarbageTruck garbageTruck, ref PathOwner pathOwner) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0084: 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_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_00a7: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: 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_00d6: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022d: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) if (serviceDispatches.Length <= garbageTruck.m_RequestCount) { return; } int num = -1; Entity val = Entity.Null; PathElement val2 = default(PathElement); bool flag = false; int num2 = 0; if (garbageTruck.m_RequestCount >= 1 && (garbageTruck.m_State & 1) == 0) { DynamicBuffer<PathElement> val3 = m_PathElements[vehicleEntity]; num2 = 1; if (pathOwner.m_ElementIndex < val3.Length) { val2 = val3[val3.Length - 1]; flag = true; } } DynamicBuffer<PathElement> val4 = default(DynamicBuffer<PathElement>); for (int i = num2; i < garbageTruck.m_RequestCount; i++) { Entity request = serviceDispatches[i].m_Request; if (m_PathElements.TryGetBuffer(request, ref val4) && val4.Length != 0) { val2 = val4[val4.Length - 1]; flag = true; } } DynamicBuffer<PathElement> val6 = default(DynamicBuffer<PathElement>); for (int j = garbageTruck.m_RequestCount; j < serviceDispatches.Length; j++) { Entity request2 = serviceDispatches[j].m_Request; if (!m_GarbageCollectionRequestData.HasComponent(request2)) { continue; } GarbageCollectionRequest val5 = m_GarbageCollectionRequestData[request2]; if (flag && m_PathElements.TryGetBuffer(request2, ref val6) && val6.Length != 0) { PathElement val7 = val6[0]; if (val7.m_Target != val2.m_Target || val7.m_TargetDelta.x != val2.m_TargetDelta.y) { continue; } } if (m_PrefabRefData.HasComponent(val5.m_Target) && val5.m_Priority > num) { num = val5.m_Priority; val = request2; } } if (val != Entity.Null) { int requestCount = garbageTruck.m_RequestCount; garbageTruck.m_RequestCount = requestCount + 1; serviceDispatches[requestCount] = new ServiceDispatch(val); PreAddCollectionRequests(val, ref garbageTruck); } if (serviceDispatches.Length > garbageTruck.m_RequestCount) { serviceDispatches.RemoveRange(garbageTruck.m_RequestCount, serviceDispatches.Length - garbageTruck.m_RequestCount); } } private void PreAddCollectionRequests(Entity request, ref GarbageTruck garbageTruck) { //IL_0007: 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_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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0038: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0074: 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_0056: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0096: 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_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) if (!m_PathElements.HasBuffer(request)) { return; } DynamicBuffer<PathElement> val = m_PathElements[request]; Entity val2 = Entity.Null; for (int i = 0; i < val.Length; i++) { PathElement val3 = val[i]; if (!m_EdgeLaneData.HasComponent(val3.m_Target)) { val2 = Entity.Null; continue; } Owner val4 = m_OwnerData[val3.m_Target]; if (!(val4.m_Owner == val2)) { val2 = val4.m_Owner; if (HasSidewalk(val4.m_Owner)) { garbageTruck.m_EstimatedGarbage += AddCollectionRequests(val4.m_Owner, request, ref garbageTruck); } } } } private bool HasSidewalk(Entity owner) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (m_SubLanes.HasBuffer(owner)) { DynamicBuffer<SubLane> val = m_SubLanes[owner]; for (int i = 0; i < val.Length; i++) { Entity subLane = val[i].m_SubLane; if (m_PedestrianLaneData.HasComponent(subLane)) { return true; } } } return false; } private void RequestTargetIfNeeded(int jobIndex, Entity entity, ref GarbageTruck garbageTruck) { //IL_0008: 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_0052: 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_0066: 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_006a: 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_0077: 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_008c: Unknown result type (might be due to invalid IL or missing references) if (!m_GarbageCollectionRequestData.HasComponent(garbageTruck.m_TargetRequest)) { uint num = math.max(512u, 16u); if ((m_SimulationFrameIndex & (num - 1)) == 2) { Entity val = ((ParallelWriter)(ref m_CommandBuffer)).CreateEntity(jobIndex, m_GarbageCollectionRequestArchetype); ((ParallelWriter)(ref m_CommandBuffer)).SetComponent<ServiceRequest>(jobIndex, val, new ServiceRequest(true)); ((ParallelWriter)(ref m_CommandBuffer)).SetComponent<GarbageCollectionRequest>(jobIndex, val, new GarbageCollectionRequest(entity, 1, (GarbageCollectionRequestFlags)(((garbageTruck.m_State & 2) != 0) ? 1 : 0))); ((ParallelWriter)(ref m_CommandBuffer)).SetComponent<RequestGroup>(jobIndex, val, new RequestGroup(32u)); } } } private bool SelectNextDispatch(int jobIndex, Entity vehicleEntity, DynamicBuffer<CarNavigationLane> navigationLanes, DynamicBuffer<ServiceDispatch> serviceDispatches, ref GarbageTruck garbageTruck, ref Car car, ref CarCurrentLane currentLane, ref PathOwner pathOwner, ref Target target) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_007a: 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_00be: 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_00c9: 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_00cd: 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_012e: 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_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_010c: 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_0115: 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_0335: 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_0166: 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_016c: 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_018e: 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_019e: 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_01a1: 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_01aa: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: 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_021d: 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_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0323: 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_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_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) if ((garbageTruck.m_State & 1) == 0 && garbageTruck.m_RequestCount > 0 && serviceDispatches.Length > 0) { serviceDispatches.RemoveAt(0); garbageTruck.m_RequestCount--; } int num2 = default(int); NativeArray<PathElement> val7 = default(NativeArray<PathElement>); while (garbageTruck.m_RequestCount > 0 && serviceDispatches.Length > 0) { Entity request = serviceDispatches[0].m_Request; Entity val = Entity.Null; if (m_GarbageCollectionRequestData.HasComponent(request)) { val = m_GarbageCollectionRequestData[request].m_Target; } if (m_PrefabRefData.HasComponent(val)) { ref GarbageTruckFlags state = ref garbageTruck.m_State; state = (GarbageTruckFlags)((uint)state & 0xFFFFFFFEu); ref CarFlags flags = ref car.m_Flags; flags = (CarFlags)((uint)flags | 0x20u); Entity val2 = ((ParallelWriter)(ref m_CommandBuffer)).CreateEntity(jobIndex, m_HandleRequestArchetype); ((ParallelWriter)(ref m_CommandBuffer)).SetComponent<HandleRequest>(jobIndex, val2, new HandleRequest(request, vehicleEntity, false, true)); if (m_GarbageCollectionRequestData.HasComponent(garbageTruck.m_TargetRequest)) { val2 = ((ParallelWriter)(ref m_CommandBuffer)).CreateEntity(jobIndex, m_HandleRequestArchetype); ((ParallelWriter)(ref m_CommandBuffer)).SetComponent<HandleRequest>(jobIndex, val2, new HandleRequest(garbageTruck.m_TargetRequest, Entity.Null, true, false)); } if (m_PathElements.HasBuffer(request)) { DynamicBuffer<PathElement> val3 = m_PathElements[request]; if (val3.Length != 0) { DynamicBuffer<PathElement> val4 = m_PathElements[vehicleEntity]; PathUtils.TrimPath(val4, ref pathOwner); float num = garbageTruck.m_PathElementTime * (float)val4.Length + m_PathInformationData[request].m_Duration; if (PathUtils.TryAppendPath(ref currentLane, navigationLanes, val4, val3, m_SlaveLaneData, m_OwnerData, m_SubLanes, ref num2)) { int num3 = val4.Length - num2; int num4 = 0; for (int i = 0; i < num3; i++) { PathElement val5 = val4[i]; if (m_PedestrianLaneData.HasComponent(val5.m_Target)) { Owner val6 = m_OwnerData[val5.m_Target]; num4 += AddCollectionRequests(val6.m_Owner, request, ref garbageTruck); } } if (num2 > 0) { val7..ctor(num2, (Allocator)2, (NativeArrayOptions)1); for (int j = 0; j < num2; j++) { val7[j] = val4[num3 + j]; } val4.RemoveRange(num3, num2); Entity lastOwner = Entity.Null; for (int k = 0; k < val7.Length; k++) { num4 += AddPathElement(val4, val7[k], request, ref lastOwner, ref garbageTruck); } val7.Dispose(); } if (garbageTruck.m_RequestCount == 1) { garbageTruck.m_EstimatedGarbage = num4; } ref CarFlags flags2 = ref car.m_Flags; flags2 = (CarFlags)((uint)flags2 | 2u); garbageTruck.m_PathElementTime = num / (float)math.max(1, val4.Length); target.m_Target = val; VehicleUtils.ClearEndOfPath(ref currentLane, navigationLanes); return true; } } } VehicleUtils.SetTarget(ref pathOwner, ref target, val); return true; } serviceDispatches.RemoveAt(0); garbageTruck.m_EstimatedGarbage -= garbageTruck.m_EstimatedGarbage / garbageTruck.m_RequestCount; garbageTruck.m_RequestCount--; } return false; } private void ReturnToDepot(Owner ownerData, DynamicBuffer<ServiceDispatch> serviceDispatches, ref GarbageTruck garbageTruck, ref Car car, ref PathOwner pathOwnerData, ref Target targetData) { //IL_0036: 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) serviceDispatches.Clear(); garbageTruck.m_RequestCount = 0; garbageTruck.m_EstimatedGarbage = 0; ref GarbageTruckFlags state = ref garbageTruck.m_State; state = (GarbageTruckFlags)((uint)state | 1u); ref CarFlags flags = ref car.m_Flags; flags = (CarFlags)((uint)flags & 0xFFFFFDF7u); VehicleUtils.SetTarget(ref pathOwnerData, ref targetData, ownerData.m_Owner); } private void ResetPath(int jobIndex, Entity vehicleEntity, PathInformation pathInformation, DynamicBuffer<ServiceDispatch> serviceDispatches, ref GarbageTruck garbageTruck, ref Car carData, ref CarCurrentLane currentLane) { //IL_0007: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_012c: 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_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_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) DynamicBuffer<PathElement> val = m_PathElements[vehicleEntity]; PathUtils.ResetPath(ref currentLane, val, m_SlaveLaneData, m_OwnerData, m_SubLanes); if ((garbageTruck.m_State & 1) == 0 && garbageTruck.m_RequestCount > 0 && serviceDispatches.Length > 0) { Entity request = serviceDispatches[0].m_Request; if (m_GarbageCollectionRequestData.HasComponent(request)) { NativeArray<PathElement> val2 = default(NativeArray<PathElement>); val2..ctor(val.Length, (Allocator)2, (NativeArrayOptions)1); val2.CopyFrom(val.AsNativeArray()); val.Clear(); Entity lastOwner = Entity.Null; int estimatedGarbage = 0; for (int i = 0; i < val2.Length; i++) { estimatedGarbage = AddPathElement(val, val2[i], request, ref lastOwner, ref garbageTruck); } if (garbageTruck.m_RequestCount == 1) { garbageTruck.m_EstimatedGarbage = estimatedGarbage; } val2.Dispose(); } ref CarFlags flags = ref carData.m_Flags; flags = (CarFlags)((uint)flags | 2u); } else { ref CarFlags flags2 = ref carData.m_Flags; flags2 = (CarFlags)((uint)flags2 & 0xFFFFFFFDu); } ref CarFlags flags3 = ref carData.m_Flags; flags3 = (CarFlags)((uint)flags3 | 0x20u); garbageTruck.m_PathElementTime = pathInformation.m_Duration / (float)math.max(1, val.Length); } private int AddPathElement(DynamicBuffer<PathElement> path, PathElement pathElement, Entity request, ref Entity lastOwner, ref GarbageTruck garbageTruck) { //IL_0009: 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_0041: 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_004c: 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_004e: 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_0020: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0081: 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_008e: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_00ab: 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_00bc: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) int result = 0; if (!m_EdgeLaneData.HasComponent(pathElement.m_Target)) { path.Add(pathElement); lastOwner = Entity.Null; return result; } Owner val = m_OwnerData[pathElement.m_Target]; if (val.m_Owner == lastOwner) { path.Add(pathElement); return result; } lastOwner = val.m_Owner; float curvePos = pathElement.m_TargetDelta.y; if (FindClosestSidewalk(pathElement.m_Target, val.m_Owner, ref curvePos, out var sidewalk)) { result = AddCollectionRequests(val.m_Owner, request, ref garbageTruck); path.Add(pathElement); path.Add(new PathElement(sidewalk, float2.op_Implicit(curvePos), (PathElementFlags)0)); } else { path.Add(pathElement); } return result; } private bool FindClosestSidewalk(Entity lane, Entity owner, ref float curvePos, out Entity sidewalk) { //IL_0005: 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_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0042: 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_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_0064: 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_0080: 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_008c: 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_00ae: 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) bool result = false; sidewalk = Entity.Null; if (m_SubLanes.HasBuffer(owner)) { float3 val = MathUtils.Position(m_CurveData[lane].m_Bezier, curvePos); DynamicBuffer<SubLane> val2 = m_SubLanes[owner]; float num = float.MaxValue; float num2 = default(float); for (int i = 0; i < val2.Length; i++) { Entity subLane = val2[i].m_SubLane; if (m_PedestrianLaneData.HasComponent(subLane)) { float num3 = MathUtils.Distance(MathUtils.Line(m_CurveData[subLane].m_Bezier), val, ref num2); if (num3 < num) { curvePos = num2; sidewalk = subLane; num = num3; result = true; } } } } return result; } private int AddCollectionRequests(Entity edgeEntity, Entity request, ref GarbageTruck garbageTruck) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0064: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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) int num = 0; if (m_ConnectedBuildings.HasBuffer(edgeEntity)) { DynamicBuffer<ConnectedBuilding> val = m_ConnectedBuildings[edgeEntity]; GarbageProducer val2 = default(GarbageProducer); for (int i = 0; i < val.Length; i++) { Entity building = val[i].m_Building; if (m_GarbageProducerData.TryGetComponent(building, ref val2) && ((garbageTruck.m_State & 2) == 0 || IsIndustrial(m_PrefabRefData[building].m_Prefab))) { num += val2.m_Garbage; m_ActionQueue.Enqueue(new GarbageAction { m_Type = GarbageActionType.AddRequest, m_Request = request, m_Target = building }); } } } return num; } private void CheckGarbagePresence(ref CarCurrentLane currentLaneData, ref GarbageTruck garbageTruck, ref Car car, DynamicBuffer<CarNavigationLane> navigationLanes) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 //IL_001b: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Invalid comparison between Unknown and I4 //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Invalid comparison between Unknown and I4 //IL_00db: Unknown result type (might be due to invalid IL or missing references) if ((currentLaneData.m_LaneFlags & 0x600) == 512) { if (!CheckGarbagePresence(currentLaneData.m_Lane, ref garbageTruck)) { ref CarLaneFlags laneFlags = ref currentLaneData.m_LaneFlags; laneFlags = (CarLaneFlags)((uint)laneFlags & 0xFFFFFDFFu); ref CarFlags flags = ref car.m_Flags; flags = (CarFlags)((uint)flags & 0xFFFFFDF7u); } ref CarLaneFlags laneFlags2 = ref currentLaneData.m_LaneFlags; laneFlags2 = (CarLaneFlags)((uint)laneFlags2 | 0x400u); } if ((currentLaneData.m_LaneFlags & 0x200) > 0) { ref CarFlags flags2 = ref car.m_Flags; flags2 = (CarFlags)((uint)flags2 | (uint)((math.abs(currentLaneData.m_CurvePosition.x - currentLaneData.m_CurvePosition.z) < 0.5f) ? 520 : 8)); return; } for (int i = 0; i < navigationLanes.Length; i++) { ref CarNavigationLane reference = ref navigationLanes.ElementAt(i); if ((reference.m_Flags & 0x600) == 512) { if (!CheckGarbagePresence(reference.m_Lane, ref garbageTruck)) { ref CarLaneFlags flags3 = ref reference.m_Flags; flags3 = (CarLaneFlags)((uint)flags3 & 0xFFFFFDFFu); ref CarFlags flags4 = ref car.m_Flags; flags4 = (CarFlags)((uint)flags4 & 0xFFFFFFF7u); } ref CarLaneFlags flags5 = ref reference.m_Flags; flags5 = (CarLaneFlags)((uint)flags5 | 0x400u); ref CarFlags flags6 = ref car.m_Flags; flags6 = (CarFlags)((uint)flags6 & 0xFFFFFDFFu); } if ((reference.m_Flags & 0x280) != 128) { ref CarFlags flags7 = ref car.m_Flags; flags7 = (CarFlags)((uint)flags7 & 0xFFFFFDFFu); break; } } } private bool CheckGarbagePresence(Entity laneEntity, ref GarbageTruck garbageTruck) { //IL_0007: 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_002c: 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_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_003e: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown res