Remove IMobStateComponent (#5220)
This commit is contained in:
committed by
GitHub
parent
4236551d86
commit
f5b11d6af8
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Client.HealthOverlay.UI;
|
using Content.Client.HealthOverlay.UI;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
@@ -79,7 +79,7 @@ namespace Content.Client.HealthOverlay
|
|||||||
|
|
||||||
var viewBox = _eyeManager.GetWorldViewport().Enlarged(2.0f);
|
var viewBox = _eyeManager.GetWorldViewport().Enlarged(2.0f);
|
||||||
|
|
||||||
foreach (var (mobState, _) in EntityManager.EntityQuery<IMobStateComponent, DamageableComponent>())
|
foreach (var (mobState, _) in EntityManager.EntityQuery<MobStateComponent, DamageableComponent>())
|
||||||
{
|
{
|
||||||
var entity = mobState.Owner;
|
var entity = mobState.Owner;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Content.Client.IoC;
|
|||||||
using Content.Client.Resources;
|
using Content.Client.Resources;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -77,7 +77,7 @@ namespace Content.Client.HealthOverlay.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Entity.TryGetComponent(out IMobStateComponent? mobState) ||
|
if (!Entity.TryGetComponent(out MobStateComponent? mobState) ||
|
||||||
!Entity.TryGetComponent(out DamageableComponent? damageable))
|
!Entity.TryGetComponent(out DamageableComponent? damageable))
|
||||||
{
|
{
|
||||||
CritBar.Visible = false;
|
CritBar.Visible = false;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
@@ -31,7 +31,7 @@ namespace Content.Client.MobState.Overlays
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerEntity.TryGetComponent<IMobStateComponent>(out var mobState))
|
if (playerEntity.TryGetComponent<MobStateComponent>(out var mobState))
|
||||||
{
|
{
|
||||||
if (critical)
|
if (critical)
|
||||||
if (mobState.IsCritical())
|
if (mobState.IsCritical())
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Shared.Body.Components;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.MobState;
|
|
||||||
using Content.Shared.Movement;
|
using Content.Shared.Movement;
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Content.Shared.Pulling.Components;
|
using Content.Shared.Pulling.Components;
|
||||||
@@ -57,7 +56,7 @@ namespace Content.Client.Physics.Controllers
|
|||||||
var pulling = pullerComp.Pulling;
|
var pulling = pullerComp.Pulling;
|
||||||
|
|
||||||
if (pulling != null &&
|
if (pulling != null &&
|
||||||
pulling.HasComponent<IMobStateComponent>() &&
|
pulling.HasComponent<MobStateComponent>() &&
|
||||||
pulling.TryGetComponent(out PhysicsComponent? pullingBody))
|
pulling.TryGetComponent(out PhysicsComponent? pullingBody))
|
||||||
{
|
{
|
||||||
pullingBody.Predict = false;
|
pullingBody.Predict = false;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Administration.Commands;
|
using Content.Server.Administration.Commands;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Damage.Prototypes;
|
using Content.Shared.Damage.Prototypes;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -49,7 +49,7 @@ namespace Content.IntegrationTests.Tests.Commands
|
|||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
Assert.True(human.TryGetComponent(out DamageableComponent damageable));
|
Assert.True(human.TryGetComponent(out DamageableComponent damageable));
|
||||||
Assert.True(human.TryGetComponent(out IMobStateComponent mobState));
|
Assert.True(human.TryGetComponent(out MobStateComponent mobState));
|
||||||
mobState.UpdateState(0);
|
mobState.UpdateState(0);
|
||||||
Assert.That(mobState.IsAlive, Is.True);
|
Assert.That(mobState.IsAlive, Is.True);
|
||||||
Assert.That(mobState.IsCritical, Is.False);
|
Assert.That(mobState.IsCritical, Is.False);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Content.Server.AI.WorldState;
|
using Content.Server.AI.WorldState;
|
||||||
using Content.Server.AI.WorldState.States;
|
using Content.Server.AI.WorldState.States;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.Considerations.Combat
|
namespace Content.Server.AI.Utility.Considerations.Combat
|
||||||
{
|
{
|
||||||
@@ -10,7 +10,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat
|
|||||||
{
|
{
|
||||||
var target = context.GetState<TargetEntityState>().GetValue();
|
var target = context.GetState<TargetEntityState>().GetValue();
|
||||||
|
|
||||||
if (target == null || !target.TryGetComponent(out IMobStateComponent? mobState))
|
if (target == null || !target.TryGetComponent(out MobStateComponent? mobState))
|
||||||
{
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Content.Server.AI.WorldState;
|
using Content.Server.AI.WorldState;
|
||||||
using Content.Server.AI.WorldState.States;
|
using Content.Server.AI.WorldState.States;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.Considerations.Combat
|
namespace Content.Server.AI.Utility.Considerations.Combat
|
||||||
{
|
{
|
||||||
@@ -10,7 +10,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat
|
|||||||
{
|
{
|
||||||
var target = context.GetState<TargetEntityState>().GetValue();
|
var target = context.GetState<TargetEntityState>().GetValue();
|
||||||
|
|
||||||
if (target == null || !target.TryGetComponent(out IMobStateComponent? mobState))
|
if (target == null || !target.TryGetComponent(out MobStateComponent? mobState))
|
||||||
{
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,12 @@ using Content.Server.Atmos.Components;
|
|||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
using Content.Server.Nutrition.EntitySystems;
|
using Content.Server.Nutrition.EntitySystems;
|
||||||
using Content.Server.Stunnable;
|
|
||||||
using Content.Server.Stunnable.Components;
|
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Jittering;
|
using Content.Shared.Jittering;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Nutrition.Components;
|
using Content.Shared.Nutrition.Components;
|
||||||
using Content.Shared.StatusEffect;
|
using Content.Shared.StatusEffect;
|
||||||
using Content.Shared.Stunnable;
|
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -56,7 +53,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
public static void PerformRejuvenate(IEntity target)
|
public static void PerformRejuvenate(IEntity target)
|
||||||
{
|
{
|
||||||
target.GetComponentOrNull<IMobStateComponent>()?.UpdateState(0);
|
target.GetComponentOrNull<MobStateComponent>()?.UpdateState(0);
|
||||||
target.GetComponentOrNull<HungerComponent>()?.ResetFood();
|
target.GetComponentOrNull<HungerComponent>()?.ResetFood();
|
||||||
target.GetComponentOrNull<ThirstComponent>()?.ResetThirst();
|
target.GetComponentOrNull<ThirstComponent>()?.ResetThirst();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -61,7 +61,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
&& (maxForce >= (MoveResist * MoveForcePushRatio)))
|
&& (maxForce >= (MoveResist * MoveForcePushRatio)))
|
||||||
|| (physics.BodyType == BodyType.Static && (maxForce >= (MoveResist * MoveForceForcePushRatio))))
|
|| (physics.BodyType == BodyType.Static && (maxForce >= (MoveResist * MoveForceForcePushRatio))))
|
||||||
{
|
{
|
||||||
if (physics.Owner.HasComponent<IMobStateComponent>())
|
if (physics.Owner.HasComponent<MobStateComponent>())
|
||||||
{
|
{
|
||||||
physics.BodyStatus = BodyStatus.InAir;
|
physics.BodyStatus = BodyStatus.InAir;
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
if (Deleted || !Owner.TryGetComponent(out PhysicsComponent? physicsComponent)) return;
|
if (Deleted || !Owner.TryGetComponent(out PhysicsComponent? physicsComponent)) return;
|
||||||
|
|
||||||
// Uhh if you get race conditions good luck buddy.
|
// Uhh if you get race conditions good luck buddy.
|
||||||
if (physicsComponent.Owner.HasComponent<IMobStateComponent>())
|
if (physicsComponent.Owner.HasComponent<MobStateComponent>())
|
||||||
{
|
{
|
||||||
physicsComponent.BodyStatus = BodyStatus.OnGround;
|
physicsComponent.BodyStatus = BodyStatus.OnGround;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Server.Popups;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState;
|
||||||
|
using Content.Shared.MobState.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -92,7 +93,7 @@ namespace Content.Server.Body.Behavior
|
|||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
if (Body != null && Body.Owner.TryGetComponent(out IMobStateComponent? mobState) && mobState.IsCritical())
|
if (Body != null && Body.Owner.TryGetComponent(out MobStateComponent? mobState) && mobState.IsCritical())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.MobState.State;
|
|
||||||
using Content.Shared.Movement.EntitySystems;
|
using Content.Shared.Movement.EntitySystems;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -20,7 +19,7 @@ namespace Content.Server.Body
|
|||||||
|
|
||||||
private void OnRelayMoveInput(EntityUid uid, BodyComponent component, RelayMoveInputEvent args)
|
private void OnRelayMoveInput(EntityUid uid, BodyComponent component, RelayMoveInputEvent args)
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetComponent<IMobStateComponent>(uid, out var mobState) &&
|
if (EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) &&
|
||||||
mobState.IsDead() &&
|
mobState.IsDead() &&
|
||||||
EntityManager.TryGetComponent<MindComponent>(uid, out var mind) &&
|
EntityManager.TryGetComponent<MindComponent>(uid, out var mind) &&
|
||||||
mind.HasMind)
|
mind.HasMind)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using Content.Shared.Alert;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -190,7 +190,7 @@ namespace Content.Server.Body.Respiratory
|
|||||||
|
|
||||||
if (bloodstreamAmount < amountNeeded)
|
if (bloodstreamAmount < amountNeeded)
|
||||||
{
|
{
|
||||||
if (!Owner.GetComponent<IMobStateComponent>().IsCritical())
|
if (!Owner.GetComponent<MobStateComponent>().IsCritical())
|
||||||
{
|
{
|
||||||
// Panic inhale
|
// Panic inhale
|
||||||
foreach (var lung in lungs)
|
foreach (var lung in lungs)
|
||||||
@@ -313,7 +313,7 @@ namespace Content.Server.Body.Respiratory
|
|||||||
/// </param>
|
/// </param>
|
||||||
public void Update(float frameTime)
|
public void Update(float frameTime)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent<IMobStateComponent>(out var state) ||
|
if (!Owner.TryGetComponent<MobStateComponent>(out var state) ||
|
||||||
state.IsDead())
|
state.IsDead())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.CharacterAppearance.Components;
|
|
||||||
using Content.Server.EUI;
|
using Content.Server.EUI;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.CharacterAppearance.Systems;
|
using Content.Shared.CharacterAppearance.Systems;
|
||||||
using Content.Shared.Cloning;
|
using Content.Shared.Cloning;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
@@ -108,7 +107,7 @@ namespace Content.Server.Cloning.Components
|
|||||||
if (cloningSystem.ClonesWaitingForMind.TryGetValue(mind, out var cloneUid))
|
if (cloningSystem.ClonesWaitingForMind.TryGetValue(mind, out var cloneUid))
|
||||||
{
|
{
|
||||||
if (Owner.EntityManager.TryGetEntity(cloneUid, out var clone) &&
|
if (Owner.EntityManager.TryGetEntity(cloneUid, out var clone) &&
|
||||||
clone.TryGetComponent<IMobStateComponent>(out var cloneState) &&
|
clone.TryGetComponent<MobStateComponent>(out var cloneState) &&
|
||||||
!cloneState.IsDead() &&
|
!cloneState.IsDead() &&
|
||||||
clone.TryGetComponent(out MindComponent? cloneMindComp) &&
|
clone.TryGetComponent(out MindComponent? cloneMindComp) &&
|
||||||
(cloneMindComp.Mind == null || cloneMindComp.Mind == mind))
|
(cloneMindComp.Mind == null || cloneMindComp.Mind == mind))
|
||||||
@@ -121,7 +120,7 @@ namespace Content.Server.Cloning.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mind.OwnedEntity != null &&
|
if (mind.OwnedEntity != null &&
|
||||||
mind.OwnedEntity.TryGetComponent<IMobStateComponent>(out var state) &&
|
mind.OwnedEntity.TryGetComponent<MobStateComponent>(out var state) &&
|
||||||
!state.IsDead())
|
!state.IsDead())
|
||||||
{
|
{
|
||||||
obj.Session.AttachedEntity?.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-already-alive"));
|
obj.Session.AttachedEntity?.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-already-alive"));
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
using Content.Server.Cuffs.Components;
|
using Content.Server.Cuffs.Components;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
using Content.Shared.Hands.Components;
|
|
||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Cuffs;
|
using Content.Shared.Cuffs;
|
||||||
|
using Content.Shared.Hands.Components;
|
||||||
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Content.Shared.MobState;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Cuffs
|
namespace Content.Server.Cuffs
|
||||||
@@ -66,7 +66,7 @@ namespace Content.Server.Cuffs
|
|||||||
if (args.User == args.Target)
|
if (args.User == args.Target)
|
||||||
{
|
{
|
||||||
// This UncuffAttemptEvent check should probably be In MobStateSystem, not here?
|
// This UncuffAttemptEvent check should probably be In MobStateSystem, not here?
|
||||||
if (userEntity.TryGetComponent<IMobStateComponent>(out var state))
|
if (userEntity.TryGetComponent<MobStateComponent>(out var state))
|
||||||
{
|
{
|
||||||
// Manually check this.
|
// Manually check this.
|
||||||
if (state.IsIncapacitated())
|
if (state.IsIncapacitated())
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Content.Server.Ghost.Components;
|
|||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Damage.Prototypes;
|
using Content.Shared.Damage.Prototypes;
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -58,7 +58,7 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
// (If the mob survives, that's a bug. Ghosting is kept regardless.)
|
// (If the mob survives, that's a bug. Ghosting is kept regardless.)
|
||||||
var canReturn = canReturnGlobal && mind.CharacterDeadPhysically;
|
var canReturn = canReturnGlobal && mind.CharacterDeadPhysically;
|
||||||
|
|
||||||
if (playerEntity != null && canReturnGlobal && playerEntity.TryGetComponent(out IMobStateComponent? mobState))
|
if (playerEntity != null && canReturnGlobal && playerEntity.TryGetComponent(out MobStateComponent? mobState))
|
||||||
{
|
{
|
||||||
if (mobState.IsCritical())
|
if (mobState.IsCritical())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,25 +11,25 @@ using Content.Server.PDA;
|
|||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Content.Server.Spawners.Components;
|
using Content.Server.Spawners.Components;
|
||||||
using Content.Server.Traitor;
|
using Content.Server.Traitor;
|
||||||
|
using Content.Server.Traitor.Uplink;
|
||||||
|
using Content.Server.Traitor.Uplink.Account;
|
||||||
|
using Content.Server.Traitor.Uplink.Components;
|
||||||
using Content.Server.TraitorDeathMatch.Components;
|
using Content.Server.TraitorDeathMatch.Components;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
|
using Content.Shared.Damage.Prototypes;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
|
using Content.Shared.Traitor.Uplink;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Content.Server.Traitor.Uplink.Components;
|
|
||||||
using Content.Shared.Traitor.Uplink;
|
|
||||||
using Content.Server.Traitor.Uplink;
|
|
||||||
using Content.Shared.Damage.Prototypes;
|
|
||||||
using Content.Server.Traitor.Uplink.Account;
|
|
||||||
|
|
||||||
namespace Content.Server.GameTicking.Presets
|
namespace Content.Server.GameTicking.Presets
|
||||||
{
|
{
|
||||||
@@ -151,7 +151,7 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
var avoidMeEntity = avoidMeMind.OwnedEntity;
|
var avoidMeEntity = avoidMeMind.OwnedEntity;
|
||||||
if (avoidMeEntity == null)
|
if (avoidMeEntity == null)
|
||||||
continue;
|
continue;
|
||||||
if (avoidMeEntity.TryGetComponent(out IMobStateComponent? mobState))
|
if (avoidMeEntity.TryGetComponent(out MobStateComponent? mobState))
|
||||||
{
|
{
|
||||||
// Does have mob state component; if critical or dead, they don't really matter for spawn checks
|
// Does have mob state component; if critical or dead, they don't really matter for spawn checks
|
||||||
if (mobState.IsCritical() || mobState.IsDead())
|
if (mobState.IsCritical() || mobState.IsDead())
|
||||||
@@ -198,7 +198,7 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
public override bool OnGhostAttempt(Mind.Mind mind, bool canReturnGlobal)
|
public override bool OnGhostAttempt(Mind.Mind mind, bool canReturnGlobal)
|
||||||
{
|
{
|
||||||
var entity = mind.OwnedEntity;
|
var entity = mind.OwnedEntity;
|
||||||
if ((entity != null) && (entity.TryGetComponent(out IMobStateComponent? mobState)))
|
if ((entity != null) && (entity.TryGetComponent(out MobStateComponent? mobState)))
|
||||||
{
|
{
|
||||||
if (mobState.IsCritical())
|
if (mobState.IsCritical())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Shared;
|
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
@@ -63,7 +62,7 @@ namespace Content.Server.GameTicking.Rules
|
|||||||
{
|
{
|
||||||
var playerEntity = playerSession.AttachedEntity;
|
var playerEntity = playerSession.AttachedEntity;
|
||||||
if (playerEntity == null
|
if (playerEntity == null
|
||||||
|| !playerEntity.TryGetComponent(out IMobStateComponent? state))
|
|| !playerEntity.TryGetComponent(out MobStateComponent? state))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ using Content.Server.Players;
|
|||||||
using Content.Server.Suspicion;
|
using Content.Server.Suspicion;
|
||||||
using Content.Server.Suspicion.EntitySystems;
|
using Content.Server.Suspicion.EntitySystems;
|
||||||
using Content.Server.Suspicion.Roles;
|
using Content.Server.Suspicion.Roles;
|
||||||
using Content.Shared;
|
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
@@ -90,7 +89,7 @@ namespace Content.Server.GameTicking.Rules
|
|||||||
foreach (var playerSession in _playerManager.GetAllPlayers())
|
foreach (var playerSession in _playerManager.GetAllPlayers())
|
||||||
{
|
{
|
||||||
if (playerSession.AttachedEntity == null
|
if (playerSession.AttachedEntity == null
|
||||||
|| !playerSession.AttachedEntity.TryGetComponent(out IMobStateComponent? mobState)
|
|| !playerSession.AttachedEntity.TryGetComponent(out MobStateComponent? mobState)
|
||||||
|| !playerSession.AttachedEntity.HasComponent<SuspicionRoleComponent>())
|
|| !playerSession.AttachedEntity.HasComponent<SuspicionRoleComponent>())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using Content.Server.Popups;
|
|||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Kitchen.Components;
|
using Content.Shared.Kitchen.Components;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Nutrition.Components;
|
using Content.Shared.Nutrition.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -106,7 +106,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented
|
// Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented
|
||||||
if (victim.TryGetComponent<IMobStateComponent>(out var state) &&
|
if (victim.TryGetComponent<MobStateComponent>(out var state) &&
|
||||||
!state.IsDead())
|
!state.IsDead())
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim)));
|
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim)));
|
||||||
|
|||||||
@@ -4,13 +4,12 @@ using Content.Server.Mind.Components;
|
|||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Preferences.Managers;
|
using Content.Server.Preferences.Managers;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.ActionBlocker;
|
|
||||||
using Content.Shared.Acts;
|
using Content.Shared.Acts;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.MedicalScanner;
|
using Content.Shared.MedicalScanner;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -110,7 +109,7 @@ namespace Content.Server.Medical.Components
|
|||||||
UserInterface?.SetState(newState);
|
UserInterface?.SetState(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MedicalScannerStatus GetStatusFromDamageState(IMobStateComponent state)
|
private MedicalScannerStatus GetStatusFromDamageState(MobStateComponent state)
|
||||||
{
|
{
|
||||||
if (state.IsAlive())
|
if (state.IsAlive())
|
||||||
{
|
{
|
||||||
@@ -135,7 +134,7 @@ namespace Content.Server.Medical.Components
|
|||||||
if (Powered)
|
if (Powered)
|
||||||
{
|
{
|
||||||
var body = _bodyContainer.ContainedEntity;
|
var body = _bodyContainer.ContainedEntity;
|
||||||
var state = body?.GetComponentOrNull<IMobStateComponent>();
|
var state = body?.GetComponentOrNull<MobStateComponent>();
|
||||||
|
|
||||||
return state == null
|
return state == null
|
||||||
? MedicalScannerStatus.Open
|
? MedicalScannerStatus.Open
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Content.Server.GameTicking;
|
|||||||
using Content.Server.Ghost.Components;
|
using Content.Server.Ghost.Components;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -131,7 +131,7 @@ namespace Content.Server.Mind.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dead =
|
var dead =
|
||||||
Owner.TryGetComponent<IMobStateComponent>(out var state) &&
|
Owner.TryGetComponent<MobStateComponent>(out var state) &&
|
||||||
state.IsDead();
|
state.IsDead();
|
||||||
|
|
||||||
if (!HasMind)
|
if (!HasMind)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using Content.Server.Mind.Components;
|
|||||||
using Content.Server.Objectives;
|
using Content.Server.Objectives;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Content.Server.Roles;
|
using Content.Server.Roles;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -139,7 +139,7 @@ namespace Content.Server.Mind
|
|||||||
// This can be null if they're deleted (spike / brain nom)
|
// This can be null if they're deleted (spike / brain nom)
|
||||||
if (OwnedEntity == null)
|
if (OwnedEntity == null)
|
||||||
return true;
|
return true;
|
||||||
var targetMobState = OwnedEntity.GetComponentOrNull<IMobStateComponent>();
|
var targetMobState = OwnedEntity.GetComponentOrNull<MobStateComponent>();
|
||||||
// This can be null if it's a brain (this happens very often)
|
// This can be null if it's a brain (this happens very often)
|
||||||
// Brains are the result of gibbing so should definitely count as dead
|
// Brains are the result of gibbing so should definitely count as dead
|
||||||
if (targetMobState == null)
|
if (targetMobState == null)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Content.Server.Alert;
|
|||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.MobState.State;
|
using Content.Shared.MobState.State;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ namespace Content.Server.MobState.States
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out IMobStateComponent? stateComponent))
|
if (!entity.TryGetComponent(out MobStateComponent? stateComponent))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.Alert;
|
using Content.Server.Alert;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Content.Shared.Movement.EntitySystems;
|
using Content.Shared.Movement.EntitySystems;
|
||||||
using Content.Shared.Nutrition.Components;
|
using Content.Shared.Nutrition.Components;
|
||||||
@@ -182,7 +182,7 @@ namespace Content.Server.Nutrition.Components
|
|||||||
return;
|
return;
|
||||||
// --> Current Hunger is below dead threshold
|
// --> Current Hunger is below dead threshold
|
||||||
|
|
||||||
if (!Owner.TryGetComponent(out IMobStateComponent? mobState))
|
if (!Owner.TryGetComponent(out MobStateComponent? mobState))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!mobState.IsDead())
|
if (!mobState.IsDead())
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.Alert;
|
using Content.Server.Alert;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Content.Shared.Movement.EntitySystems;
|
using Content.Shared.Movement.EntitySystems;
|
||||||
using Content.Shared.Nutrition.Components;
|
using Content.Shared.Nutrition.Components;
|
||||||
@@ -179,7 +179,7 @@ namespace Content.Server.Nutrition.Components
|
|||||||
return;
|
return;
|
||||||
// --> Current Hunger is below dead threshold
|
// --> Current Hunger is below dead threshold
|
||||||
|
|
||||||
if (!Owner.TryGetComponent(out IMobStateComponent? mobState))
|
if (!Owner.TryGetComponent(out MobStateComponent? mobState))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!mobState.IsDead())
|
if (!mobState.IsDead())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
using Content.Server.Objectives.Interfaces;
|
using Content.Server.Objectives.Interfaces;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -20,7 +20,7 @@ namespace Content.Server.Objectives.Conditions
|
|||||||
var allHumans = entityMgr.EntityQuery<MindComponent>(true).Where(mc =>
|
var allHumans = entityMgr.EntityQuery<MindComponent>(true).Where(mc =>
|
||||||
{
|
{
|
||||||
var entity = mc.Mind?.OwnedEntity;
|
var entity = mc.Mind?.OwnedEntity;
|
||||||
return (entity?.GetComponentOrNull<IMobStateComponent>()?.IsAlive() ?? false) && mc.Mind != mind;
|
return (entity?.GetComponentOrNull<MobStateComponent>()?.IsAlive() ?? false) && mc.Mind != mind;
|
||||||
}).Select(mc => mc.Mind).ToList();
|
}).Select(mc => mc.Mind).ToList();
|
||||||
return new KillRandomPersonCondition {Target = IoCManager.Resolve<IRobustRandom>().Pick(allHumans)};
|
return new KillRandomPersonCondition {Target = IoCManager.Resolve<IRobustRandom>().Pick(allHumans)};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Explosion;
|
using Content.Server.Explosion;
|
||||||
using Content.Server.Pointing.Components;
|
using Content.Server.Pointing.Components;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Pointing.Components;
|
using Content.Shared.Pointing.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -44,7 +44,7 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
|
|
||||||
var players = _playerManager
|
var players = _playerManager
|
||||||
.GetPlayersInRange(transform.Coordinates, 15)
|
.GetPlayersInRange(transform.Coordinates, 15)
|
||||||
.Where(player => player.AttachedEntity != null && player.AttachedEntity.TryGetComponent(out IMobStateComponent? mobStateComponent) && !mobStateComponent.IsDead())
|
.Where(player => player.AttachedEntity != null && player.AttachedEntity.TryGetComponent(out MobStateComponent? mobStateComponent) && !mobStateComponent.IsDead())
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
if (players.Length == 0)
|
if (players.Length == 0)
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ using Content.Server.Roles;
|
|||||||
using Content.Server.Suspicion.EntitySystems;
|
using Content.Server.Suspicion.EntitySystems;
|
||||||
using Content.Server.Suspicion.Roles;
|
using Content.Server.Suspicion.Roles;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Suspicion;
|
using Content.Shared.Suspicion;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
@@ -60,7 +59,7 @@ namespace Content.Server.Suspicion
|
|||||||
|
|
||||||
public bool IsDead()
|
public bool IsDead()
|
||||||
{
|
{
|
||||||
return Owner.TryGetComponent(out IMobStateComponent? state) &&
|
return Owner.TryGetComponent(out MobStateComponent? state) &&
|
||||||
state.IsDead();
|
state.IsDead();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.Interaction;
|
using Content.Server.Interaction;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -46,7 +46,7 @@ namespace Content.Server.Throwing
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.HasComponent<IMobStateComponent>())
|
if (entity.HasComponent<MobStateComponent>())
|
||||||
{
|
{
|
||||||
Logger.Warning("Throwing not supported for mobs!");
|
Logger.Warning("Throwing not supported for mobs!");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Disposal.Components;
|
using Content.Shared.Disposal.Components;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -63,7 +63,7 @@ namespace Content.Shared.Disposal
|
|||||||
if (!entity.TryGetComponent(out IPhysBody? physics) ||
|
if (!entity.TryGetComponent(out IPhysBody? physics) ||
|
||||||
!physics.CanCollide && storable == null)
|
!physics.CanCollide && storable == null)
|
||||||
{
|
{
|
||||||
if (!(entity.TryGetComponent(out IMobStateComponent? damageState) && damageState.IsDead()))
|
if (!(entity.TryGetComponent(out MobStateComponent? damageState) && damageState.IsDead()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ namespace Content.Shared.MobState.Components
|
|||||||
/// (such as blur effect for unconsciousness) and managing the health HUD.
|
/// (such as blur effect for unconsciousness) and managing the health HUD.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IMobStateComponent))]
|
[NetworkedComponent]
|
||||||
[NetworkedComponent()]
|
public class MobStateComponent : Component
|
||||||
public class MobStateComponent : Component, IMobStateComponent
|
|
||||||
{
|
{
|
||||||
public override string Name => "MobState";
|
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;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Shared.MobState
|
namespace Content.Shared.MobState
|
||||||
@@ -8,7 +9,7 @@ namespace Content.Shared.MobState
|
|||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
{
|
{
|
||||||
public MobStateChangedMessage(
|
public MobStateChangedMessage(
|
||||||
IMobStateComponent component,
|
MobStateComponent component,
|
||||||
IMobState? oldMobState,
|
IMobState? oldMobState,
|
||||||
IMobState currentMobState)
|
IMobState currentMobState)
|
||||||
{
|
{
|
||||||
@@ -19,7 +20,7 @@ namespace Content.Shared.MobState
|
|||||||
|
|
||||||
public IEntity Entity => Component.Owner;
|
public IEntity Entity => Component.Owner;
|
||||||
|
|
||||||
public IMobStateComponent Component { get; }
|
public MobStateComponent Component { get; }
|
||||||
|
|
||||||
public IMobState? OldMobState { get; }
|
public IMobState? OldMobState { get; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.MobState;
|
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -54,7 +53,7 @@ namespace Content.Shared.Movement.EntitySystems
|
|||||||
|
|
||||||
// For stuff like "Moving out of locker" or the likes
|
// For stuff like "Moving out of locker" or the likes
|
||||||
if (owner.IsInContainer() &&
|
if (owner.IsInContainer() &&
|
||||||
(!owner.TryGetComponent(out IMobStateComponent? mobState) ||
|
(!owner.TryGetComponent(out MobStateComponent? mobState) ||
|
||||||
mobState.IsAlive()))
|
mobState.IsAlive()))
|
||||||
{
|
{
|
||||||
var relayMoveEvent = new RelayMovementEntityEvent(owner);
|
var relayMoveEvent = new RelayMovementEntityEvent(owner);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Friction;
|
using Content.Shared.Friction;
|
||||||
using Content.Shared.MobState;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Content.Shared.Pulling.Components;
|
using Content.Shared.Pulling.Components;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
@@ -160,7 +160,7 @@ namespace Content.Shared.Movement
|
|||||||
protected bool UseMobMovement(PhysicsComponent body)
|
protected bool UseMobMovement(PhysicsComponent body)
|
||||||
{
|
{
|
||||||
return body.BodyStatus == BodyStatus.OnGround &&
|
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.
|
// If we're being pulled then don't mess with our velocity.
|
||||||
(!body.Owner.TryGetComponent(out SharedPullableComponent? pullable) || !pullable.BeingPulled) &&
|
(!body.Owner.TryGetComponent(out SharedPullableComponent? pullable) || !pullable.BeingPulled) &&
|
||||||
_blocker.CanMove(body.Owner);
|
_blocker.CanMove(body.Owner);
|
||||||
|
|||||||
Reference in New Issue
Block a user