Remove IMobStateComponent (#5220)
This commit is contained in:
committed by
GitHub
parent
4236551d86
commit
f5b11d6af8
@@ -2,7 +2,7 @@
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Disposal.Components;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -63,7 +63,7 @@ namespace Content.Shared.Disposal
|
||||
if (!entity.TryGetComponent(out IPhysBody? physics) ||
|
||||
!physics.CanCollide && storable == null)
|
||||
{
|
||||
if (!(entity.TryGetComponent(out IMobStateComponent? damageState) && damageState.IsDead()))
|
||||
if (!(entity.TryGetComponent(out MobStateComponent? damageState) && damageState.IsDead()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,8 @@ namespace Content.Shared.MobState.Components
|
||||
/// (such as blur effect for unconsciousness) and managing the health HUD.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IMobStateComponent))]
|
||||
[NetworkedComponent()]
|
||||
public class MobStateComponent : Component, IMobStateComponent
|
||||
[NetworkedComponent]
|
||||
public class MobStateComponent : Component
|
||||
{
|
||||
public override string Name => "MobState";
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.MobState.State;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.MobState
|
||||
{
|
||||
public interface IMobStateComponent : IComponent
|
||||
{
|
||||
IMobState? CurrentState { get; }
|
||||
|
||||
bool IsAlive();
|
||||
|
||||
bool IsCritical();
|
||||
|
||||
bool IsDead();
|
||||
|
||||
bool IsIncapacitated();
|
||||
|
||||
(IMobState state, FixedPoint2 threshold)? GetEarliestIncapacitatedState(FixedPoint2 minimumDamage);
|
||||
|
||||
(IMobState state, FixedPoint2 threshold)? GetEarliestCriticalState(FixedPoint2 minimumDamage);
|
||||
|
||||
(IMobState state, FixedPoint2 threshold)? GetEarliestDeadState(FixedPoint2 minimumDamage);
|
||||
|
||||
(IMobState state, FixedPoint2 threshold)? GetPreviousCriticalState(FixedPoint2 maximumDamage);
|
||||
|
||||
bool TryGetEarliestIncapacitatedState(
|
||||
FixedPoint2 minimumDamage,
|
||||
[NotNullWhen(true)] out IMobState? state,
|
||||
out FixedPoint2 threshold);
|
||||
|
||||
bool TryGetEarliestCriticalState(
|
||||
FixedPoint2 minimumDamage,
|
||||
[NotNullWhen(true)] out IMobState? state,
|
||||
out FixedPoint2 threshold);
|
||||
|
||||
bool TryGetEarliestDeadState(
|
||||
FixedPoint2 minimumDamage,
|
||||
[NotNullWhen(true)] out IMobState? state,
|
||||
out FixedPoint2 threshold);
|
||||
|
||||
bool TryGetPreviousCriticalState(
|
||||
FixedPoint2 maximumDamage,
|
||||
[NotNullWhen(true)] out IMobState? state,
|
||||
out FixedPoint2 threshold);
|
||||
|
||||
void UpdateState(FixedPoint2 damage);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.MobState.State;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.MobState.State;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.MobState
|
||||
@@ -8,7 +9,7 @@ namespace Content.Shared.MobState
|
||||
#pragma warning restore 618
|
||||
{
|
||||
public MobStateChangedMessage(
|
||||
IMobStateComponent component,
|
||||
MobStateComponent component,
|
||||
IMobState? oldMobState,
|
||||
IMobState currentMobState)
|
||||
{
|
||||
@@ -19,7 +20,7 @@ namespace Content.Shared.MobState
|
||||
|
||||
public IEntity Entity => Component.Owner;
|
||||
|
||||
public IMobStateComponent Component { get; }
|
||||
public MobStateComponent Component { get; }
|
||||
|
||||
public IMobState? OldMobState { get; }
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -54,7 +53,7 @@ namespace Content.Shared.Movement.EntitySystems
|
||||
|
||||
// For stuff like "Moving out of locker" or the likes
|
||||
if (owner.IsInContainer() &&
|
||||
(!owner.TryGetComponent(out IMobStateComponent? mobState) ||
|
||||
(!owner.TryGetComponent(out MobStateComponent? mobState) ||
|
||||
mobState.IsAlive()))
|
||||
{
|
||||
var relayMoveEvent = new RelayMovementEntityEvent(owner);
|
||||
|
||||
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Friction;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Robust.Shared.Configuration;
|
||||
@@ -160,7 +160,7 @@ namespace Content.Shared.Movement
|
||||
protected bool UseMobMovement(PhysicsComponent body)
|
||||
{
|
||||
return body.BodyStatus == BodyStatus.OnGround &&
|
||||
body.Owner.HasComponent<IMobStateComponent>() &&
|
||||
body.Owner.HasComponent<MobStateComponent>() &&
|
||||
// If we're being pulled then don't mess with our velocity.
|
||||
(!body.Owner.TryGetComponent(out SharedPullableComponent? pullable) || !pullable.BeingPulled) &&
|
||||
_blocker.CanMove(body.Owner);
|
||||
|
||||
Reference in New Issue
Block a user