diff --git a/Content.Client/HealthOverlay/HealthOverlaySystem.cs b/Content.Client/HealthOverlay/HealthOverlaySystem.cs index cc987e7b55..8d43da2692 100644 --- a/Content.Client/HealthOverlay/HealthOverlaySystem.cs +++ b/Content.Client/HealthOverlay/HealthOverlaySystem.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Content.Client.HealthOverlay.UI; using Content.Shared.Damage; using Content.Shared.GameTicking; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Client.Graphics; @@ -79,7 +79,7 @@ namespace Content.Client.HealthOverlay var viewBox = _eyeManager.GetWorldViewport().Enlarged(2.0f); - foreach (var (mobState, _) in EntityManager.EntityQuery()) + foreach (var (mobState, _) in EntityManager.EntityQuery()) { var entity = mobState.Owner; diff --git a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs index 707d48f5e2..7f41f8f458 100644 --- a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs +++ b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs @@ -2,7 +2,7 @@ using Content.Client.IoC; using Content.Client.Resources; using Content.Shared.Damage; using Content.Shared.FixedPoint; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; @@ -77,7 +77,7 @@ namespace Content.Client.HealthOverlay.UI return; } - if (!Entity.TryGetComponent(out IMobStateComponent? mobState) || + if (!Entity.TryGetComponent(out MobStateComponent? mobState) || !Entity.TryGetComponent(out DamageableComponent? damageable)) { CritBar.Visible = false; diff --git a/Content.Client/MobState/Overlays/CritOverlay.cs b/Content.Client/MobState/Overlays/CritOverlay.cs index dbbf53cf93..3813e7e69f 100644 --- a/Content.Client/MobState/Overlays/CritOverlay.cs +++ b/Content.Client/MobState/Overlays/CritOverlay.cs @@ -1,4 +1,4 @@ -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Robust.Client.Graphics; using Robust.Client.Player; using Robust.Shared.Enums; @@ -31,7 +31,7 @@ namespace Content.Client.MobState.Overlays return false; } - if (playerEntity.TryGetComponent(out var mobState)) + if (playerEntity.TryGetComponent(out var mobState)) { if (critical) if (mobState.IsCritical()) diff --git a/Content.Client/Physics/Controllers/MoverController.cs b/Content.Client/Physics/Controllers/MoverController.cs index b698543f0c..1bfcb68930 100644 --- a/Content.Client/Physics/Controllers/MoverController.cs +++ b/Content.Client/Physics/Controllers/MoverController.cs @@ -1,5 +1,4 @@ -using Content.Shared.Body.Components; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Movement; using Content.Shared.Movement.Components; using Content.Shared.Pulling.Components; @@ -57,7 +56,7 @@ namespace Content.Client.Physics.Controllers var pulling = pullerComp.Pulling; if (pulling != null && - pulling.HasComponent() && + pulling.HasComponent() && pulling.TryGetComponent(out PhysicsComponent? pullingBody)) { pullingBody.Predict = false; diff --git a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs index 25df0048f9..bd72d5f8b4 100644 --- a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs +++ b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs @@ -1,9 +1,9 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using Content.Server.Administration.Commands; using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; using Content.Shared.FixedPoint; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using NUnit.Framework; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -49,7 +49,7 @@ namespace Content.IntegrationTests.Tests.Commands // Sanity check Assert.True(human.TryGetComponent(out DamageableComponent damageable)); - Assert.True(human.TryGetComponent(out IMobStateComponent mobState)); + Assert.True(human.TryGetComponent(out MobStateComponent mobState)); mobState.UpdateState(0); Assert.That(mobState.IsAlive, Is.True); Assert.That(mobState.IsCritical, Is.False); diff --git a/Content.Server/AI/Utility/Considerations/Combat/TargetIsCritCon.cs b/Content.Server/AI/Utility/Considerations/Combat/TargetIsCritCon.cs index 159459b10b..7bd4ff2adb 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/TargetIsCritCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/TargetIsCritCon.cs @@ -1,6 +1,6 @@ using Content.Server.AI.WorldState; using Content.Server.AI.WorldState.States; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; namespace Content.Server.AI.Utility.Considerations.Combat { @@ -10,7 +10,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat { var target = context.GetState().GetValue(); - if (target == null || !target.TryGetComponent(out IMobStateComponent? mobState)) + if (target == null || !target.TryGetComponent(out MobStateComponent? mobState)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Combat/TargetIsDeadCon.cs b/Content.Server/AI/Utility/Considerations/Combat/TargetIsDeadCon.cs index 7a36c451b5..271c1ff929 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/TargetIsDeadCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/TargetIsDeadCon.cs @@ -1,6 +1,6 @@ using Content.Server.AI.WorldState; using Content.Server.AI.WorldState.States; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; namespace Content.Server.AI.Utility.Considerations.Combat { @@ -10,7 +10,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat { var target = context.GetState().GetValue(); - if (target == null || !target.TryGetComponent(out IMobStateComponent? mobState)) + if (target == null || !target.TryGetComponent(out MobStateComponent? mobState)) { return 0.0f; } diff --git a/Content.Server/Administration/Commands/RejuvenateCommand.cs b/Content.Server/Administration/Commands/RejuvenateCommand.cs index 76f65ff0d4..21b1d2f171 100644 --- a/Content.Server/Administration/Commands/RejuvenateCommand.cs +++ b/Content.Server/Administration/Commands/RejuvenateCommand.cs @@ -2,15 +2,12 @@ using Content.Server.Atmos.Components; using Content.Server.Atmos.EntitySystems; using Content.Server.Nutrition.Components; using Content.Server.Nutrition.EntitySystems; -using Content.Server.Stunnable; -using Content.Server.Stunnable.Components; using Content.Shared.Administration; using Content.Shared.Damage; using Content.Shared.Jittering; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Nutrition.Components; using Content.Shared.StatusEffect; -using Content.Shared.Stunnable; using Robust.Server.Player; using Robust.Shared.Console; using Robust.Shared.GameObjects; @@ -56,7 +53,7 @@ namespace Content.Server.Administration.Commands public static void PerformRejuvenate(IEntity target) { - target.GetComponentOrNull()?.UpdateState(0); + target.GetComponentOrNull()?.UpdateState(0); target.GetComponentOrNull()?.ResetFood(); target.GetComponentOrNull()?.ResetThirst(); diff --git a/Content.Server/Atmos/Components/MovedByPressureComponent.cs b/Content.Server/Atmos/Components/MovedByPressureComponent.cs index f0521cc34b..17c2973d24 100644 --- a/Content.Server/Atmos/Components/MovedByPressureComponent.cs +++ b/Content.Server/Atmos/Components/MovedByPressureComponent.cs @@ -1,7 +1,7 @@ using System; using System.Diagnostics.CodeAnalysis; using Content.Shared.Atmos; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Physics; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -61,7 +61,7 @@ namespace Content.Server.Atmos.Components && (maxForce >= (MoveResist * MoveForcePushRatio))) || (physics.BodyType == BodyType.Static && (maxForce >= (MoveResist * MoveForceForcePushRatio)))) { - if (physics.Owner.HasComponent()) + if (physics.Owner.HasComponent()) { physics.BodyStatus = BodyStatus.InAir; @@ -75,7 +75,7 @@ namespace Content.Server.Atmos.Components if (Deleted || !Owner.TryGetComponent(out PhysicsComponent? physicsComponent)) return; // Uhh if you get race conditions good luck buddy. - if (physicsComponent.Owner.HasComponent()) + if (physicsComponent.Owner.HasComponent()) { physicsComponent.BodyStatus = BodyStatus.OnGround; } diff --git a/Content.Server/Body/Behavior/LungBehavior.cs b/Content.Server/Body/Behavior/LungBehavior.cs index 6399b6a635..572778c27a 100644 --- a/Content.Server/Body/Behavior/LungBehavior.cs +++ b/Content.Server/Body/Behavior/LungBehavior.cs @@ -8,6 +8,7 @@ using Content.Server.Popups; using Content.Shared.Atmos; using Content.Shared.Body.Components; using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; @@ -92,7 +93,7 @@ namespace Content.Server.Body.Behavior 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; } diff --git a/Content.Server/Body/BodySystem.cs b/Content.Server/Body/BodySystem.cs index e3e7e1713a..cb96f3edb4 100644 --- a/Content.Server/Body/BodySystem.cs +++ b/Content.Server/Body/BodySystem.cs @@ -1,7 +1,6 @@ using Content.Server.GameTicking; using Content.Server.Mind.Components; -using Content.Shared.MobState; -using Content.Shared.MobState.State; +using Content.Shared.MobState.Components; using Content.Shared.Movement.EntitySystems; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -20,7 +19,7 @@ namespace Content.Server.Body private void OnRelayMoveInput(EntityUid uid, BodyComponent component, RelayMoveInputEvent args) { - if (EntityManager.TryGetComponent(uid, out var mobState) && + if (EntityManager.TryGetComponent(uid, out var mobState) && mobState.IsDead() && EntityManager.TryGetComponent(uid, out var mind) && mind.HasMind) diff --git a/Content.Server/Body/Respiratory/RespiratorComponent.cs b/Content.Server/Body/Respiratory/RespiratorComponent.cs index 69071910b6..6fbb370b96 100644 --- a/Content.Server/Body/Respiratory/RespiratorComponent.cs +++ b/Content.Server/Body/Respiratory/RespiratorComponent.cs @@ -13,7 +13,7 @@ using Content.Shared.Alert; using Content.Shared.Atmos; using Content.Shared.Body.Components; using Content.Shared.Damage; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Popups; using Robust.Shared.GameObjects; using Robust.Shared.Localization; @@ -190,7 +190,7 @@ namespace Content.Server.Body.Respiratory if (bloodstreamAmount < amountNeeded) { - if (!Owner.GetComponent().IsCritical()) + if (!Owner.GetComponent().IsCritical()) { // Panic inhale foreach (var lung in lungs) @@ -313,7 +313,7 @@ namespace Content.Server.Body.Respiratory /// public void Update(float frameTime) { - if (!Owner.TryGetComponent(out var state) || + if (!Owner.TryGetComponent(out var state) || state.IsDead()) { return; diff --git a/Content.Server/Cloning/Components/CloningPodComponent.cs b/Content.Server/Cloning/Components/CloningPodComponent.cs index bbc30da4b1..0d89351f86 100644 --- a/Content.Server/Cloning/Components/CloningPodComponent.cs +++ b/Content.Server/Cloning/Components/CloningPodComponent.cs @@ -1,12 +1,11 @@ using System; -using Content.Server.CharacterAppearance.Components; using Content.Server.EUI; using Content.Server.Mind.Components; using Content.Server.Power.Components; using Content.Server.UserInterface; using Content.Shared.CharacterAppearance.Systems; using Content.Shared.Cloning; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Popups; using Robust.Server.GameObjects; using Robust.Server.Player; @@ -108,7 +107,7 @@ namespace Content.Server.Cloning.Components if (cloningSystem.ClonesWaitingForMind.TryGetValue(mind, out var cloneUid)) { if (Owner.EntityManager.TryGetEntity(cloneUid, out var clone) && - clone.TryGetComponent(out var cloneState) && + clone.TryGetComponent(out var cloneState) && !cloneState.IsDead() && clone.TryGetComponent(out MindComponent? cloneMindComp) && (cloneMindComp.Mind == null || cloneMindComp.Mind == mind)) @@ -121,7 +120,7 @@ namespace Content.Server.Cloning.Components } if (mind.OwnedEntity != null && - mind.OwnedEntity.TryGetComponent(out var state) && + mind.OwnedEntity.TryGetComponent(out var state) && !state.IsDead()) { obj.Session.AttachedEntity?.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-already-alive")); diff --git a/Content.Server/Cuffs/CuffableSystem.cs b/Content.Server/Cuffs/CuffableSystem.cs index 159373d6a3..ce3df12fcb 100644 --- a/Content.Server/Cuffs/CuffableSystem.cs +++ b/Content.Server/Cuffs/CuffableSystem.cs @@ -1,15 +1,15 @@ using Content.Server.Cuffs.Components; using Content.Server.Hands.Components; -using Content.Shared.Hands.Components; using Content.Shared.ActionBlocker; using Content.Shared.Cuffs; +using Content.Shared.Hands.Components; +using Content.Shared.MobState.Components; using Content.Shared.Popups; using Content.Shared.Verbs; using JetBrains.Annotations; using Robust.Shared.GameObjects; -using Robust.Shared.Localization; using Robust.Shared.IoC; -using Content.Shared.MobState; +using Robust.Shared.Localization; using Robust.Shared.Player; namespace Content.Server.Cuffs @@ -66,7 +66,7 @@ namespace Content.Server.Cuffs if (args.User == args.Target) { // This UncuffAttemptEvent check should probably be In MobStateSystem, not here? - if (userEntity.TryGetComponent(out var state)) + if (userEntity.TryGetComponent(out var state)) { // Manually check this. if (state.IsIncapacitated()) diff --git a/Content.Server/GameTicking/Presets/GamePreset.cs b/Content.Server/GameTicking/Presets/GamePreset.cs index b1cb93b771..7f290ed31b 100644 --- a/Content.Server/GameTicking/Presets/GamePreset.cs +++ b/Content.Server/GameTicking/Presets/GamePreset.cs @@ -4,7 +4,7 @@ using Content.Server.Ghost.Components; using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; using Content.Shared.Ghost; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Preferences; using Robust.Server.Player; 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.) 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()) { diff --git a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs index c15ce05ab4..6a4242cd96 100644 --- a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs +++ b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs @@ -11,25 +11,25 @@ using Content.Server.PDA; using Content.Server.Players; using Content.Server.Spawners.Components; 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.Shared.CCVar; using Content.Shared.Damage; +using Content.Shared.Damage.Prototypes; using Content.Shared.Inventory; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; +using Content.Shared.Traitor.Uplink; using Robust.Server.Player; using Robust.Shared.Configuration; using Robust.Shared.GameObjects; using Robust.Shared.IoC; -using Robust.Shared.Prototypes; using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Map; +using Robust.Shared.Prototypes; 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 { @@ -151,7 +151,7 @@ namespace Content.Server.GameTicking.Presets var avoidMeEntity = avoidMeMind.OwnedEntity; if (avoidMeEntity == null) 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 if (mobState.IsCritical() || mobState.IsDead()) @@ -198,7 +198,7 @@ namespace Content.Server.GameTicking.Presets public override bool OnGhostAttempt(Mind.Mind mind, bool canReturnGlobal) { var entity = mind.OwnedEntity; - if ((entity != null) && (entity.TryGetComponent(out IMobStateComponent? mobState))) + if ((entity != null) && (entity.TryGetComponent(out MobStateComponent? mobState))) { if (mobState.IsCritical()) { diff --git a/Content.Server/GameTicking/Rules/RuleDeathMatch.cs b/Content.Server/GameTicking/Rules/RuleDeathMatch.cs index 672a9a688f..fc77f15697 100644 --- a/Content.Server/GameTicking/Rules/RuleDeathMatch.cs +++ b/Content.Server/GameTicking/Rules/RuleDeathMatch.cs @@ -1,10 +1,9 @@ using System; using System.Threading; using Content.Server.Chat.Managers; -using Content.Shared; using Content.Shared.CCVar; using Content.Shared.Damage; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Robust.Server.Player; using Robust.Shared.Configuration; using Robust.Shared.Enums; @@ -63,7 +62,7 @@ namespace Content.Server.GameTicking.Rules { var playerEntity = playerSession.AttachedEntity; if (playerEntity == null - || !playerEntity.TryGetComponent(out IMobStateComponent? state)) + || !playerEntity.TryGetComponent(out MobStateComponent? state)) { continue; } diff --git a/Content.Server/GameTicking/Rules/RuleSuspicion.cs b/Content.Server/GameTicking/Rules/RuleSuspicion.cs index 130ddf8614..d10a871b93 100644 --- a/Content.Server/GameTicking/Rules/RuleSuspicion.cs +++ b/Content.Server/GameTicking/Rules/RuleSuspicion.cs @@ -6,9 +6,8 @@ using Content.Server.Players; using Content.Server.Suspicion; using Content.Server.Suspicion.EntitySystems; using Content.Server.Suspicion.Roles; -using Content.Shared; using Content.Shared.CCVar; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Sound; using Robust.Server.Player; using Robust.Shared.Audio; @@ -90,7 +89,7 @@ namespace Content.Server.GameTicking.Rules foreach (var playerSession in _playerManager.GetAllPlayers()) { if (playerSession.AttachedEntity == null - || !playerSession.AttachedEntity.TryGetComponent(out IMobStateComponent? mobState) + || !playerSession.AttachedEntity.TryGetComponent(out MobStateComponent? mobState) || !playerSession.AttachedEntity.HasComponent()) { continue; diff --git a/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs b/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs index a41710baa3..23b3d31ed3 100644 --- a/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs +++ b/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs @@ -7,7 +7,7 @@ using Content.Server.Popups; using Content.Shared.DragDrop; using Content.Shared.Interaction; using Content.Shared.Kitchen.Components; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Nutrition.Components; using Content.Shared.Popups; using Robust.Server.GameObjects; @@ -106,7 +106,7 @@ namespace Content.Server.Kitchen.Components return; // Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented - if (victim.TryGetComponent(out var state) && + if (victim.TryGetComponent(out var state) && !state.IsDead()) { Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim))); diff --git a/Content.Server/Medical/Components/MedicalScannerComponent.cs b/Content.Server/Medical/Components/MedicalScannerComponent.cs index 49d82cd650..c3671a565e 100644 --- a/Content.Server/Medical/Components/MedicalScannerComponent.cs +++ b/Content.Server/Medical/Components/MedicalScannerComponent.cs @@ -4,13 +4,12 @@ using Content.Server.Mind.Components; using Content.Server.Power.Components; using Content.Server.Preferences.Managers; using Content.Server.UserInterface; -using Content.Shared.ActionBlocker; using Content.Shared.Acts; using Content.Shared.Damage; using Content.Shared.DragDrop; using Content.Shared.Interaction; using Content.Shared.MedicalScanner; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Popups; using Content.Shared.Preferences; using Robust.Server.GameObjects; @@ -110,7 +109,7 @@ namespace Content.Server.Medical.Components UserInterface?.SetState(newState); } - private MedicalScannerStatus GetStatusFromDamageState(IMobStateComponent state) + private MedicalScannerStatus GetStatusFromDamageState(MobStateComponent state) { if (state.IsAlive()) { @@ -135,7 +134,7 @@ namespace Content.Server.Medical.Components if (Powered) { var body = _bodyContainer.ContainedEntity; - var state = body?.GetComponentOrNull(); + var state = body?.GetComponentOrNull(); return state == null ? MedicalScannerStatus.Open diff --git a/Content.Server/Mind/Components/MindComponent.cs b/Content.Server/Mind/Components/MindComponent.cs index 7331cc5607..ebc9fe3a63 100644 --- a/Content.Server/Mind/Components/MindComponent.cs +++ b/Content.Server/Mind/Components/MindComponent.cs @@ -2,7 +2,7 @@ using Content.Server.GameTicking; using Content.Server.Ghost.Components; using Content.Shared.Examine; using Content.Shared.Ghost; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; @@ -131,7 +131,7 @@ namespace Content.Server.Mind.Components } var dead = - Owner.TryGetComponent(out var state) && + Owner.TryGetComponent(out var state) && state.IsDead(); if (!HasMind) diff --git a/Content.Server/Mind/Mind.cs b/Content.Server/Mind/Mind.cs index e7dcf02856..6a6e5db730 100644 --- a/Content.Server/Mind/Mind.cs +++ b/Content.Server/Mind/Mind.cs @@ -8,7 +8,7 @@ using Content.Server.Mind.Components; using Content.Server.Objectives; using Content.Server.Players; using Content.Server.Roles; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.GameObjects; @@ -139,7 +139,7 @@ namespace Content.Server.Mind // This can be null if they're deleted (spike / brain nom) if (OwnedEntity == null) return true; - var targetMobState = OwnedEntity.GetComponentOrNull(); + var targetMobState = OwnedEntity.GetComponentOrNull(); // 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 if (targetMobState == null) diff --git a/Content.Server/MobState/States/NormalMobState.cs b/Content.Server/MobState/States/NormalMobState.cs index c4c68277e2..0094a98ec2 100644 --- a/Content.Server/MobState/States/NormalMobState.cs +++ b/Content.Server/MobState/States/NormalMobState.cs @@ -2,7 +2,7 @@ using Content.Server.Alert; using Content.Shared.Alert; using Content.Shared.Damage; using Content.Shared.FixedPoint; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.MobState.State; using Robust.Shared.GameObjects; @@ -24,7 +24,7 @@ namespace Content.Server.MobState.States return; } - if (!entity.TryGetComponent(out IMobStateComponent? stateComponent)) + if (!entity.TryGetComponent(out MobStateComponent? stateComponent)) { return; } diff --git a/Content.Server/Nutrition/Components/HungerComponent.cs b/Content.Server/Nutrition/Components/HungerComponent.cs index be68ed3df5..1b2b1d31fd 100644 --- a/Content.Server/Nutrition/Components/HungerComponent.cs +++ b/Content.Server/Nutrition/Components/HungerComponent.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Content.Server.Alert; using Content.Shared.Alert; using Content.Shared.Damage; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Movement.Components; using Content.Shared.Movement.EntitySystems; using Content.Shared.Nutrition.Components; @@ -182,7 +182,7 @@ namespace Content.Server.Nutrition.Components return; // --> Current Hunger is below dead threshold - if (!Owner.TryGetComponent(out IMobStateComponent? mobState)) + if (!Owner.TryGetComponent(out MobStateComponent? mobState)) return; if (!mobState.IsDead()) diff --git a/Content.Server/Nutrition/Components/ThirstComponent.cs b/Content.Server/Nutrition/Components/ThirstComponent.cs index 39207a1955..ca7f28de31 100644 --- a/Content.Server/Nutrition/Components/ThirstComponent.cs +++ b/Content.Server/Nutrition/Components/ThirstComponent.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Content.Server.Alert; using Content.Shared.Alert; using Content.Shared.Damage; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Movement.Components; using Content.Shared.Movement.EntitySystems; using Content.Shared.Nutrition.Components; @@ -179,7 +179,7 @@ namespace Content.Server.Nutrition.Components return; // --> Current Hunger is below dead threshold - if (!Owner.TryGetComponent(out IMobStateComponent? mobState)) + if (!Owner.TryGetComponent(out MobStateComponent? mobState)) return; if (!mobState.IsDead()) diff --git a/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs b/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs index 438703b42c..1a47af4bbc 100644 --- a/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs +++ b/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs @@ -1,7 +1,7 @@ using System.Linq; using Content.Server.Mind.Components; using Content.Server.Objectives.Interfaces; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -20,7 +20,7 @@ namespace Content.Server.Objectives.Conditions var allHumans = entityMgr.EntityQuery(true).Where(mc => { var entity = mc.Mind?.OwnedEntity; - return (entity?.GetComponentOrNull()?.IsAlive() ?? false) && mc.Mind != mind; + return (entity?.GetComponentOrNull()?.IsAlive() ?? false) && mc.Mind != mind; }).Select(mc => mc.Mind).ToList(); return new KillRandomPersonCondition {Target = IoCManager.Resolve().Pick(allHumans)}; } diff --git a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs index 069633fe56..2047f5678a 100644 --- a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs @@ -1,7 +1,7 @@ using System.Linq; using Content.Server.Explosion; using Content.Server.Pointing.Components; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Pointing.Components; using JetBrains.Annotations; using Robust.Server.GameObjects; @@ -44,7 +44,7 @@ namespace Content.Server.Pointing.EntitySystems var players = _playerManager .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(); if (players.Length == 0) diff --git a/Content.Server/Suspicion/SuspicionRoleComponent.cs b/Content.Server/Suspicion/SuspicionRoleComponent.cs index 60ac8c7eab..a2122e1f93 100644 --- a/Content.Server/Suspicion/SuspicionRoleComponent.cs +++ b/Content.Server/Suspicion/SuspicionRoleComponent.cs @@ -6,9 +6,8 @@ using Content.Server.Roles; using Content.Server.Suspicion.EntitySystems; using Content.Server.Suspicion.Roles; using Content.Shared.Examine; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Suspicion; -using Robust.Server.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Players; @@ -60,7 +59,7 @@ namespace Content.Server.Suspicion public bool IsDead() { - return Owner.TryGetComponent(out IMobStateComponent? state) && + return Owner.TryGetComponent(out MobStateComponent? state) && state.IsDead(); } diff --git a/Content.Server/Throwing/ThrowHelper.cs b/Content.Server/Throwing/ThrowHelper.cs index 0d019be009..e268d50326 100644 --- a/Content.Server/Throwing/ThrowHelper.cs +++ b/Content.Server/Throwing/ThrowHelper.cs @@ -1,7 +1,7 @@ using System; using Content.Server.Interaction; using Content.Server.Items; -using Content.Shared.MobState; +using Content.Shared.MobState.Components; using Content.Shared.Tag; using Content.Shared.Throwing; using Robust.Shared.GameObjects; @@ -46,7 +46,7 @@ namespace Content.Server.Throwing return; } - if (entity.HasComponent()) + if (entity.HasComponent()) { Logger.Warning("Throwing not supported for mobs!"); return; diff --git a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs index b1bcca3bae..7e14549624 100644 --- a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs +++ b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs @@ -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; } diff --git a/Content.Shared/MobState/Components/MobStateComponent.cs b/Content.Shared/MobState/Components/MobStateComponent.cs index 10e42afaf3..5591391c61 100644 --- a/Content.Shared/MobState/Components/MobStateComponent.cs +++ b/Content.Shared/MobState/Components/MobStateComponent.cs @@ -22,9 +22,8 @@ namespace Content.Shared.MobState.Components /// (such as blur effect for unconsciousness) and managing the health HUD. /// [RegisterComponent] - [ComponentReference(typeof(IMobStateComponent))] - [NetworkedComponent()] - public class MobStateComponent : Component, IMobStateComponent + [NetworkedComponent] + public class MobStateComponent : Component { public override string Name => "MobState"; diff --git a/Content.Shared/MobState/IMobStateComponent.cs b/Content.Shared/MobState/IMobStateComponent.cs deleted file mode 100644 index 6f829170a5..0000000000 --- a/Content.Shared/MobState/IMobStateComponent.cs +++ /dev/null @@ -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); - } -} diff --git a/Content.Shared/MobState/MobStateChangedMessage.cs b/Content.Shared/MobState/MobStateChangedMessage.cs index 97fd672489..5ac381fa77 100644 --- a/Content.Shared/MobState/MobStateChangedMessage.cs +++ b/Content.Shared/MobState/MobStateChangedMessage.cs @@ -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; } diff --git a/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs b/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs index 11469b89c5..6851f41d9b 100644 --- a/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs +++ b/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs @@ -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); diff --git a/Content.Shared/Movement/SharedMoverController.cs b/Content.Shared/Movement/SharedMoverController.cs index 928865cd65..dd5007fdc5 100644 --- a/Content.Shared/Movement/SharedMoverController.cs +++ b/Content.Shared/Movement/SharedMoverController.cs @@ -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() && + body.Owner.HasComponent() && // If we're being pulled then don't mess with our velocity. (!body.Owner.TryGetComponent(out SharedPullableComponent? pullable) || !pullable.BeingPulled) && _blocker.CanMove(body.Owner);