fish-station/Content.Shared/Mobs/Systems/MobStateSystem.cs
Rinary b6920aec99
Рефактор мехов, правки в системе медицины (#507)
* mech system, fix hands, fix fraction

* fix

* fix fake hypo

* fix triple airlocks big sizing

* fix

* upd clown hulk

* xd fix 2

* bigger exit delay

* mechs reflect changes

* guns changes

* draike up

* mechs in another category

* add equipment

* Revert "upd clown hulk"

This reverts commit b8084967040be5d442b2d4770cf7fdece1daa2a8.

* SPIN MY MECH ASS

* mech no rot

* some resprite

* no injections in hardsuits

* some species can not be injectable

* medipans can ignore armor, admeme hypospray ignore armor

* fix

* fix admeme hypo

* mob fraction fix

* rover + nt gygax add

* fix description

* fix id

* some better dome effects

* если пустая гильза в стволе -> Кнопки "казнь" не будет

* phazon added

* fix server crashes

* full rework mechs on mobstates, coils fix mechs, diagnostic hud show health bar for mechs, mechs fastest repair, add mech analyzer

* some fixes

* configure health of all mechs

* upd

* add rover to uplink

* translate bundle

* change price

* phazon construction

* fix

* fix

* Finish phazon construction

* add phazon research and recipes

* phazon construction translate

* fix

* Mech lights

* fix

* translate light action

* Mech sounds, fix damage

* fix

* fix hello sound

* upd

* fix linter

* change damagePercentage

* fix

* fix hello sound

* temp disable damage sounds

* fix battery needed on construct

* some changes

* add mech painting system as DEBUG(in dev)

* Fix yaml, durand paintings

* mech spray cans textures

* change sprite

* fix

* ripley, clarke new textures

* ripley,clarke paints

* fix

* sec pod texture

---------

Co-authored-by: Vigers Ray <60344369+VigersRay@users.noreply.github.com>
2024-10-30 10:53:00 +03:00

102 lines
3.7 KiB
C#

using Content.Shared.ActionBlocker;
using Content.Shared.Administration.Logs;
using Content.Shared.Mobs.Components;
using Content.Shared.Mech.Components;
using Content.Shared.Standing;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Timing;
namespace Content.Shared.Mobs.Systems;
[Virtual]
public partial class MobStateSystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
private ISawmill _sawmill = default!;
private EntityQuery<MobStateComponent> _mobStateQuery;
public override void Initialize()
{
_sawmill = _logManager.GetSawmill("MobState");
_mobStateQuery = GetEntityQuery<MobStateComponent>();
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 (TryComp<MechComponent>(target, out var mech))
return !mech.Broken;
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
}