D:\ValheimDev\Dumps\Old\assembly_valheim\SmokeSpawner.cs D:\ValheimDev\Dumps\Latest\assembly_valheim\SmokeSpawner.cs
using System; using System;
.  using System.Collections.Generic;
using UnityEngine; using UnityEngine;
   
.public class SmokeSpawner : MonoBehaviour  public class SmokeSpawner : MonoBehaviour, IMonoUpdater 
{ {
    private void Start()     private void Start()
    {     {
        this.m_time = UnityEngine.Random.Range(0f, this.m_interval);         this.m_time = UnityEngine.Random.Range(0f, this.m_interval);
    }     }
   
.    private void Update()     private void OnEnable()
    {     {
.        this.m_time += Time.deltaTime;         SmokeSpawner.Instances.Add(this); 
      } 
   
      private void OnDisable() 
      { 
          SmokeSpawner.Instances.Remove(this); 
      } 
   
      public void CustomUpdate(float deltaTime, float time) 
      { 
          this.m_time += deltaTime;
        if (this.m_time > this.m_interval)         if (this.m_time > this.m_interval)
        {         {
            this.m_time = 0f;             this.m_time = 0f;
.            this.Spawn();             this.Spawn(time);
        }         }
    }     }
   
.    private void Spawn()     private void Spawn(float time)
    {     {
        Player localPlayer = Player.m_localPlayer;         Player localPlayer = Player.m_localPlayer;
        if (localPlayer == null || Vector3.Distance(localPlayer.transform.position, base.transform.position) > 64f)         if (localPlayer == null || Vector3.Distance(localPlayer.transform.position, base.transform.position) > 64f)
        {         {
.            this.m_lastSpawnTime = Time.time;             this.m_lastSpawnTime = time;
            return;             return;
        }         }
        if (this.TestBlocked())         if (this.TestBlocked())
        {         {
            return;             return;
        }         }
        if (Smoke.GetTotalSmoke() > 100)         if (Smoke.GetTotalSmoke() > 100)
        {         {
            Smoke.FadeOldest();             Smoke.FadeOldest();
        }         }
.        UnityEngine.Object.Instantiate<GameObject>(this.m_smokePrefab, base.transform.position, UnityEngine.Random.rotation);         Vector3 vector = base.transform.position; 
        this.m_lastSpawnTime = Time.time;         if (this.m_spawnRadius > 0f) 
          { 
              Vector2 vector2 = UnityEngine.Random.insideUnitCircle.normalized * UnityEngine.Random.Range(this.m_spawnRadius / 2f, this.m_spawnRadius); 
              vector += new Vector3(vector2.x, 0f, vector2.y); 
          } 
          UnityEngine.Object.Instantiate<GameObject>(this.m_smokePrefab, vector, UnityEngine.Random.rotation);
          this.m_lastSpawnTime = time;
    }     }
   
    private bool TestBlocked()     private bool TestBlocked()
    {     {
        return Physics.CheckSphere(base.transform.position, this.m_testRadius, this.m_testMask.value);         return Physics.CheckSphere(base.transform.position, this.m_testRadius, this.m_testMask.value);
    }     }
   
    public bool IsBlocked()     public bool IsBlocked()
    {     {
        if (!base.gameObject.activeInHierarchy)         if (!base.gameObject.activeInHierarchy)
        {         {
            return this.TestBlocked();             return this.TestBlocked();
        }         }
        return Time.time - this.m_lastSpawnTime > 4f;         return Time.time - this.m_lastSpawnTime > 4f;
    }     }
   
.      private void OnDrawGizmos()
      {
          Gizmos.color = Color.yellow;
          Utils.DrawGizmoCircle(base.transform.position, this.m_spawnRadius, 16);
      }
   
      public static List<IMonoUpdater> Instances { get; } = new List<IMonoUpdater>();
   
    private const float m_minPlayerDistance = 64f;     private const float m_minPlayerDistance = 64f;
   
    private const int m_maxGlobalSmoke = 100;     private const int m_maxGlobalSmoke = 100;
   
    private const float m_blockedMinTime = 4f;     private const float m_blockedMinTime = 4f;
   
    public GameObject m_smokePrefab;     public GameObject m_smokePrefab;
   
    public float m_interval = 0.5f;     public float m_interval = 0.5f;
   
    public LayerMask m_testMask;     public LayerMask m_testMask;
   
    public float m_testRadius = 0.5f;     public float m_testRadius = 0.5f;
.   
      public float m_spawnRadius;
   
    private float m_lastSpawnTime;     private float m_lastSpawnTime;
   
    private float m_time;     private float m_time;
} }