Untitled left D:\ValheimDev\Dumps\Latest\assembly_valheim\SiegeMachine.cs
.  using System;
  using System.Collections.Generic;
  using Dynamics;
  using UnityEngine;
   
  public class SiegeMachine : MonoBehaviour
  {
      private void Awake()
      {
          foreach (SiegeMachine.SiegePart siegePart in this.m_movingParts)
          {
              siegePart.m_position = 0f;
              siegePart.m_originalPosition = siegePart.m_gameobject.transform.localPosition;
              siegePart.m_dynamicsPosition = 0f;
              siegePart.m_floatDynamics = new FloatDynamics(this.m_dynamicsParameters, siegePart.m_dynamicsPosition);
          }
          this.m_aoe.gameObject.SetActive(false);
          this.m_nview = base.GetComponent<ZNetView>();
          if (this.m_nview.GetZDO() == null)
          {
              base.enabled = false;
          }
      }
   
      private void Update()
      {
          if (!this.m_nview.IsValid())
          {
              return;
          }
          this.UpdateSiege(Time.deltaTime);
      }
   
      private void UpdateAnimPhase()
      {
          this.m_currentPart = (this.m_currentPart + 1) % this.m_movingParts.Count;
          if (this.m_currentPart == 0)
          {
              this.m_animPhase = ((this.m_animPhase == SiegeMachine.AnimPhase.Charging) ? SiegeMachine.AnimPhase.Firing : SiegeMachine.AnimPhase.Charging);
          }
      }
   
      private void UpdateSiege(float dt)
      {
          bool flag = this.m_nview != null && this.m_nview.IsValid() && this.m_nview.IsOwner();
          foreach (SiegeMachine.SiegePart siegePart in this.m_movingParts)
          {
              siegePart.m_dynamicsPosition = siegePart.m_floatDynamics.Update(dt, this.m_armAnimCurve.Evaluate(siegePart.m_position / this.m_chargeTime), float.NegativeInfinity, false);
              siegePart.m_gameobject.transform.localPosition = Vector3.Lerp(siegePart.m_originalPosition, siegePart.m_originalPosition + Vector3.back * this.m_chargeOffsetDistance, siegePart.m_dynamicsPosition);
          }
          if ((this.m_engine && !this.m_engine.IsActive()) || (this.m_wagon && (this.m_enabledWhenAttached ^ this.m_wagon.IsAttached())))
          {
              this.m_aoe.gameObject.SetActive(false);
              this.m_animPhase = SiegeMachine.AnimPhase.Charging;
              this.m_currentPart = 0;
              foreach (SiegeMachine.SiegePart siegePart2 in this.m_movingParts)
              {
                  siegePart2.m_position = Mathf.MoveTowards(siegePart2.m_position, 0f, dt / 0.5f);
                  if ((double)siegePart2.m_position < 0.02)
                  {
                      siegePart2.m_position = 0f;
                  }
              }
              this.m_wasDisabledLastUpdate = true;
              return;
          }
          if (this.m_wasDisabledLastUpdate)
          {
              foreach (SiegeMachine.SiegePart siegePart3 in this.m_movingParts)
              {
                  siegePart3.m_position = 0f;
              }
          }
          if (flag)
          {
              if (this.m_aoeActiveTimer > 0f)
              {
                  this.m_aoeActiveTimer -= dt;
              }
              this.m_aoe.gameObject.SetActive(this.m_aoeActiveTimer >= 0f);
          }
          SiegeMachine.SiegePart siegePart4 = this.m_movingParts[this.m_currentPart];
          SiegeMachine.AnimPhase animPhase = this.m_animPhase;
          if (animPhase == SiegeMachine.AnimPhase.Charging || animPhase != SiegeMachine.AnimPhase.Firing)
          {
              if (siegePart4.m_position == 0f && flag)
              {
                  this.m_chargeEffect.Create(siegePart4.m_gameobject.transform.position, Quaternion.identity, null, 1f, -1);
              }
              siegePart4.m_position += dt;
              if (siegePart4.m_position >= this.m_chargeTime)
              {
                  this.UpdateAnimPhase();
              }
          }
          else
          {
              this.m_firingTimer += dt;
              if (this.m_firingTimer > this.m_hitDelay)
              {
                  this.m_firingTimer = 0f;
                  Terminal.Log("Firing!");
                  siegePart4.m_position = 0f;
                  if (flag)
                  {
                      this.m_punchEffect.Create(siegePart4.m_effectPoint.position, siegePart4.m_effectPoint.rotation, null, 1f, -1);
                      this.m_aoeActiveTimer = 0.05f;
                      this.m_aoe.gameObject.SetActive(true);
                  }
                  this.UpdateAnimPhase();
              }
          }
          this.m_wasDisabledLastUpdate = false;
      }
   
      public Smelter m_engine;
   
      public Vagon m_wagon;
   
      public bool m_enabledWhenAttached = true;
   
      public List<SiegeMachine.SiegePart> m_movingParts = new List<SiegeMachine.SiegePart>();
   
      public DynamicsParameters m_dynamicsParameters;
   
      private ZNetView m_nview;
   
      private bool m_wasDisabledLastUpdate = true;
   
      public float m_chargeTime = 4f;
   
      public float m_hitDelay = 2f;
   
      public float m_chargeOffsetDistance = 2f;
   
      public AnimationCurve m_armAnimCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
   
      public GameObject m_aoe;
   
      public EffectList m_punchEffect;
   
      public EffectList m_chargeEffect;
   
      private int m_currentPart;
   
      private float m_firingTimer;
   
      private float m_aoeActiveTimer;
   
      private SiegeMachine.AnimPhase m_animPhase;
   
      [Serializable]
      public class SiegePart
      {
          public GameObject m_gameobject;
   
          public Transform m_effectPoint;
   
          [NonSerialized]
          public float m_position;
   
          [NonSerialized]
          public FloatDynamics m_floatDynamics;
   
          [NonSerialized]
          public float m_dynamicsPosition;
   
          [NonSerialized]
          public Vector3 m_originalPosition;
      }
   
      private enum AnimPhase
      {
          Charging,
          Firing
      }
  }