Cleaned up obsolete properties from MobStateComponent (#13097)
Co-authored-by: Jezithyr <Jezithyr@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Server.Chemistry.EntitySystems;
|
|||||||
using Content.Server.Chemistry.ReactionEffects;
|
using Content.Server.Chemistry.ReactionEffects;
|
||||||
using Content.Server.Fluids.EntitySystems;
|
using Content.Server.Fluids.EntitySystems;
|
||||||
using Content.Server.HealthExaminable;
|
using Content.Server.HealthExaminable;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Chemistry.Reaction;
|
using Content.Shared.Chemistry.Reaction;
|
||||||
@@ -27,6 +28,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||||
[Dependency] private readonly SpillableSystem _spillableSystem = default!;
|
[Dependency] private readonly SpillableSystem _spillableSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
@@ -90,7 +92,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
bloodstream.AccumulatedFrametime -= bloodstream.UpdateInterval;
|
bloodstream.AccumulatedFrametime -= bloodstream.UpdateInterval;
|
||||||
|
|
||||||
var uid = bloodstream.Owner;
|
var uid = bloodstream.Owner;
|
||||||
if (TryComp<MobStateComponent>(uid, out var state) && state.IsDead())
|
if (TryComp<MobStateComponent>(uid, out var state) && _mobStateSystem.IsDead(uid, state))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// First, let's refresh their blood if possible.
|
// First, let's refresh their blood if possible.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Linq;
|
|||||||
using Content.Server.Body.Components;
|
using Content.Server.Body.Components;
|
||||||
using Content.Server.Chemistry.Components.SolutionManager;
|
using Content.Server.Chemistry.Components.SolutionManager;
|
||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.Body.Organ;
|
using Content.Shared.Body.Organ;
|
||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
@@ -22,6 +23,7 @@ namespace Content.Server.Body.Systems
|
|||||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -159,7 +161,7 @@ namespace Content.Server.Body.Systems
|
|||||||
// still remove reagents
|
// still remove reagents
|
||||||
if (EntityManager.TryGetComponent<MobStateComponent>(solutionEntityUid.Value, out var state))
|
if (EntityManager.TryGetComponent<MobStateComponent>(solutionEntityUid.Value, out var state))
|
||||||
{
|
{
|
||||||
if (state.IsDead())
|
if (_mobStateSystem.IsDead(solutionEntityUid.Value, state))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Administration;
|
|||||||
using Content.Server.Body.Systems;
|
using Content.Server.Body.Systems;
|
||||||
using Content.Server.Cargo.Components;
|
using Content.Server.Cargo.Components;
|
||||||
using Content.Server.Chemistry.Components.SolutionManager;
|
using Content.Server.Chemistry.Components.SolutionManager;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Stack;
|
using Content.Server.Stack;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
@@ -24,6 +25,7 @@ public sealed class PricingSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IConsoleHost _consoleHost = default!;
|
[Dependency] private readonly IConsoleHost _consoleHost = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
|
||||||
[Dependency] private readonly BodySystem _bodySystem = default!;
|
[Dependency] private readonly BodySystem _bodySystem = default!;
|
||||||
@@ -98,7 +100,7 @@ public sealed class PricingSystem : EntitySystem
|
|||||||
var partRatio = totalPartsPresent / (double) totalParts;
|
var partRatio = totalPartsPresent / (double) totalParts;
|
||||||
var partPenalty = component.Price * (1 - partRatio) * component.MissingBodyPartPenalty;
|
var partPenalty = component.Price * (1 - partRatio) * component.MissingBodyPartPenalty;
|
||||||
|
|
||||||
args.Price += (component.Price - partPenalty) * (state.IsAlive() ? 1.0 : component.DeathPenalty);
|
args.Price += (component.Price - partPenalty) * (_mobStateSystem.IsAlive(uid, state) ? 1.0 : component.DeathPenalty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateStackPrice(EntityUid uid, StackPriceComponent component, ref PriceCalculationEvent args)
|
private void CalculateStackPrice(EntityUid uid, StackPriceComponent component, ref PriceCalculationEvent args)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Drone.Components;
|
|||||||
using Content.Server.Ghost.Components;
|
using Content.Server.Ghost.Components;
|
||||||
using Content.Server.Ghost.Roles.Components;
|
using Content.Server.Ghost.Roles.Components;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Server.Tools.Innate;
|
using Content.Server.Tools.Innate;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
@@ -32,6 +33,7 @@ namespace Content.Server.Drone
|
|||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly InnateToolSystem _innateToolSystem = default!;
|
[Dependency] private readonly InnateToolSystem _innateToolSystem = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -131,7 +133,7 @@ namespace Content.Server.Drone
|
|||||||
if (HasComp<MindComponent>(entity) && !HasComp<DroneComponent>(entity) && !HasComp<GhostComponent>(entity))
|
if (HasComp<MindComponent>(entity) && !HasComp<DroneComponent>(entity) && !HasComp<GhostComponent>(entity))
|
||||||
{
|
{
|
||||||
// Filter out dead ghost roles. Dead normal players are intended to block.
|
// Filter out dead ghost roles. Dead normal players are intended to block.
|
||||||
if ((TryComp<MobStateComponent>(entity, out var entityMobState) && HasComp<GhostTakeoverAvailableComponent>(entity) && entityMobState.IsDead()))
|
if ((TryComp<MobStateComponent>(entity, out var entityMobState) && HasComp<GhostTakeoverAvailableComponent>(entity) && _mobStateSystem.IsDead(entity, entityMobState)))
|
||||||
continue;
|
continue;
|
||||||
if (_gameTiming.IsFirstTimePredicted)
|
if (_gameTiming.IsFirstTimePredicted)
|
||||||
_popupSystem.PopupEntity(Loc.GetString("drone-too-close", ("being", Identity.Entity(entity, EntityManager))), uid, uid);
|
_popupSystem.PopupEntity(Loc.GetString("drone-too-close", ("being", Identity.Entity(entity, EntityManager))), uid, uid);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using Content.Server.GameTicking.Presets;
|
using Content.Server.GameTicking.Presets;
|
||||||
using Content.Server.GameTicking.Rules;
|
using Content.Server.GameTicking.Rules;
|
||||||
using Content.Server.Ghost.Components;
|
using Content.Server.Ghost.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Damage.Prototypes;
|
using Content.Shared.Damage.Prototypes;
|
||||||
@@ -15,6 +16,8 @@ namespace Content.Server.GameTicking
|
|||||||
{
|
{
|
||||||
public const float PresetFailedCooldownIncrease = 30f;
|
public const float PresetFailedCooldownIncrease = 30f;
|
||||||
|
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
|
|
||||||
public GamePresetPrototype? Preset { get; private set; }
|
public GamePresetPrototype? Preset { get; private set; }
|
||||||
|
|
||||||
private bool StartPreset(IPlayerSession[] origReadyPlayers, bool force)
|
private bool StartPreset(IPlayerSession[] origReadyPlayers, bool force)
|
||||||
@@ -180,7 +183,7 @@ namespace Content.Server.GameTicking
|
|||||||
|
|
||||||
if (canReturnGlobal && TryComp(playerEntity, out MobStateComponent? mobState))
|
if (canReturnGlobal && TryComp(playerEntity, out MobStateComponent? mobState))
|
||||||
{
|
{
|
||||||
if (mobState.IsCritical())
|
if (_mobStateSystem.IsCritical(playerEntity.Value, mobState))
|
||||||
{
|
{
|
||||||
canReturn = true;
|
canReturn = true;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.GameTicking.Rules.Configurations;
|
using Content.Server.GameTicking.Rules.Configurations;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.MobState.Components;
|
using Content.Shared.MobState.Components;
|
||||||
@@ -19,6 +20,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem
|
|||||||
|
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
|
||||||
private const float RestartDelay = 10f;
|
private const float RestartDelay = 10f;
|
||||||
@@ -106,7 +108,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem
|
|||||||
|| !TryComp(playerEntity, out MobStateComponent? state))
|
|| !TryComp(playerEntity, out MobStateComponent? state))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!state.IsAlive())
|
if (!_mobStateSystem.IsAlive(playerEntity, state))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Found a second person alive, nothing decided yet!
|
// Found a second person alive, nothing decided yet!
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.GameTicking.Rules.Configurations;
|
using Content.Server.GameTicking.Rules.Configurations;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Content.Server.Roles;
|
using Content.Server.Roles;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
@@ -44,6 +45,7 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
|
|||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly ITileDefinitionManager _tileDefMan = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDefMan = default!;
|
||||||
[Dependency] private readonly SharedDoorSystem _doorSystem = default!;
|
[Dependency] private readonly SharedDoorSystem _doorSystem = default!;
|
||||||
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
|
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
|
||||||
@@ -294,7 +296,7 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mobState.IsAlive())
|
if (!_mobStateSystem.IsAlive(playerEntity, mobState))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Atmos.EntitySystems;
|
|||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.GameTicking.Rules.Configurations;
|
using Content.Server.GameTicking.Rules.Configurations;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.PDA;
|
using Content.Server.PDA;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Content.Server.Spawners.Components;
|
using Content.Server.Spawners.Components;
|
||||||
@@ -36,6 +37,7 @@ public sealed class TraitorDeathMatchRuleSystem : GameRuleSystem
|
|||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly MaxTimeRestartRuleSystem _restarter = default!;
|
[Dependency] private readonly MaxTimeRestartRuleSystem _restarter = default!;
|
||||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||||
[Dependency] private readonly UplinkSystem _uplink = default!;
|
[Dependency] private readonly UplinkSystem _uplink = default!;
|
||||||
@@ -148,13 +150,13 @@ public sealed class TraitorDeathMatchRuleSystem : GameRuleSystem
|
|||||||
|
|
||||||
if (mind.OwnedEntity is {Valid: true} entity && TryComp(entity, out MobStateComponent? mobState))
|
if (mind.OwnedEntity is {Valid: true} entity && TryComp(entity, out MobStateComponent? mobState))
|
||||||
{
|
{
|
||||||
if (mobState.IsCritical())
|
if (_mobStateSystem.IsCritical(entity, mobState))
|
||||||
{
|
{
|
||||||
// TODO BODY SYSTEM KILL
|
// TODO BODY SYSTEM KILL
|
||||||
var damage = new DamageSpecifier(_prototypeManager.Index<DamageTypePrototype>("Asphyxiation"), 100);
|
var damage = new DamageSpecifier(_prototypeManager.Index<DamageTypePrototype>("Asphyxiation"), 100);
|
||||||
Get<DamageableSystem>().TryChangeDamage(entity, damage, true);
|
Get<DamageableSystem>().TryChangeDamage(entity, damage, true);
|
||||||
}
|
}
|
||||||
else if (!mobState.IsDead())
|
else if (!_mobStateSystem.IsDead(entity,mobState))
|
||||||
{
|
{
|
||||||
if (HasComp<HandsComponent>(entity))
|
if (HasComp<HandsComponent>(entity))
|
||||||
{
|
{
|
||||||
@@ -225,7 +227,7 @@ public sealed class TraitorDeathMatchRuleSystem : GameRuleSystem
|
|||||||
if (TryComp(avoidMeEntity.Value, out MobStateComponent? mobState))
|
if (TryComp(avoidMeEntity.Value, 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 (_mobStateSystem.IsCritical(avoidMeEntity.Value, mobState) || _mobStateSystem.IsDead(avoidMeEntity.Value, mobState))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.Interaction.Components;
|
using Content.Server.Interaction.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Bed.Sleep;
|
using Content.Shared.Bed.Sleep;
|
||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
@@ -15,6 +16,7 @@ public sealed class InteractionPopupSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -38,7 +40,7 @@ public sealed class InteractionPopupSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (TryComp<MobStateComponent>(uid, out var state) // if it has a MobStateComponent,
|
if (TryComp<MobStateComponent>(uid, out var state) // if it has a MobStateComponent,
|
||||||
&& !state.IsAlive()) // AND if that state is not Alive (e.g. dead/incapacitated/critical)
|
&& !_mobStateSystem.IsAlive(uid, state)) // AND if that state is not Alive (e.g. dead/incapacitated/critical)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: Should be an attempt event
|
// TODO: Should be an attempt event
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.DoAfter;
|
using Content.Server.DoAfter;
|
||||||
using Content.Server.Kitchen.Components;
|
using Content.Server.Kitchen.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
@@ -25,6 +26,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _logger = default!;
|
[Dependency] private readonly IAdminLogManager _logger = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -213,7 +215,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
// THE WHAT? (again)
|
// THE WHAT? (again)
|
||||||
// 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 (Resolve(victimUid, ref mobState, false) &&
|
if (Resolve(victimUid, ref mobState, false) &&
|
||||||
!mobState.IsDead())
|
_mobStateSystem.IsAlive(victimUid, mobState))
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", Identity.Entity(victimUid, EntityManager))),
|
_popupSystem.PopupEntity(Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", Identity.Entity(victimUid, EntityManager))),
|
||||||
victimUid, userUid);
|
victimUid, userUid);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Content.Shared.MobState.Components;
|
|||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Content.Server.MobState;
|
||||||
|
|
||||||
namespace Content.Server.Medical
|
namespace Content.Server.Medical
|
||||||
{
|
{
|
||||||
@@ -18,6 +19,7 @@ namespace Content.Server.Medical
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -135,7 +137,7 @@ namespace Content.Server.Medical
|
|||||||
public void ExamineWithStethoscope(EntityUid user, EntityUid target)
|
public void ExamineWithStethoscope(EntityUid user, EntityUid target)
|
||||||
{
|
{
|
||||||
/// The mob check seems a bit redundant but (1) they could conceivably have lost it since when the doafter started and (2) I need it for .IsDead()
|
/// The mob check seems a bit redundant but (1) they could conceivably have lost it since when the doafter started and (2) I need it for .IsDead()
|
||||||
if (!HasComp<RespiratorComponent>(target) || !TryComp<MobStateComponent>(target, out var mobState) || mobState.IsDead())
|
if (!HasComp<RespiratorComponent>(target) || !TryComp<MobStateComponent>(target, out var mobState) || _mobStateSystem.IsDead(target, mobState))
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("stethoscope-dead"), target, user);
|
_popupSystem.PopupEntity(Loc.GetString("stethoscope-dead"), target, user);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Server.Access.Systems;
|
|||||||
using Content.Server.DeviceNetwork;
|
using Content.Server.DeviceNetwork;
|
||||||
using Content.Server.DeviceNetwork.Components;
|
using Content.Server.DeviceNetwork.Components;
|
||||||
using Content.Server.DeviceNetwork.Systems;
|
using Content.Server.DeviceNetwork.Systems;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
@@ -22,6 +23,7 @@ namespace Content.Server.Medical.SuitSensors
|
|||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly IdCardSystem _idCardSystem = default!;
|
[Dependency] private readonly IdCardSystem _idCardSystem = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly DeviceNetworkSystem _deviceNetworkSystem = default!;
|
[Dependency] private readonly DeviceNetworkSystem _deviceNetworkSystem = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
@@ -244,7 +246,7 @@ namespace Content.Server.Medical.SuitSensors
|
|||||||
var isAlive = false;
|
var isAlive = false;
|
||||||
if (EntityManager.TryGetComponent(sensor.User.Value, out MobStateComponent? mobState))
|
if (EntityManager.TryGetComponent(sensor.User.Value, out MobStateComponent? mobState))
|
||||||
{
|
{
|
||||||
isAlive = mobState.IsAlive();
|
isAlive = _mobStateSystem.IsAlive(sensor.User.Value, mobState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get mob total damage
|
// get mob total damage
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Ghost.Components;
|
using Content.Server.Ghost.Components;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Objectives;
|
using Content.Server.Objectives;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Content.Server.Roles;
|
using Content.Server.Roles;
|
||||||
@@ -26,6 +27,12 @@ namespace Content.Server.Mind
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public sealed class Mind
|
public sealed class Mind
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
[Dependency] private readonly GameTicker _gameTickerSystem = default!;
|
||||||
|
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||||
|
|
||||||
private readonly ISet<Role> _roles = new HashSet<Role>();
|
private readonly ISet<Role> _roles = new HashSet<Role>();
|
||||||
|
|
||||||
private readonly List<Objective> _objectives = new();
|
private readonly List<Objective> _objectives = new();
|
||||||
@@ -41,6 +48,7 @@ namespace Content.Server.Mind
|
|||||||
public Mind(NetUserId userId)
|
public Mind(NetUserId userId)
|
||||||
{
|
{
|
||||||
OriginalOwnerUserId = userId;
|
OriginalOwnerUserId = userId;
|
||||||
|
IoCManager.InjectDependencies(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This session should be able to be changed, probably.
|
// TODO: This session should be able to be changed, probably.
|
||||||
@@ -114,8 +122,7 @@ namespace Content.Server.Mind
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var playerMgr = IoCManager.Resolve<IPlayerManager>();
|
_playerManager.TryGetSessionById(UserId.Value, out var ret);
|
||||||
playerMgr.TryGetSessionById(UserId.Value, out var ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,13 +157,13 @@ namespace Content.Server.Mind
|
|||||||
// (If being a borg or AI counts as dead, then this is highly likely, as it's still the same Mind for practical purposes.)
|
// (If being a borg or AI counts as dead, then this is highly likely, as it's still the same Mind for practical purposes.)
|
||||||
|
|
||||||
// This can be null if they're deleted (spike / brain nom)
|
// This can be null if they're deleted (spike / brain nom)
|
||||||
var targetMobState = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<MobStateComponent>(OwnedEntity);
|
var targetMobState = _entityManager.GetComponentOrNull<MobStateComponent>(OwnedEntity);
|
||||||
// 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)
|
||||||
return true;
|
return true;
|
||||||
// They might actually be alive.
|
// They might actually be alive.
|
||||||
return targetMobState.IsDead();
|
return _mobStateSystem.IsDead(OwnedEntity!.Value, targetMobState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +188,7 @@ namespace Content.Server.Mind
|
|||||||
var message = new RoleAddedEvent(this, role);
|
var message = new RoleAddedEvent(this, role);
|
||||||
if (OwnedEntity != null)
|
if (OwnedEntity != null)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnedEntity.Value, message, true);
|
_entityManager.EventBus.RaiseLocalEvent(OwnedEntity.Value, message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return role;
|
return role;
|
||||||
@@ -207,7 +214,7 @@ namespace Content.Server.Mind
|
|||||||
|
|
||||||
if (OwnedEntity != null)
|
if (OwnedEntity != null)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnedEntity.Value, message, true);
|
_entityManager.EventBus.RaiseLocalEvent(OwnedEntity.Value, message, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,23 +279,21 @@ namespace Content.Server.Mind
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
|
||||||
|
|
||||||
MindComponent? component = null;
|
MindComponent? component = null;
|
||||||
var alreadyAttached = false;
|
var alreadyAttached = false;
|
||||||
|
|
||||||
if (entity != null)
|
if (entity != null)
|
||||||
{
|
{
|
||||||
if (!entMan.TryGetComponent(entity.Value, out component))
|
if (!_entityManager.TryGetComponent(entity.Value, out component))
|
||||||
{
|
{
|
||||||
component = entMan.AddComponent<MindComponent>(entity.Value);
|
component = _entityManager.AddComponent<MindComponent>(entity.Value);
|
||||||
}
|
}
|
||||||
else if (component!.HasMind)
|
else if (component!.HasMind)
|
||||||
{
|
{
|
||||||
EntitySystem.Get<GameTicker>().OnGhostAttempt(component.Mind!, false);
|
_gameTickerSystem.OnGhostAttempt(component.Mind!, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entMan.TryGetComponent<ActorComponent>(entity.Value, out var actor))
|
if (_entityManager.TryGetComponent<ActorComponent>(entity.Value, out var actor))
|
||||||
{
|
{
|
||||||
// Happens when transferring to your currently visited entity.
|
// Happens when transferring to your currently visited entity.
|
||||||
if (actor.PlayerSession != Session)
|
if (actor.PlayerSession != Session)
|
||||||
@@ -300,14 +305,12 @@ namespace Content.Server.Mind
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var mindSystem = EntitySystem.Get<MindSystem>();
|
|
||||||
|
|
||||||
if(OwnedComponent != null)
|
if(OwnedComponent != null)
|
||||||
mindSystem.InternalEjectMind(OwnedComponent.Owner, OwnedComponent);
|
_mindSystem.InternalEjectMind(OwnedComponent.Owner, OwnedComponent);
|
||||||
|
|
||||||
OwnedComponent = component;
|
OwnedComponent = component;
|
||||||
if(OwnedComponent != null)
|
if(OwnedComponent != null)
|
||||||
mindSystem.InternalAssignMind(OwnedComponent.Owner, this, OwnedComponent);
|
_mindSystem.InternalAssignMind(OwnedComponent.Owner, this, OwnedComponent);
|
||||||
|
|
||||||
// Don't do the full deletion cleanup if we're transferring to our visitingentity
|
// Don't do the full deletion cleanup if we're transferring to our visitingentity
|
||||||
if (alreadyAttached)
|
if (alreadyAttached)
|
||||||
@@ -315,11 +318,11 @@ namespace Content.Server.Mind
|
|||||||
// Set VisitingEntity null first so the removal of VisitingMind doesn't get through Unvisit() and delete what we're visiting.
|
// Set VisitingEntity null first so the removal of VisitingMind doesn't get through Unvisit() and delete what we're visiting.
|
||||||
// Yes this control flow sucks.
|
// Yes this control flow sucks.
|
||||||
VisitingEntity = null;
|
VisitingEntity = null;
|
||||||
IoCManager.Resolve<IEntityManager>().RemoveComponent<VisitingMindComponent>(entity!.Value);
|
_entityManager.RemoveComponent<VisitingMindComponent>(entity!.Value);
|
||||||
}
|
}
|
||||||
else if (VisitingEntity != null
|
else if (VisitingEntity != null
|
||||||
&& (ghostCheckOverride // to force mind transfer, for example from ControlMobVerb
|
&& (ghostCheckOverride // to force mind transfer, for example from ControlMobVerb
|
||||||
|| !entMan.TryGetComponent(VisitingEntity!, out GhostComponent? ghostComponent) // visiting entity is not a Ghost
|
|| !_entityManager.TryGetComponent(VisitingEntity!, out GhostComponent? ghostComponent) // visiting entity is not a Ghost
|
||||||
|| !ghostComponent.CanReturnToBody)) // it is a ghost, but cannot return to body anyway, so it's okay
|
|| !ghostComponent.CanReturnToBody)) // it is a ghost, but cannot return to body anyway, so it's okay
|
||||||
{
|
{
|
||||||
RemoveVisitingEntity();
|
RemoveVisitingEntity();
|
||||||
@@ -380,7 +383,7 @@ namespace Content.Server.Mind
|
|||||||
Session?.AttachToEntity(entity);
|
Session?.AttachToEntity(entity);
|
||||||
VisitingEntity = entity;
|
VisitingEntity = entity;
|
||||||
|
|
||||||
var comp = IoCManager.Resolve<IEntityManager>().AddComponent<VisitingMindComponent>(entity);
|
var comp = _entityManager.AddComponent<VisitingMindComponent>(entity);
|
||||||
comp.Mind = this;
|
comp.Mind = this;
|
||||||
|
|
||||||
Logger.Info($"Session {Session?.Name} visiting entity {entity}.");
|
Logger.Info($"Session {Session?.Name} visiting entity {entity}.");
|
||||||
@@ -408,10 +411,8 @@ namespace Content.Server.Mind
|
|||||||
VisitingEntity = null;
|
VisitingEntity = null;
|
||||||
|
|
||||||
DebugTools.AssertNotNull(oldVisitingEnt);
|
DebugTools.AssertNotNull(oldVisitingEnt);
|
||||||
|
_entityManager.RemoveComponent<VisitingMindComponent>(oldVisitingEnt);
|
||||||
var entities = IoCManager.Resolve<IEntityManager>();
|
_entityManager.EventBus.RaiseLocalEvent(oldVisitingEnt, new MindUnvisitedMessage(), true);
|
||||||
entities.RemoveComponent<VisitingMindComponent>(oldVisitingEnt);
|
|
||||||
entities.EventBus.RaiseLocalEvent(oldVisitingEnt, new MindUnvisitedMessage(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetSession([NotNullWhen(true)] out IPlayerSession? session)
|
public bool TryGetSession([NotNullWhen(true)] out IPlayerSession? session)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Server.GameTicking;
|
|||||||
using Content.Server.Ghost;
|
using Content.Server.Ghost;
|
||||||
using Content.Server.Ghost.Components;
|
using Content.Server.Ghost.Components;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.MobState.Components;
|
using Content.Shared.MobState.Components;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -13,6 +14,7 @@ public sealed class MindSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly GhostSystem _ghostSystem = default!;
|
[Dependency] private readonly GhostSystem _ghostSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -131,7 +133,7 @@ public sealed class MindSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dead = TryComp<MobStateComponent?>(uid, out var state) && state.IsDead();
|
var dead = TryComp<MobStateComponent?>(uid, out var state) && _mobStateSystem.IsDead(uid, state);
|
||||||
|
|
||||||
if (dead)
|
if (dead)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.Chemistry.Components.SolutionManager;
|
|||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.DoAfter;
|
using Content.Server.DoAfter;
|
||||||
using Content.Server.Fluids.EntitySystems;
|
using Content.Server.Fluids.EntitySystems;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
@@ -40,6 +41,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
[Dependency] private readonly StomachSystem _stomachSystem = default!;
|
[Dependency] private readonly StomachSystem _stomachSystem = default!;
|
||||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly SpillableSystem _spillableSystem = default!;
|
[Dependency] private readonly SpillableSystem _spillableSystem = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
|
|
||||||
@@ -395,7 +397,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
!_bodySystem.TryGetBodyOrganComponents<StomachComponent>(ev.User, out var stomachs, body))
|
!_bodySystem.TryGetBodyOrganComponents<StomachComponent>(ev.User, out var stomachs, body))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) && mobState.IsAlive())
|
if (EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) && _mobStateSystem.IsAlive(uid, mobState))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AlternativeVerb verb = new()
|
AlternativeVerb verb = new()
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.Body.Systems;
|
|||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Server.Chemistry.EntitySystems;
|
||||||
using Content.Server.DoAfter;
|
using Content.Server.DoAfter;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
@@ -34,6 +35,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
[Dependency] private readonly BodySystem _bodySystem = default!;
|
[Dependency] private readonly BodySystem _bodySystem = default!;
|
||||||
[Dependency] private readonly StomachSystem _stomachSystem = default!;
|
[Dependency] private readonly StomachSystem _stomachSystem = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly UtensilSystem _utensilSystem = default!;
|
[Dependency] private readonly UtensilSystem _utensilSystem = default!;
|
||||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||||
@@ -84,7 +86,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (food.Owner == user || //Suppresses self-eating
|
if (food.Owner == user || //Suppresses self-eating
|
||||||
EntityManager.TryGetComponent<MobStateComponent>(food.Owner, out var mobState) && mobState.IsAlive()) // Suppresses eating alive mobs
|
EntityManager.TryGetComponent<MobStateComponent>(food.Owner, out var mobState) && _mobStateSystem.IsAlive(food.Owner, mobState)) // Suppresses eating alive mobs
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Target can't be fed
|
// Target can't be fed
|
||||||
@@ -258,7 +260,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
!_bodySystem.TryGetBodyOrganComponents<StomachComponent>(ev.User, out var stomachs, body))
|
!_bodySystem.TryGetBodyOrganComponents<StomachComponent>(ev.User, out var stomachs, body))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) && mobState.IsAlive())
|
if (EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) && _mobStateSystem.IsAlive(uid, mobState))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AlternativeVerb verb = new()
|
AlternativeVerb verb = new()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Objectives.Interfaces;
|
using Content.Server.Objectives.Interfaces;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
@@ -5,6 +6,8 @@ namespace Content.Server.Objectives.Conditions
|
|||||||
{
|
{
|
||||||
public abstract class KillPersonCondition : IObjectiveCondition
|
public abstract class KillPersonCondition : IObjectiveCondition
|
||||||
{
|
{
|
||||||
|
protected IEntityManager EntityManager => IoCManager.Resolve<IEntityManager>();
|
||||||
|
protected MobStateSystem MobStateSystem => IoCManager.Resolve<MobStateSystem>();
|
||||||
protected Mind.Mind? Target;
|
protected Mind.Mind? Target;
|
||||||
public abstract IObjectiveCondition GetAssigned(Mind.Mind mind);
|
public abstract IObjectiveCondition GetAssigned(Mind.Mind mind);
|
||||||
|
|
||||||
@@ -19,7 +22,7 @@ namespace Content.Server.Objectives.Conditions
|
|||||||
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
|
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
|
||||||
|
|
||||||
if (Target.OwnedEntity is {Valid: true} owned)
|
if (Target.OwnedEntity is {Valid: true} owned)
|
||||||
targetName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(owned).EntityName;
|
targetName = EntityManager.GetComponent<MetaDataComponent>(owned).EntityName;
|
||||||
|
|
||||||
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
|
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,16 +13,15 @@ namespace Content.Server.Objectives.Conditions
|
|||||||
{
|
{
|
||||||
public override IObjectiveCondition GetAssigned(Mind.Mind mind)
|
public override IObjectiveCondition GetAssigned(Mind.Mind mind)
|
||||||
{
|
{
|
||||||
var entityMgr = IoCManager.Resolve<IEntityManager>();
|
var allHumans = EntityManager.EntityQuery<MindComponent>(true).Where(mc =>
|
||||||
var allHumans = entityMgr.EntityQuery<MindComponent>(true).Where(mc =>
|
|
||||||
{
|
{
|
||||||
var entity = mc.Mind?.OwnedEntity;
|
var entity = mc.Mind?.OwnedEntity;
|
||||||
|
|
||||||
if (entity == default)
|
if (entity == default)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return entityMgr.TryGetComponent(entity, out MobStateComponent? mobState) &&
|
return EntityManager.TryGetComponent(entity, out MobStateComponent? mobState) &&
|
||||||
mobState.IsAlive() &&
|
MobStateSystem.IsAlive(entity.Value, mobState) &&
|
||||||
mc.Mind != mind;
|
mc.Mind != mind;
|
||||||
}).Select(mc => mc.Mind).ToList();
|
}).Select(mc => mc.Mind).ToList();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Actions;
|
using Content.Server.Actions;
|
||||||
using Content.Server.Inventory;
|
using Content.Server.Inventory;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Polymorph.Components;
|
using Content.Server.Polymorph.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
@@ -25,6 +26,7 @@ namespace Content.Server.Polymorph.Systems
|
|||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly ServerInventorySystem _inventory = default!;
|
[Dependency] private readonly ServerInventorySystem _inventory = default!;
|
||||||
[Dependency] private readonly SharedHandsSystem _sharedHands = default!;
|
[Dependency] private readonly SharedHandsSystem _sharedHands = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly ContainerSystem _container = default!;
|
[Dependency] private readonly ContainerSystem _container = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -157,8 +159,8 @@ namespace Content.Server.Polymorph.Systems
|
|||||||
if (!TryComp<MobStateComponent>(comp.Owner, out var mob))
|
if (!TryComp<MobStateComponent>(comp.Owner, out var mob))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((proto.RevertOnDeath && mob.IsDead()) ||
|
if ((proto.RevertOnDeath && _mobStateSystem.IsDead(comp.Owner, mob)) ||
|
||||||
(proto.RevertOnCrit && mob.IsCritical()))
|
(proto.RevertOnCrit && _mobStateSystem.IsCritical(comp.Owner, mob)))
|
||||||
Revert(comp.Owner);
|
Revert(comp.Owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Disease;
|
using Content.Server.Disease;
|
||||||
using Content.Server.Disease.Components;
|
using Content.Server.Disease.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Station.Systems;
|
using Content.Server.Station.Systems;
|
||||||
using Content.Shared.Disease;
|
using Content.Shared.Disease;
|
||||||
using Content.Shared.MobState.Components;
|
using Content.Shared.MobState.Components;
|
||||||
@@ -13,6 +14,7 @@ namespace Content.Server.StationEvents.Events;
|
|||||||
public sealed class DiseaseOutbreak : StationEventSystem
|
public sealed class DiseaseOutbreak : StationEventSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly DiseaseSystem _diseaseSystem = default!;
|
[Dependency] private readonly DiseaseSystem _diseaseSystem = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
|
|
||||||
public override string Prototype => "DiseaseOutbreak";
|
public override string Prototype => "DiseaseOutbreak";
|
||||||
|
|
||||||
@@ -42,7 +44,7 @@ public sealed class DiseaseOutbreak : StationEventSystem
|
|||||||
List<DiseaseCarrierComponent> aliveList = new();
|
List<DiseaseCarrierComponent> aliveList = new();
|
||||||
foreach (var (carrier, mobState) in EntityManager.EntityQuery<DiseaseCarrierComponent, MobStateComponent>())
|
foreach (var (carrier, mobState) in EntityManager.EntityQuery<DiseaseCarrierComponent, MobStateComponent>())
|
||||||
{
|
{
|
||||||
if (!mobState.IsDead())
|
if (!_mobStateSystem.IsDead(mobState.Owner, mobState))
|
||||||
aliveList.Add(carrier);
|
aliveList.Add(carrier);
|
||||||
}
|
}
|
||||||
RobustRandom.Shuffle(aliveList);
|
RobustRandom.Shuffle(aliveList);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.GameTicking.Rules;
|
using Content.Server.GameTicking.Rules;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
|
using Content.Server.MobState;
|
||||||
using Content.Server.Roles;
|
using Content.Server.Roles;
|
||||||
using Content.Server.Suspicion.Roles;
|
using Content.Server.Suspicion.Roles;
|
||||||
using Content.Shared.MobState.Components;
|
using Content.Shared.MobState.Components;
|
||||||
@@ -12,6 +13,7 @@ namespace Content.Server.Suspicion
|
|||||||
public sealed class SuspicionRoleComponent : SharedSuspicionRoleComponent
|
public sealed class SuspicionRoleComponent : SharedSuspicionRoleComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
|
|
||||||
private Role? _role;
|
private Role? _role;
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
@@ -52,7 +54,7 @@ namespace Content.Server.Suspicion
|
|||||||
public bool IsDead()
|
public bool IsDead()
|
||||||
{
|
{
|
||||||
return _entMan.TryGetComponent(Owner, out MobStateComponent? state) &&
|
return _entMan.TryGetComponent(Owner, out MobStateComponent? state) &&
|
||||||
state.IsDead();
|
_mobStateSystem.IsDead(Owner, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInnocent()
|
public bool IsInnocent()
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace Content.Shared.MobState.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[NetworkedComponent]
|
[NetworkedComponent]
|
||||||
|
[Access(typeof(SharedMobStateSystem))]
|
||||||
public sealed class MobStateComponent : Component
|
public sealed class MobStateComponent : Component
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -34,33 +35,5 @@ namespace Content.Shared.MobState.Components
|
|||||||
public FixedPoint2? CurrentThreshold { get; set; }
|
public FixedPoint2? CurrentThreshold { get; set; }
|
||||||
|
|
||||||
public IEnumerable<KeyValuePair<int, DamageState>> _highestToLowestStates => _lowestToHighestStates.Reverse();
|
public IEnumerable<KeyValuePair<int, DamageState>> _highestToLowestStates => _lowestToHighestStates.Reverse();
|
||||||
|
|
||||||
[Obsolete("Use MobStateSystem")]
|
|
||||||
public bool IsAlive()
|
|
||||||
{
|
|
||||||
return IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SharedMobStateSystem>()
|
|
||||||
.IsAlive(Owner, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("Use MobStateSystem")]
|
|
||||||
public bool IsCritical()
|
|
||||||
{
|
|
||||||
return IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SharedMobStateSystem>()
|
|
||||||
.IsCritical(Owner, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("Use MobStateSystem")]
|
|
||||||
public bool IsDead()
|
|
||||||
{
|
|
||||||
return IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SharedMobStateSystem>()
|
|
||||||
.IsDead(Owner, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("Use MobStateSystem")]
|
|
||||||
public bool IsIncapacitated()
|
|
||||||
{
|
|
||||||
return IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SharedMobStateSystem>()
|
|
||||||
.IsIncapacitated(Owner, this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user