Mobstate Refactor (#13389)

Refactors mobstate and moves mob health thresholds to their own component

Co-authored-by: DrSmugleaf <drsmugleaf@gmail.com>
This commit is contained in:
Jezithyr
2023-01-13 16:57:10 -08:00
committed by GitHub
parent 97e4c477bd
commit eeb5b17b34
148 changed files with 1517 additions and 1290 deletions

View File

@@ -3,14 +3,13 @@ using Content.Server.DoAfter;
using Content.Server.Popups;
using Content.Shared.Actions;
using Content.Shared.Chemistry.Components;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using System.Threading;
using Content.Server.Chat.Systems;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Server.Humanoid;
using Content.Server.NPC;
using Content.Shared.Damage;
using Content.Shared.Dragon;
@@ -22,6 +21,8 @@ using Robust.Shared.Map;
using Robust.Shared.Random;
using Content.Server.NPC.Systems;
using Content.Shared.Humanoid;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
namespace Content.Server.Dragon
{
@@ -275,7 +276,7 @@ namespace Content.Server.Dragon
{
//Empties the stomach upon death
//TODO: Do this when the dragon gets butchered instead
if (args.CurrentMobState == DamageState.Dead)
if (args.NewMobState == MobState.Dead)
{
if (component.SoundDeath != null)
_audioSystem.PlayPvs(component.SoundDeath, uid, component.SoundDeath.Params);
@@ -365,8 +366,8 @@ namespace Content.Server.Dragon
{
switch (targetState.CurrentState)
{
case DamageState.Critical:
case DamageState.Dead:
case MobState.Critical:
case MobState.Dead:
component.CancelToken = new CancellationTokenSource();
_doAfterSystem.DoAfter(new DoAfterEventArgs(uid, component.DevourTime, component.CancelToken.Token, target)