mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* may god have mercy upon my soul
* stuff
* Revert "Always raise MobStateChanged on client (#45103)"
This reverts commit 1951b00875.
* keep the cleanup
* fuck you though
* review
* Update Content.Shared/DamageOverlay/SharedDamageOverlaySystem.cs
Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com>
* deltas
* queries
---------
Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com>
99 lines
3.5 KiB
C#
99 lines
3.5 KiB
C#
using Content.Shared.ActionBlocker;
|
|
using Content.Shared.Administration.Logs;
|
|
using Content.Shared.Damage.Systems;
|
|
using Content.Shared.Mobs.Components;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Standing;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared.Mobs.Systems;
|
|
|
|
[Virtual]
|
|
public partial class MobStateSystem : EntitySystem
|
|
{
|
|
[Dependency] private ActionBlockerSystem _blocker = default!;
|
|
[Dependency] private SharedAppearanceSystem _appearance = default!;
|
|
[Dependency] private StandingStateSystem _standing = default!;
|
|
[Dependency] private ISharedAdminLogManager _adminLogger = default!;
|
|
[Dependency] private IGameTiming _timing = default!;
|
|
[Dependency] private DamageableSystem _damageable = default!;
|
|
[Dependency] private SharedPopupSystem _popup = default!;
|
|
|
|
[Dependency] private EntityQuery<MobStateComponent> _mobStateQuery = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeEvents();
|
|
}
|
|
|
|
#region Public API
|
|
|
|
/// <summary>
|
|
/// Check if a Mob is Alive
|
|
/// </summary>
|
|
/// <param name="target">Target Entity</param>
|
|
/// <param name="component">The MobState component owned by the target</param>
|
|
/// <returns>If the entity is alive</returns>
|
|
public bool IsAlive(EntityUid target, MobStateComponent? component = null)
|
|
{
|
|
if (!_mobStateQuery.Resolve(target, ref component, false))
|
|
return false;
|
|
return component.CurrentState == MobState.Alive;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Check if a Mob is Critical
|
|
/// </summary>
|
|
/// <param name="target">Target Entity</param>
|
|
/// <param name="component">The MobState component owned by the target</param>
|
|
/// <returns>If the entity is Critical</returns>
|
|
public bool IsCritical(EntityUid target, MobStateComponent? component = null)
|
|
{
|
|
if (!_mobStateQuery.Resolve(target, ref component, false))
|
|
return false;
|
|
return component.CurrentState == MobState.Critical;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Check if a Mob is Dead
|
|
/// </summary>
|
|
/// <param name="target">Target Entity</param>
|
|
/// <param name="component">The MobState component owned by the target</param>
|
|
/// <returns>If the entity is Dead</returns>
|
|
public bool IsDead(EntityUid target, MobStateComponent? component = null)
|
|
{
|
|
if (!_mobStateQuery.Resolve(target, ref component, false))
|
|
return false;
|
|
return component.CurrentState == MobState.Dead;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Check if a Mob is Critical or Dead
|
|
/// </summary>
|
|
/// <param name="target">Target Entity</param>
|
|
/// <param name="component">The MobState component owned by the target</param>
|
|
/// <returns>If the entity is Critical or Dead</returns>
|
|
public bool IsIncapacitated(EntityUid target, MobStateComponent? component = null)
|
|
{
|
|
if (!_mobStateQuery.Resolve(target, ref component, false))
|
|
return false;
|
|
return component.CurrentState is MobState.Critical or MobState.Dead;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Check if a Mob is in an Invalid state
|
|
/// </summary>
|
|
/// <param name="target">Target Entity</param>
|
|
/// <param name="component">The MobState component owned by the target</param>
|
|
/// <returns>If the entity is in an Invalid State</returns>
|
|
public bool IsInvalidState(EntityUid target, MobStateComponent? component = null)
|
|
{
|
|
if (!_mobStateQuery.Resolve(target, ref component, false))
|
|
return false;
|
|
return component.CurrentState is MobState.Invalid;
|
|
}
|
|
|
|
#endregion
|
|
}
|