/// <summary>
        ///     Updates the mob state..
        /// </summary>
        public void UpdateState(MobStateComponent component, FixedPoint2 damage)
        {
            if (!TryGetState(component, damage, out var newState, out var threshold))
            {
                return;
            }

            SetMobState(component, component.CurrentState, (newState.Value, threshold));
        }
 private void OnMobStartup(EntityUid uid, MobStateComponent component, ComponentStartup args)
 {
     if (component.CurrentState != null && component.CurrentThreshold != null)
     {
         // Initialize with given states
         SetMobState(component, null, (component.CurrentState.Value, component.CurrentThreshold.Value));
     }
     else
     {
         // Initialize with some amount of damage, defaulting to 0.
         UpdateState(component, CompOrNull <DamageableComponent>(uid)?.TotalDamage ?? FixedPoint2.Zero);
     }
 }