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

@@ -5,8 +5,8 @@ using Content.Server.GameTicking;
using Content.Server.Roles;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Players.PlayTimeTracking;
using Content.Shared.Roles;
using Robust.Server.GameObjects;
@@ -74,7 +74,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
if (!TryComp<MobStateComponent>(attached, out var state))
return false;
return state.CurrentState is DamageState.Alive or DamageState.Critical;
return state.CurrentState is MobState.Alive or MobState.Critical;
}
public IEnumerable<string> GetTimedRoles(Mind.Mind mind)
@@ -142,7 +142,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
private void OnMobStateChanged(MobStateChangedEvent ev)
{
if (!TryComp(ev.Entity, out ActorComponent? actor))
if (!TryComp(ev.Target, out ActorComponent? actor))
return;
_tracking.QueueRefreshTrackers(actor.PlayerSession);