D:\ValheimDev\Dumps\Old\assembly_valheim\MonoUpdaters.cs D:\ValheimDev\Dumps\Latest\assembly_valheim\MonoUpdaters.cs
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
.using System.Runtime.CompilerServices;  
using UnityEngine; using UnityEngine;
   
public class MonoUpdaters : MonoBehaviour public class MonoUpdaters : MonoBehaviour
{ {
    private void Awake()     private void Awake()
    {     {
        MonoUpdaters.s_instance = this;         MonoUpdaters.s_instance = this;
    }     }
   
    private void OnDestroy()     private void OnDestroy()
    {     {
        MonoUpdaters.s_instance = null;         MonoUpdaters.s_instance = null;
    }     }
   
    private void FixedUpdate()     private void FixedUpdate()
    {     {
        MonoUpdaters.s_updateCount++;         MonoUpdaters.s_updateCount++;
        float fixedDeltaTime = Time.fixedDeltaTime;         float fixedDeltaTime = Time.fixedDeltaTime;
.        float time = Time.time;          if (WaterVolume.Instances.Count > 0)
        this.m_syncTransformInstances.AddRange(ZSyncTransform.Instances);   
        this.m_syncAnimationInstances.AddRange(ZSyncAnimation.Instances);   
        this.m_floatingInstances.AddRange(Floating.Instances);   
        this.m_shipInstances.AddRange(Ship.Instances);   
        this.m_fishInstances.AddRange(Fish.Instances);   
        this.m_characterAnimEventInstances.AddRange(CharacterAnimEvent.Instances);   
        this.m_baseAIInstances.AddRange(BaseAI.Instances);   
        this.m_monsterAIInstances.AddRange(MonsterAI.Instances);   
        this.m_animalAIInstances.AddRange(AnimalAI.Instances);   
        this.m_humanoidInstances.AddRange(Humanoid.Instances);   
        this.m_characterInstances.AddRange(Character.Instances);   
        this.m_waterVolumeInstances.AddRange(WaterVolume.Instances);   
        if (this.m_waterVolumeInstances.Count > 0)  
        {   
            this.SafeCall(new Action(WaterVolume.StaticUpdate));   
        }   
        foreach (ZSyncTransform zsyncTransform in this.m_syncTransformInstances)   
        {         {
.            this.SafeCall(new Action<float>(zsyncTransform.CustomFixedUpdate), fixedDeltaTime);             WaterVolume.StaticUpdate();
        }   
        foreach (ZSyncAnimation zsyncAnimation in this.m_syncAnimationInstances)   
        {   
            this.SafeCall(new Action(zsyncAnimation.CustomFixedUpdate));   
        }   
        foreach (Floating floating in this.m_floatingInstances)   
        {   
            this.SafeCall(new Action<float>(floating.CustomFixedUpdate), fixedDeltaTime);   
        }   
        foreach (Ship ship in this.m_shipInstances)   
        {   
            this.SafeCall(new Action<float, float>(ship.CustomFixedUpdate), fixedDeltaTime, time);   
        }   
        foreach (Fish fish in this.m_fishInstances)   
        {   
            this.SafeCall(new Action(fish.CustomFixedUpdate));   
        }   
        foreach (CharacterAnimEvent characterAnimEvent in this.m_characterAnimEventInstances)   
        {   
            this.SafeCall(new Action(characterAnimEvent.CustomFixedUpdate));   
        }         }
.          this.m_update.CustomFixedUpdate(ZSyncTransform.Instances, "MonoUpdaters.FixedUpdate.ZSyncTransform", fixedDeltaTime);
          this.m_update.CustomFixedUpdate(ZSyncAnimation.Instances, "MonoUpdaters.FixedUpdate.ZSyncAnimation", fixedDeltaTime);
          this.m_update.CustomFixedUpdate(Floating.Instances, "MonoUpdaters.FixedUpdate.Floating", fixedDeltaTime);
          this.m_update.CustomFixedUpdate(Ship.Instances, "MonoUpdaters.FixedUpdate.Ship", fixedDeltaTime);
          this.m_update.CustomFixedUpdate(Fish.Instances, "MonoUpdaters.FixedUpdate.Fish", fixedDeltaTime);
          this.m_update.CustomFixedUpdate(CharacterAnimEvent.Instances, "MonoUpdaters.FixedUpdate.CharacterAnimEvent", fixedDeltaTime);
        this.m_updateAITimer += fixedDeltaTime;         this.m_updateAITimer += fixedDeltaTime;
        if (this.m_updateAITimer >= 0.05f)         if (this.m_updateAITimer >= 0.05f)
        {         {
.            foreach (BaseAI baseAI in this.m_baseAIInstances)              this.m_ai.UpdateAI(BaseAI.Instances, "MonoUpdaters.FixedUpdate.BaseAI", 0.05f);
            {   
                this.SafeCall(new Action<float>(baseAI.UpdateAI), 0.05f);   
            }   
            foreach (MonsterAI monsterAI in this.m_monsterAIInstances)   
            {   
                this.SafeCall(new Action<float>(monsterAI.UpdateAI), 0.05f);   
            }   
            foreach (AnimalAI animalAI in this.m_animalAIInstances)   
            {   
                this.SafeCall(new Action<float>(animalAI.UpdateAI), 0.05f);  
            }   
            this.m_updateAITimer -= 0.05f;             this.m_updateAITimer -= 0.05f;
        }         }
.        foreach (Humanoid humanoid in this.m_humanoidInstances)          this.m_update.CustomFixedUpdate(Character.Instances, "MonoUpdaters.FixedUpdate.Character", fixedDeltaTime);
        {          this.m_update.CustomFixedUpdate(Aoe.Instances, "MonoUpdaters.FixedUpdate.Aoe", fixedDeltaTime);
            this.SafeCall(new Action(humanoid.CustomFixedUpdate));          this.m_update.CustomFixedUpdate(RandomFlyingBird.Instances, "MonoUpdaters.FixedUpdate.RandomFlyingBird", fixedDeltaTime);
        }          this.m_update.CustomFixedUpdate(MeleeWeaponTrail.Instances, "MonoUpdaters.FixedUpdate.MeleeWeaponTrail", fixedDeltaTime);
        foreach (Character character in this.m_characterInstances)   
        {   
            this.SafeCall(new Action<float>(character.CustomFixedUpdate), fixedDeltaTime);  
        }   
        this.m_syncTransformInstances.Clear();   
        this.m_syncAnimationInstances.Clear();   
        this.m_floatingInstances.Clear();  
        this.m_shipInstances.Clear();   
        this.m_fishInstances.Clear();   
        this.m_characterAnimEventInstances.Clear();  
        this.m_baseAIInstances.Clear();   
        this.m_monsterAIInstances.Clear();   
        this.m_animalAIInstances.Clear();  
        this.m_humanoidInstances.Clear();   
        this.m_characterInstances.Clear();   
        this.m_waterVolumeInstances.Clear();   
    }     }
   
    private void Update()     private void Update()
    {     {
        MonoUpdaters.s_updateCount++;         MonoUpdaters.s_updateCount++;
        float deltaTime = Time.deltaTime;         float deltaTime = Time.deltaTime;
.          float time = Time.time;
        this.m_waterVolumeInstances.AddRange(WaterVolume.Instances);         this.m_waterVolumeInstances.AddRange(WaterVolume.Instances);
.        this.m_smokeInstances.AddRange(Smoke.Instances);  
        this.m_zsfxInstances.AddRange(ZSFX.Instances);  
        this.m_heightmapInstances.AddRange(Heightmap.Instances);  
        this.m_visEquipmentInstances.AddRange(VisEquipment.Instances);  
        this.m_footStepInstances.AddRange(FootStep.Instances);  
        this.m_instanceRendererInstances.AddRange(InstanceRenderer.Instances);  
        this.m_waterTriggerInstances.AddRange(WaterTrigger.Instances);  
        if (this.m_waterVolumeInstances.Count > 0)         if (this.m_waterVolumeInstances.Count > 0)
        {         {
.            this.SafeCall(new Action(WaterVolume.StaticUpdate));             WaterVolume.StaticUpdate();
            foreach (WaterVolume waterVolume in this.m_waterVolumeInstances)             foreach (WaterVolume waterVolume in this.m_waterVolumeInstances)
            {             {
.                this.SafeCall(new Action(waterVolume.Update1));                 waterVolume.UpdateFloaters();
            }             }
            foreach (WaterVolume waterVolume2 in this.m_waterVolumeInstances)             foreach (WaterVolume waterVolume2 in this.m_waterVolumeInstances)
            {             {
.                this.SafeCall(new Action(waterVolume2.Update2));                 waterVolume2.UpdateMaterials();
            }             }
.              this.m_waterVolumeInstances.Clear();
        }         }
.        foreach (Smoke smoke in this.m_smokeInstances)          this.m_update.CustomUpdate(Smoke.Instances, "MonoUpdaters.Update.Smoke", deltaTime, time); 
        {          this.m_update.CustomUpdate(ZSFX.Instances, "MonoUpdaters.Update.ZSFX", deltaTime, time); 
            this.SafeCall(new Action<float>(smoke.CustomUpdate), deltaTime);         this.m_update.CustomUpdate(VisEquipment.Instances, "MonoUpdaters.Update.VisEquipment", deltaTime, time);
        }          this.m_update.CustomUpdate(FootStep.Instances, "MonoUpdaters.Update.FootStep", deltaTime, time); 
        foreach (ZSFX zsfx in this.m_zsfxInstances)          this.m_update.CustomUpdate(InstanceRenderer.Instances, "MonoUpdaters.Update.InstanceRenderer", deltaTime, time); 
        {          this.m_update.CustomUpdate(WaterTrigger.Instances, "MonoUpdaters.Update.WaterTrigger", deltaTime, time); 
            this.SafeCall(new Action<float>(zsfx.CustomUpdate), deltaTime);         this.m_update.CustomUpdate(LightFlicker.Instances, "MonoUpdaters.Update.LightFlicker", deltaTime, time);
        }          this.m_update.CustomUpdate(SmokeSpawner.Instances, "MonoUpdaters.Update.SmokeSpawner", deltaTime, time); 
        foreach (VisEquipment visEquipment in this.m_visEquipmentInstances)          this.m_update.CustomUpdate(CraftingStation.Instances, "MonoUpdaters.Update.CraftingStation", deltaTime, time); 
        {   
            this.SafeCall(new Action(visEquipment.CustomUpdate));   
        }   
        foreach (FootStep footStep in this.m_footStepInstances)   
        {   
            this.SafeCall(new Action<float>(footStep.CustomUpdate), deltaTime);   
        }   
        foreach (InstanceRenderer instanceRenderer in this.m_instanceRendererInstances)   
        {   
            this.SafeCall(new Action(instanceRenderer.CustomUpdate));   
        }   
        foreach (WaterTrigger waterTrigger in this.m_waterTriggerInstances)   
        {   
            this.SafeCall(new Action<float>(waterTrigger.CustomUpdate), deltaTime);   
        }   
        this.m_waterVolumeInstances.Clear();   
        this.m_smokeInstances.Clear();   
        this.m_zsfxInstances.Clear();   
        this.m_heightmapInstances.Clear();   
        this.m_visEquipmentInstances.Clear();   
        this.m_footStepInstances.Clear();   
        this.m_instanceRendererInstances.Clear();   
        this.m_waterTriggerInstances.Clear();   
    }     }
   
    private void LateUpdate()     private void LateUpdate()
    {     {
        float deltaTime = Time.deltaTime;         float deltaTime = Time.deltaTime;
.        this.m_syncTransformInstances.AddRange(ZSyncTransform.Instances);          if (WaterVolume.Instances.Count > 0) 
        this.m_characterAnimEventInstances.AddRange(CharacterAnimEvent.Instances);   
        this.m_heightmapInstances.AddRange(Heightmap.Instances);   
        this.m_shipEffectsInstances.AddRange(ShipEffects.Instances);   
        this.m_tailInstances.AddRange(Tail.Instances);   
        foreach (ZSyncTransform zsyncTransform in this.m_syncTransformInstances)   
        {   
            this.SafeCall(new Action(zsyncTransform.CustomLateUpdate));   
        }   
        foreach (CharacterAnimEvent characterAnimEvent in this.m_characterAnimEventInstances)   
        {   
            this.SafeCall(new Action(characterAnimEvent.CustomLateUpdate));   
        }   
        foreach (Heightmap heightmap in this.m_heightmapInstances)   
        {   
            this.SafeCall(new Action(heightmap.CustomLateUpdate));   
        }   
        foreach (ShipEffects shipEffects in this.m_shipEffectsInstances)   
        {   
            this.SafeCall(new Action<float>(shipEffects.CustomLateUpdate), deltaTime);   
        }   
        foreach (Tail tail in this.m_tailInstances)   
        {         {
.            this.SafeCall(new Action<float>(tail.CustomLateUpdate), deltaTime);             WaterVolume.StaticUpdate();
        }         }
.        this.m_syncTransformInstances.Clear();         this.m_update.CustomLateUpdate(ZSyncTransform.Instances, "MonoUpdaters.LateUpdate.ZSyncTransform", deltaTime);
        this.m_characterAnimEventInstances.Clear();         this.m_update.CustomLateUpdate(CharacterAnimEvent.Instances, "MonoUpdaters.LateUpdate.CharacterAnimEvent", deltaTime);
        this.m_heightmapInstances.Clear();         this.m_update.CustomLateUpdate(Heightmap.Instances, "MonoUpdaters.LateUpdate.Heightmap", deltaTime);
        this.m_shipEffectsInstances.Clear();         this.m_update.CustomLateUpdate(ShipEffects.Instances, "MonoUpdaters.LateUpdate.ShipEffects", deltaTime);
        this.m_tailInstances.Clear();         this.m_update.CustomLateUpdate(Tail.Instances, "MonoUpdaters.LateUpdate.Tail", deltaTime);
    }          this.m_update.CustomLateUpdate(LineAttach.Instances, "MonoUpdaters.LateUpdate.LineAttach", deltaTime); 
   
    [MethodImpl(MethodImplOptions.AggressiveInlining)]   
    private void SafeCall(Action function)   
    {   
        function();   
    }   
   
    [MethodImpl(MethodImplOptions.AggressiveInlining)]   
    private void SafeCall(Action<float> function, float deltaTime)   
    {   
        function(deltaTime);   
    }   
   
    [MethodImpl(MethodImplOptions.AggressiveInlining)]   
    private void SafeCall(Action<float, float> function, float deltaTime, float time)   
    {   
        function(deltaTime, time);   
    }     }
   
    public static int UpdateCount     public static int UpdateCount
    {     {
        get         get
        {         {
            return MonoUpdaters.s_updateCount;             return MonoUpdaters.s_updateCount;
        }         }
    }     }
   
    private static MonoUpdaters s_instance;     private static MonoUpdaters s_instance;
   
.    private readonly List<ZSyncTransform> m_syncTransformInstances = new List<ZSyncTransform>();     private readonly List<IMonoUpdater> m_update = new List<IMonoUpdater>();
   
.    private readonly List<ZSyncAnimation> m_syncAnimationInstances = new List<ZSyncAnimation>();     private readonly List<IUpdateAI> m_ai = new List<IUpdateAI>();
   
    private readonly List<Floating> m_floatingInstances = new List<Floating>();   
   
    private readonly List<Ship> m_shipInstances = new List<Ship>();   
   
    private readonly List<Fish> m_fishInstances = new List<Fish>();   
   
    private readonly List<CharacterAnimEvent> m_characterAnimEventInstances = new List<CharacterAnimEvent>();   
   
    private readonly List<BaseAI> m_baseAIInstances = new List<BaseAI>();   
   
    private readonly List<MonsterAI> m_monsterAIInstances = new List<MonsterAI>();   
   
    private readonly List<AnimalAI> m_animalAIInstances = new List<AnimalAI>();   
   
    private readonly List<Humanoid> m_humanoidInstances = new List<Humanoid>();   
   
    private readonly List<Character> m_characterInstances = new List<Character>();   
   
    private readonly List<WaterVolume> m_waterVolumeInstances = new List<WaterVolume>();     private readonly List<WaterVolume> m_waterVolumeInstances = new List<WaterVolume>();
.   
    private readonly List<Smoke> m_smokeInstances = new List<Smoke>();  
   
    private readonly List<ZSFX> m_zsfxInstances = new List<ZSFX>();  
   
    private readonly List<Heightmap> m_heightmapInstances = new List<Heightmap>();  
   
    private readonly List<VisEquipment> m_visEquipmentInstances = new List<VisEquipment>();  
   
    private readonly List<FootStep> m_footStepInstances = new List<FootStep>();  
   
    private readonly List<InstanceRenderer> m_instanceRendererInstances = new List<InstanceRenderer>();  
   
    private readonly List<WaterTrigger> m_waterTriggerInstances = new List<WaterTrigger>();  
   
    private readonly List<ShipEffects> m_shipEffectsInstances = new List<ShipEffects>();  
   
    private readonly List<Tail> m_tailInstances = new List<Tail>();  
   
    private static int s_updateCount;     private static int s_updateCount;
   
    private float m_updateAITimer;     private float m_updateAITimer;
} }