Inline HasComponent entirely
This commit is contained in:
@@ -113,7 +113,7 @@ namespace Content.Client.CharacterAppearance.Systems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args.Args.Part.Owner.HasComponent<SpriteComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SpriteComponent>(args.Args.Part.Owner.Uid))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ namespace Content.Client.CharacterAppearance.Systems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args.Args.Part.Owner.HasComponent<SpriteComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SpriteComponent>(args.Args.Part.Owner.Uid))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ namespace Content.Client.Chat.Managers
|
|||||||
ChatPermissionsUpdated?.Invoke(new ChatPermissionsUpdatedEventArgs {OldSelectableChannels = oldSelectable});
|
ChatPermissionsUpdated?.Invoke(new ChatPermissionsUpdatedEventArgs {OldSelectableChannels = oldSelectable});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsGhost => _playerManager.LocalPlayer?.ControlledEntity?.HasComponent<GhostComponent>() ?? false;
|
public bool IsGhost => _playerManager.LocalPlayer?.ControlledEntityUid is {} uid && _entityManager.HasComponent<GhostComponent>(uid);
|
||||||
|
|
||||||
public void FrameUpdate(FrameEventArgs delta)
|
public void FrameUpdate(FrameEventArgs delta)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ namespace Content.Client.Damage
|
|||||||
{
|
{
|
||||||
if (!entity.TryGetComponent<SpriteComponent>(out SpriteComponent? spriteComponent)
|
if (!entity.TryGetComponent<SpriteComponent>(out SpriteComponent? spriteComponent)
|
||||||
|| !entity.TryGetComponent<DamageableComponent>(out var damageComponent)
|
|| !entity.TryGetComponent<DamageableComponent>(out var damageComponent)
|
||||||
|| !entity.HasComponent<AppearanceComponent>())
|
|| !IoCManager.Resolve<IEntityManager>().HasComponent<AppearanceComponent>(entity.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_thresholds.Add(FixedPoint2.Zero);
|
_thresholds.Add(FixedPoint2.Zero);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Content.Client.Disposal.Visualizers
|
|||||||
{
|
{
|
||||||
appearance.Owner.EnsureComponent<SubFloorHideComponent>();
|
appearance.Owner.EnsureComponent<SubFloorHideComponent>();
|
||||||
}
|
}
|
||||||
else if (appearance.Owner.HasComponent<SubFloorHideComponent>())
|
else if (IoCManager.Resolve<IEntityManager>().HasComponent<SubFloorHideComponent>(appearance.Owner.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().RemoveComponent<SubFloorHideComponent>(appearance.Owner.Uid);
|
IoCManager.Resolve<IEntityManager>().RemoveComponent<SubFloorHideComponent>(appearance.Owner.Uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace Content.Client.Doors
|
|||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
if (!entity.HasComponent<AnimationPlayerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace Content.Client.Hands
|
|||||||
|
|
||||||
// Show blocked overlay if hand is blocked.
|
// Show blocked overlay if hand is blocked.
|
||||||
newButton.Blocked.Visible =
|
newButton.Blocked.Visible =
|
||||||
hand.HeldItem != null && hand.HeldItem.HasComponent<HandVirtualItemComponent>();
|
hand.HeldItem != null && IoCManager.Resolve<IEntityManager>().HasComponent<HandVirtualItemComponent>(hand.HeldItem.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TryGetActiveHand(out var activeHand))
|
if (TryGetActiveHand(out var activeHand))
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Client.Hands
|
|||||||
var sys = EntitySystem.Get<HandsSystem>();
|
var sys = EntitySystem.Get<HandsSystem>();
|
||||||
var handEntity = sys.GetActiveHandEntity();
|
var handEntity = sys.GetActiveHandEntity();
|
||||||
|
|
||||||
if (handEntity == null || !_cfg.GetCVar(CCVars.HudHeldItemShow) || !handEntity.HasComponent<ISpriteComponent>())
|
if (handEntity == null || !_cfg.GetCVar(CCVars.HudHeldItemShow) || !IoCManager.Resolve<IEntityManager>().HasComponent<ISpriteComponent>(handEntity.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var screen = args.ScreenHandle;
|
var screen = args.ScreenHandle;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Content.Client.Items.Managers
|
|||||||
|
|
||||||
button.ClearHover();
|
button.ClearHover();
|
||||||
button.SpriteView.Sprite = sprite;
|
button.SpriteView.Sprite = sprite;
|
||||||
button.StorageButton.Visible = entity.HasComponent<ClientStorageComponent>();
|
button.StorageButton.Visible = IoCManager.Resolve<IEntityManager>().HasComponent<ClientStorageComponent>(entity.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
button.Entity = entity?.Uid ?? default;
|
button.Entity = entity?.Uid ?? default;
|
||||||
@@ -132,7 +132,7 @@ namespace Content.Client.Items.Managers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity.HasComponent<SpriteComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SpriteComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Client.Lathe.Visualizers
|
|||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
if (!entity.HasComponent<AnimationPlayerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Client.Lathe.Visualizers
|
|||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
if (!entity.HasComponent<AnimationPlayerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Content.Client.Physics.Controllers
|
|||||||
var pulling = pullerComp.Pulling;
|
var pulling = pullerComp.Pulling;
|
||||||
|
|
||||||
if (pulling != null &&
|
if (pulling != null &&
|
||||||
pulling.HasComponent<MobStateComponent>() &&
|
IoCManager.Resolve<IEntityManager>().HasComponent<MobStateComponent>(pulling.Uid) &&
|
||||||
pulling.TryGetComponent(out PhysicsComponent? pullingBody))
|
pulling.TryGetComponent(out PhysicsComponent? pullingBody))
|
||||||
{
|
{
|
||||||
pullingBody.Predict = false;
|
pullingBody.Predict = false;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Client.Singularity.Visualizers
|
|||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
if (!entity.HasComponent<AnimationPlayerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Content.Client.Trigger
|
|||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
if (!entity.HasComponent<AnimationPlayerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace Content.Client.VendingMachines.UI
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
if (!entity.HasComponent<AnimationPlayerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ namespace Content.IntegrationTests.Tests.Body
|
|||||||
var coordinates = new EntityCoordinates(grid.GridEntityId, center);
|
var coordinates = new EntityCoordinates(grid.GridEntityId, center);
|
||||||
human = entityManager.SpawnEntity("HumanBodyAndBloodstreamDummy", coordinates);
|
human = entityManager.SpawnEntity("HumanBodyAndBloodstreamDummy", coordinates);
|
||||||
|
|
||||||
Assert.True(human.HasComponent<SharedBodyComponent>());
|
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(human.Uid));
|
||||||
Assert.True(human.TryGetComponent(out respirator));
|
Assert.True(human.TryGetComponent(out respirator));
|
||||||
Assert.False(respirator.Suffocating);
|
Assert.False(respirator.Suffocating);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
|
|
||||||
// Component sanity check
|
// Component sanity check
|
||||||
Assert.True(human.TryGetComponent(out buckle));
|
Assert.True(human.TryGetComponent(out buckle));
|
||||||
Assert.True(chair.HasComponent<StrapComponent>());
|
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<StrapComponent>(chair.Uid));
|
||||||
Assert.True(human.TryGetComponent(out hands));
|
Assert.True(human.TryGetComponent(out hands));
|
||||||
Assert.True(human.TryGetComponent(out body));
|
Assert.True(human.TryGetComponent(out body));
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
|
|
||||||
// Component sanity check
|
// Component sanity check
|
||||||
Assert.True(human.TryGetComponent(out buckle));
|
Assert.True(human.TryGetComponent(out buckle));
|
||||||
Assert.True(chair.HasComponent<StrapComponent>());
|
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<StrapComponent>(chair.Uid));
|
||||||
|
|
||||||
// Buckle
|
// Buckle
|
||||||
Assert.True(buckle.TryBuckle(human, chair));
|
Assert.True(buckle.TryBuckle(human, chair));
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Server.Power.Components;
|
|||||||
using Content.Shared.Disposal;
|
using Content.Shared.Disposal;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Reflection;
|
using Robust.Shared.Reflection;
|
||||||
|
|
||||||
@@ -146,7 +147,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
|||||||
|
|
||||||
// Test for components existing
|
// Test for components existing
|
||||||
Assert.True(disposalUnit.TryGetComponent(out unit!));
|
Assert.True(disposalUnit.TryGetComponent(out unit!));
|
||||||
Assert.True(disposalTrunk.HasComponent<DisposalEntryComponent>());
|
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<DisposalEntryComponent>(disposalTrunk.Uid));
|
||||||
|
|
||||||
// Can't insert, unanchored and unpowered
|
// Can't insert, unanchored and unpowered
|
||||||
unit.Owner.Transform.Anchored = false;
|
unit.Owner.Transform.Anchored = false;
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
generator = entityMan.SpawnEntity("GravityGeneratorDummy", grid2.ToCoordinates());
|
generator = entityMan.SpawnEntity("GravityGeneratorDummy", grid2.ToCoordinates());
|
||||||
Assert.That(generator.HasComponent<GravityGeneratorComponent>());
|
Assert.That(IoCManager.Resolve<IEntityManager>().HasComponent<GravityGeneratorComponent>(generator.Uid));
|
||||||
Assert.That(generator.HasComponent<ApcPowerReceiverComponent>());
|
Assert.That(IoCManager.Resolve<IEntityManager>().HasComponent<ApcPowerReceiverComponent>(generator.Uid));
|
||||||
|
|
||||||
var powerComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(generator.Uid);
|
var powerComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(generator.Uid);
|
||||||
powerComponent.NeedsPower = false;
|
powerComponent.NeedsPower = false;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace Content.IntegrationTests.Tests.PDA
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Owner.HasComponent<PDAComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<PDAComponent>(item.Owner.Uid))
|
||||||
{
|
{
|
||||||
inventory.ForceUnequip(slot);
|
inventory.ForceUnequip(slot);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ namespace Content.Server.AI.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ent.HasComponent<AiControllerComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<AiControllerComponent>(ent.Uid))
|
||||||
{
|
{
|
||||||
shell.WriteLine("Entity already has an AI component.");
|
shell.WriteLine("Entity already has an AI component.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: IMover refffaaccctttooorrr
|
// TODO: IMover refffaaccctttooorrr
|
||||||
if (ent.HasComponent<IMoverComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<IMoverComponent>(ent.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().RemoveComponent<IMoverComponent>(ent.Uid);
|
IoCManager.Resolve<IEntityManager>().RemoveComponent<IMoverComponent>(ent.Uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace Content.Server.AI.EntitySystems
|
|||||||
|
|
||||||
private void MobStateChanged(MobStateChangedMessage message)
|
private void MobStateChanged(MobStateChangedMessage message)
|
||||||
{
|
{
|
||||||
if (!message.Entity.HasComponent<AiControllerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AiControllerComponent>(message.Entity.Uid))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ using Content.Server.AI.WorldState.States;
|
|||||||
using Content.Server.AI.WorldState.States.Utility;
|
using Content.Server.AI.WorldState.States.Utility;
|
||||||
using Content.Server.CPUJob.JobQueues;
|
using Content.Server.CPUJob.JobQueues;
|
||||||
using Content.Shared.AI;
|
using Content.Shared.AI;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.AI.LoadBalancer
|
namespace Content.Server.AI.LoadBalancer
|
||||||
@@ -37,7 +39,7 @@ namespace Content.Server.AI.LoadBalancer
|
|||||||
|
|
||||||
var entity = _request.Context.GetState<SelfState>().GetValue();
|
var entity = _request.Context.GetState<SelfState>().GetValue();
|
||||||
|
|
||||||
if (entity == null || !entity.HasComponent<AiControllerComponent>())
|
if (entity == null || !IoCManager.Resolve<IEntityManager>().HasComponent<AiControllerComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Content.Server.AI.Operators.Inventory
|
|||||||
public override Outcome Execute(float frameTime)
|
public override Outcome Execute(float frameTime)
|
||||||
{
|
{
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(_target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(_target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(_target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(_target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||||
!_target.HasComponent<ItemComponent>() ||
|
!IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(_target.Uid) ||
|
||||||
_target.IsInContainer() ||
|
_target.IsInContainer() ||
|
||||||
!_owner.InRangeUnobstructed(_target, popup: true))
|
!_owner.InRangeUnobstructed(_target, popup: true))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using Content.Server.Access.Components;
|
using Content.Server.Access.Components;
|
||||||
using Content.Server.Doors.Components;
|
using Content.Server.Doors.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
@@ -260,7 +261,7 @@ namespace Content.Server.AI.Pathfinding
|
|||||||
public void AddEntity(IEntity entity, IPhysBody physicsComponent)
|
public void AddEntity(IEntity entity, IPhysBody physicsComponent)
|
||||||
{
|
{
|
||||||
// If we're a door
|
// If we're a door
|
||||||
if (entity.HasComponent<AirlockComponent>() || entity.HasComponent<ServerDoorComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<AirlockComponent>(entity.Uid) || IoCManager.Resolve<IEntityManager>().HasComponent<ServerDoorComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
// If we need access to traverse this then add to readers, otherwise no point adding it (except for maybe tile costs in future)
|
// If we need access to traverse this then add to readers, otherwise no point adding it (except for maybe tile costs in future)
|
||||||
// TODO: Check for powered I think (also need an event for when it's depowered
|
// TODO: Check for powered I think (also need an event for when it's depowered
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Content.Server.AI.WorldState;
|
using Content.Server.AI.WorldState;
|
||||||
using Content.Server.AI.WorldState.States;
|
using Content.Server.AI.WorldState.States;
|
||||||
using Content.Server.Weapon.Melee.Components;
|
using Content.Server.Weapon.Melee.Components;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.Considerations.Combat.Melee
|
namespace Content.Server.AI.Utility.Considerations.Combat.Melee
|
||||||
{
|
{
|
||||||
@@ -8,7 +10,13 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee
|
|||||||
{
|
{
|
||||||
protected override float GetScore(Blackboard context)
|
protected override float GetScore(Blackboard context)
|
||||||
{
|
{
|
||||||
return context.GetState<SelfState>().GetValue()?.HasComponent<UnarmedCombatComponent>() ?? false ? 1.0f : 0.0f;
|
IEntity tempQualifier = context.GetState<SelfState>().GetValue();
|
||||||
|
if (tempQualifier != null)
|
||||||
|
{
|
||||||
|
IoCManager.Resolve<IEntityManager>().HasComponent<UnarmedCombatComponent>(tempQualifier.Uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return RETURNED_VALUE ?? false ? 1.0f : 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Content.Server.AI.WorldState;
|
using Content.Server.AI.WorldState;
|
||||||
using Content.Server.AI.WorldState.States.Inventory;
|
using Content.Server.AI.WorldState.States.Inventory;
|
||||||
using Content.Server.Weapon.Melee.Components;
|
using Content.Server.Weapon.Melee.Components;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.Considerations.Combat.Melee
|
namespace Content.Server.AI.Utility.Considerations.Combat.Melee
|
||||||
{
|
{
|
||||||
@@ -10,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee
|
|||||||
{
|
{
|
||||||
foreach (var item in context.GetState<EnumerableInventoryState>().GetValue())
|
foreach (var item in context.GetState<EnumerableInventoryState>().GetValue())
|
||||||
{
|
{
|
||||||
if (item.HasComponent<MeleeWeaponComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<MeleeWeaponComponent>(item.Uid))
|
||||||
{
|
{
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Content.Server.AI.WorldState;
|
using Content.Server.AI.WorldState;
|
||||||
using Content.Server.AI.WorldState.States.Inventory;
|
using Content.Server.AI.WorldState.States.Inventory;
|
||||||
using Content.Server.Weapon.Melee.Components;
|
using Content.Server.Weapon.Melee.Components;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.Considerations.Combat.Melee
|
namespace Content.Server.AI.Utility.Considerations.Combat.Melee
|
||||||
{
|
{
|
||||||
@@ -15,7 +17,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee
|
|||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return equipped.HasComponent<MeleeWeaponComponent>() ? 1.0f : 0.0f;
|
return IoCManager.Resolve<IEntityManager>().HasComponent<MeleeWeaponComponent>(equipped.Uid) ? 1.0f : 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using Content.Server.AI.WorldState.States;
|
|||||||
using Content.Server.AI.WorldState.States.Hands;
|
using Content.Server.AI.WorldState.States.Hands;
|
||||||
using Content.Server.AI.WorldState.States.Inventory;
|
using Content.Server.AI.WorldState.States.Inventory;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.Considerations.Inventory
|
namespace Content.Server.AI.Utility.Considerations.Inventory
|
||||||
{
|
{
|
||||||
@@ -14,7 +16,7 @@ namespace Content.Server.AI.Utility.Considerations.Inventory
|
|||||||
// If not then check if we have a free hand
|
// If not then check if we have a free hand
|
||||||
var target = context.GetState<TargetEntityState>().GetValue();
|
var target = context.GetState<TargetEntityState>().GetValue();
|
||||||
|
|
||||||
if (target == null || !target.HasComponent<ItemComponent>())
|
if (target == null || !IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(target.Uid))
|
||||||
{
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ using Content.Server.AI.WorldState;
|
|||||||
using Content.Server.AI.WorldState.States;
|
using Content.Server.AI.WorldState.States;
|
||||||
using Content.Server.AI.WorldState.States.Inventory;
|
using Content.Server.AI.WorldState.States.Inventory;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.Considerations.Inventory
|
namespace Content.Server.AI.Utility.Considerations.Inventory
|
||||||
{
|
{
|
||||||
@@ -11,7 +13,7 @@ namespace Content.Server.AI.Utility.Considerations.Inventory
|
|||||||
{
|
{
|
||||||
var target = context.GetState<TargetEntityState>().GetValue();
|
var target = context.GetState<TargetEntityState>().GetValue();
|
||||||
|
|
||||||
if (target == null || !target.HasComponent<ItemComponent>())
|
if (target == null || !IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(target.Uid))
|
||||||
{
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Server.AI.WorldState;
|
|||||||
using Content.Server.AI.WorldState.States;
|
using Content.Server.AI.WorldState.States;
|
||||||
using Content.Server.AI.WorldState.States.Inventory;
|
using Content.Server.AI.WorldState.States.Inventory;
|
||||||
using Content.Server.Weapon.Melee.Components;
|
using Content.Server.Weapon.Melee.Components;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.ExpandableActions.Combat.Melee
|
namespace Content.Server.AI.Utility.ExpandableActions.Combat.Melee
|
||||||
@@ -33,7 +34,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Combat.Melee
|
|||||||
|
|
||||||
foreach (var entity in context.GetState<EnumerableInventoryState>().GetValue())
|
foreach (var entity in context.GetState<EnumerableInventoryState>().GetValue())
|
||||||
{
|
{
|
||||||
if (!entity.HasComponent<MeleeWeaponComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<MeleeWeaponComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Server.AI.WorldState;
|
|||||||
using Content.Server.AI.WorldState.States;
|
using Content.Server.AI.WorldState.States;
|
||||||
using Content.Server.AI.WorldState.States.Inventory;
|
using Content.Server.AI.WorldState.States.Inventory;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.ExpandableActions.Nutrition
|
namespace Content.Server.AI.Utility.ExpandableActions.Nutrition
|
||||||
@@ -31,7 +32,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Nutrition
|
|||||||
|
|
||||||
foreach (var entity in context.GetState<EnumerableInventoryState>().GetValue())
|
foreach (var entity in context.GetState<EnumerableInventoryState>().GetValue())
|
||||||
{
|
{
|
||||||
if (!entity.HasComponent<DrinkComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<DrinkComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Server.AI.WorldState;
|
|||||||
using Content.Server.AI.WorldState.States;
|
using Content.Server.AI.WorldState.States;
|
||||||
using Content.Server.AI.WorldState.States.Inventory;
|
using Content.Server.AI.WorldState.States.Inventory;
|
||||||
using Content.Server.Nutrition.Components;
|
using Content.Server.Nutrition.Components;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.ExpandableActions.Nutrition
|
namespace Content.Server.AI.Utility.ExpandableActions.Nutrition
|
||||||
@@ -31,7 +32,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Nutrition
|
|||||||
|
|
||||||
foreach (var entity in context.GetState<EnumerableInventoryState>().GetValue())
|
foreach (var entity in context.GetState<EnumerableInventoryState>().GetValue())
|
||||||
{
|
{
|
||||||
if (!entity.HasComponent<FoodComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<FoodComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Server.Storage.Components;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.WorldState.States.Clothing
|
namespace Content.Server.AI.WorldState.States.Clothing
|
||||||
{
|
{
|
||||||
@@ -28,7 +29,7 @@ namespace Content.Server.AI.WorldState.States.Clothing
|
|||||||
{
|
{
|
||||||
if (entity.TryGetContainer(out var container))
|
if (entity.TryGetContainer(out var container))
|
||||||
{
|
{
|
||||||
if (!container.Owner.HasComponent<EntityStorageComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<EntityStorageComponent>(container.Owner.Uid))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
|
|
||||||
namespace Content.Server.AI.WorldState.States.Inventory
|
namespace Content.Server.AI.WorldState.States.Inventory
|
||||||
@@ -17,7 +18,7 @@ namespace Content.Server.AI.WorldState.States.Inventory
|
|||||||
public override void SetValue(IEntity? value)
|
public override void SetValue(IEntity? value)
|
||||||
{
|
{
|
||||||
base.SetValue(value);
|
base.SetValue(value);
|
||||||
if (value != null && !value.HasComponent<EntityStorageComponent>())
|
if (value != null && !IoCManager.Resolve<IEntityManager>().HasComponent<EntityStorageComponent>(value.Uid))
|
||||||
{
|
{
|
||||||
Logger.Warning("Set LastOpenedStorageState for an entity that doesn't have a storage component");
|
Logger.Warning("Set LastOpenedStorageState for an entity that doesn't have a storage component");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace Content.Server.AI.WorldState.States.Mobs
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.AttachedEntity != Owner && player.AttachedEntity.HasComponent<DamageableComponent>())
|
if (player.AttachedEntity != Owner && IoCManager.Resolve<IEntityManager>().HasComponent<DamageableComponent>(player.AttachedEntity.Uid))
|
||||||
{
|
{
|
||||||
result.Add(player.AttachedEntity);
|
result.Add(player.AttachedEntity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Server.Storage.Components;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.WorldState.States.Nutrition
|
namespace Content.Server.AI.WorldState.States.Nutrition
|
||||||
{
|
{
|
||||||
@@ -28,7 +29,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition
|
|||||||
{
|
{
|
||||||
if (entity.TryGetContainer(out var container))
|
if (entity.TryGetContainer(out var container))
|
||||||
{
|
{
|
||||||
if (!container.Owner.HasComponent<EntityStorageComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<EntityStorageComponent>(container.Owner.Uid))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Server.Storage.Components;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.AI.WorldState.States.Nutrition
|
namespace Content.Server.AI.WorldState.States.Nutrition
|
||||||
{
|
{
|
||||||
@@ -28,7 +29,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition
|
|||||||
{
|
{
|
||||||
if (entity.TryGetContainer(out var container))
|
if (entity.TryGetContainer(out var container))
|
||||||
{
|
{
|
||||||
if (!container.Owner.HasComponent<EntityStorageComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<EntityStorageComponent>(container.Owner.Uid))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Server.AME
|
|||||||
{
|
{
|
||||||
var nodeNeighbors = grid.GetCellsInSquareArea(nodeOwner.Transform.Coordinates, 1)
|
var nodeNeighbors = grid.GetCellsInSquareArea(nodeOwner.Transform.Coordinates, 1)
|
||||||
.Select(sgc => IoCManager.Resolve<IEntityManager>().GetEntity(sgc))
|
.Select(sgc => IoCManager.Resolve<IEntityManager>().GetEntity(sgc))
|
||||||
.Where(entity => entity != nodeOwner && entity.HasComponent<AMEShieldComponent>());
|
.Where(entity => entity != nodeOwner && IoCManager.Resolve<IEntityManager>().HasComponent<AMEShieldComponent>(entity.Uid));
|
||||||
|
|
||||||
if (nodeNeighbors.Count() >= 8)
|
if (nodeNeighbors.Count() >= 8)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Content.Server.AME.Components
|
|||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
|
||||||
{
|
{
|
||||||
if (!args.User.HasComponent<HandsComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandsComponent>(args.User.Uid))
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(args.User, Loc.GetString("ame-part-component-interact-using-no-hands"));
|
Owner.PopupMessage(args.User, Loc.GetString("ame-part-component-interact-using-no-hands"));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace Content.Server.Administration
|
|||||||
// Control mob verb
|
// Control mob verb
|
||||||
if (_groupController.CanCommand(player, "controlmob") &&
|
if (_groupController.CanCommand(player, "controlmob") &&
|
||||||
args.User != args.Target &&
|
args.User != args.Target &&
|
||||||
args.User.HasComponent<MindComponent>() &&
|
IoCManager.Resolve<IEntityManager>().HasComponent<MindComponent>(args.User.Uid) &&
|
||||||
args.Target.TryGetComponent<MindComponent>(out var targetMind))
|
args.Target.TryGetComponent<MindComponent>(out var targetMind))
|
||||||
{
|
{
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
@@ -106,7 +106,7 @@ namespace Content.Server.Administration
|
|||||||
// Make Sentient verb
|
// Make Sentient verb
|
||||||
if (_groupController.CanCommand(player, "makesentient") &&
|
if (_groupController.CanCommand(player, "makesentient") &&
|
||||||
args.User != args.Target &&
|
args.User != args.Target &&
|
||||||
!args.Target.HasComponent<MindComponent>())
|
!IoCManager.Resolve<IEntityManager>().HasComponent<MindComponent>(args.Target.Uid))
|
||||||
{
|
{
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
verb.Text = Loc.GetString("make-sentient-verb-get-data-text");
|
verb.Text = Loc.GetString("make-sentient-verb-get-data-text");
|
||||||
@@ -138,7 +138,7 @@ namespace Content.Server.Administration
|
|||||||
|
|
||||||
// Set clothing verb
|
// Set clothing verb
|
||||||
if (_groupController.CanCommand(player, "setoutfit") &&
|
if (_groupController.CanCommand(player, "setoutfit") &&
|
||||||
args.Target.HasComponent<InventoryComponent>())
|
IoCManager.Resolve<IEntityManager>().HasComponent<InventoryComponent>(args.Target.Uid))
|
||||||
{
|
{
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
verb.Text = Loc.GetString("set-outfit-verb-get-data-text");
|
verb.Text = Loc.GetString("set-outfit-verb-get-data-text");
|
||||||
@@ -206,7 +206,7 @@ namespace Content.Server.Administration
|
|||||||
|
|
||||||
// Add verb to open Solution Editor
|
// Add verb to open Solution Editor
|
||||||
if (_groupController.CanCommand(player, "addreagent") &&
|
if (_groupController.CanCommand(player, "addreagent") &&
|
||||||
args.Target.HasComponent<SolutionContainerManagerComponent>())
|
IoCManager.Resolve<IEntityManager>().HasComponent<SolutionContainerManagerComponent>(args.Target.Uid))
|
||||||
{
|
{
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
verb.Text = Loc.GetString("edit-solutions-verb-get-data-text");
|
verb.Text = Loc.GetString("edit-solutions-verb-get-data-text");
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mind.VisitingEntity != null && mind.VisitingEntity.HasComponent<GhostComponent>())
|
if (mind.VisitingEntity != null && IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(mind.VisitingEntity.Uid))
|
||||||
{
|
{
|
||||||
player.ContentData()!.Mind?.UnVisit();
|
player.ContentData()!.Mind?.UnVisit();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
EntitySystem.Get<CreamPieSystem>().SetCreamPied(target.Uid, creamPied, false);
|
EntitySystem.Get<CreamPieSystem>().SetCreamPied(target.Uid, creamPied, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.HasComponent<JitteringComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<JitteringComponent>(target.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().RemoveComponent<JitteringComponent>(target.Uid);
|
IoCManager.Resolve<IEntityManager>().RemoveComponent<JitteringComponent>(target.Uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
var target = entityManager.GetEntity(eUid);
|
var target = entityManager.GetEntity(eUid);
|
||||||
|
|
||||||
if (!target.HasComponent<MindComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<MindComponent>(target.Uid))
|
||||||
{
|
{
|
||||||
shell.WriteLine(Loc.GetString("set-mind-command-target-has-no-mind-message"));
|
shell.WriteLine(Loc.GetString("set-mind-command-target-has-no-mind-message"));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ namespace Content.Server.Animals.Systems
|
|||||||
{
|
{
|
||||||
if (args.Using == null ||
|
if (args.Using == null ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
!args.Using.HasComponent<RefillableSolutionComponent>())
|
!IoCManager.Resolve<IEntityManager>().HasComponent<RefillableSolutionComponent>(args.Using.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Content.Server.Atmos.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grid.HasComponent<IAtmosphereComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<IAtmosphereComponent>(grid.Uid))
|
||||||
{
|
{
|
||||||
shell.WriteLine("Grid already has an atmosphere.");
|
shell.WriteLine("Grid already has an atmosphere.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Content.Server.Atmos.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grid.HasComponent<IAtmosphereComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<IAtmosphereComponent>(grid.Uid))
|
||||||
{
|
{
|
||||||
shell.WriteLine("Grid already has an atmosphere.");
|
shell.WriteLine("Grid already has an atmosphere.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -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<MobStateComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<MobStateComponent>(physics.Owner.Uid))
|
||||||
{
|
{
|
||||||
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<MobStateComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<MobStateComponent>(physicsComponent.Owner.Uid))
|
||||||
{
|
{
|
||||||
physicsComponent.BodyStatus = BodyStatus.OnGround;
|
physicsComponent.BodyStatus = BodyStatus.OnGround;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.Body.Part;
|
|||||||
using Content.Shared.Body.Surgery;
|
using Content.Shared.Body.Surgery;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using static Content.Shared.Body.Surgery.ISurgeryData;
|
using static Content.Shared.Body.Surgery.ISurgeryData;
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ namespace Content.Server.Body.Surgery
|
|||||||
|
|
||||||
private async Task<bool> SurgeryDoAfter(IEntity performer)
|
private async Task<bool> SurgeryDoAfter(IEntity performer)
|
||||||
{
|
{
|
||||||
if (!performer.HasComponent<DoAfterComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<DoAfterComponent>(performer.Uid))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -298,7 +299,7 @@ namespace Content.Server.Body.Surgery
|
|||||||
|
|
||||||
performer.PopupMessage(Loc.GetString("biological-surgery-data-component-loosen-organ-message"));
|
performer.PopupMessage(Loc.GetString("biological-surgery-data-component-loosen-organ-message"));
|
||||||
|
|
||||||
if (!performer.HasComponent<DoAfterComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<DoAfterComponent>(performer.Uid))
|
||||||
{
|
{
|
||||||
AddDisconnectedOrgan(target);
|
AddDisconnectedOrgan(target);
|
||||||
return;
|
return;
|
||||||
@@ -339,7 +340,7 @@ namespace Content.Server.Body.Surgery
|
|||||||
|
|
||||||
performer.PopupMessage(Loc.GetString("biological-surgery-data-component-remove-organ-message"));
|
performer.PopupMessage(Loc.GetString("biological-surgery-data-component-remove-organ-message"));
|
||||||
|
|
||||||
if (!performer.HasComponent<DoAfterComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<DoAfterComponent>(performer.Uid))
|
||||||
{
|
{
|
||||||
Parent.RemoveMechanism(target, performer.Transform.Coordinates);
|
Parent.RemoveMechanism(target, performer.Transform.Coordinates);
|
||||||
RemoveDisconnectedOrgan(target);
|
RemoveDisconnectedOrgan(target);
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ namespace Content.Server.Buckle.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user.HasComponent<HandsComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandsComponent>(user.Uid))
|
||||||
{
|
{
|
||||||
user.PopupMessage(Loc.GetString("buckle-component-no-hands-message "));
|
user.PopupMessage(Loc.GetString("buckle-component-no-hands-message "));
|
||||||
return false;
|
return false;
|
||||||
@@ -325,7 +325,7 @@ namespace Content.Server.Buckle.Components
|
|||||||
|
|
||||||
Appearance?.SetData(BuckleVisuals.Buckled, false);
|
Appearance?.SetData(BuckleVisuals.Buckled, false);
|
||||||
|
|
||||||
if (Owner.HasComponent<KnockedDownComponent>()
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<KnockedDownComponent>(Owner.Uid)
|
||||||
|| (_mobState?.IsIncapacitated() ?? false))
|
|| (_mobState?.IsIncapacitated() ?? false))
|
||||||
{
|
{
|
||||||
EntitySystem.Get<StandingStateSystem>().Down(Owner.Uid);
|
EntitySystem.Get<StandingStateSystem>().Down(Owner.Uid);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Content.Server.Buckle.Systems
|
|||||||
|
|
||||||
// If the used entity is a person being pulled, prioritize this verb. Conversely, if it is
|
// If the used entity is a person being pulled, prioritize this verb. Conversely, if it is
|
||||||
// just a held object, the user is probably just trying to sit down.
|
// just a held object, the user is probably just trying to sit down.
|
||||||
verb.Priority = args.Using.HasComponent<ActorComponent>() ? 1 : -1;
|
verb.Priority = IoCManager.Resolve<IEntityManager>().HasComponent<ActorComponent>(args.Using.Uid) ? 1 : -1;
|
||||||
|
|
||||||
args.Verbs.Add(verb);
|
args.Verbs.Add(verb);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ namespace Content.Server.Cargo.Components
|
|||||||
{
|
{
|
||||||
foreach (IEntity entity in enumerator)
|
foreach (IEntity entity in enumerator)
|
||||||
{
|
{
|
||||||
if (entity.HasComponent<CargoTelepadComponent>() && entity.TryGetComponent<ApcPowerReceiverComponent>(out var powerReceiver) && powerReceiver.Powered)
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<CargoTelepadComponent>(entity.Uid) && entity.TryGetComponent<ApcPowerReceiverComponent>(out var powerReceiver) && powerReceiver.Powered)
|
||||||
{
|
{
|
||||||
cargoTelepad = entity;
|
cargoTelepad = entity;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.Players;
|
|||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Chat.Commands
|
namespace Content.Server.Chat.Commands
|
||||||
@@ -45,7 +46,7 @@ namespace Content.Server.Chat.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerEntity.HasComponent<GhostComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(playerEntity.Uid))
|
||||||
chat.SendDeadChat(player, message);
|
chat.SendDeadChat(player, message);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace Content.Server.Chat.Commands
|
|||||||
{
|
{
|
||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
{
|
{
|
||||||
if (entity.HasComponent<ItemComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(entity.Uid))
|
||||||
continue;
|
continue;
|
||||||
var suicide = IoCManager.Resolve<IEntityManager>().GetComponents<ISuicideAct>(entity.Uid).FirstOrDefault();
|
var suicide = IoCManager.Resolve<IEntityManager>().GetComponents<ISuicideAct>(entity.Uid).FirstOrDefault();
|
||||||
if (suicide != null)
|
if (suicide != null)
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ namespace Content.Server.Chat.Managers
|
|||||||
var transform = player.AttachedEntity.Transform;
|
var transform = player.AttachedEntity.Transform;
|
||||||
|
|
||||||
if (transform.MapID != sourceMapId ||
|
if (transform.MapID != sourceMapId ||
|
||||||
!player.AttachedEntity.HasComponent<GhostComponent>() &&
|
!IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(player.AttachedEntity.Uid) &&
|
||||||
!sourceCoords.InRange(_entManager, transform.Coordinates, VoiceRange)) continue;
|
!sourceCoords.InRange(_entManager, transform.Coordinates, VoiceRange)) continue;
|
||||||
|
|
||||||
clients.Add(player.ConnectedClient);
|
clients.Add(player.ConnectedClient);
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ namespace Content.Server.Chemistry.Components
|
|||||||
// TODO: Does checking for BodyComponent make sense as a "can be hypospray'd" tag?
|
// TODO: Does checking for BodyComponent make sense as a "can be hypospray'd" tag?
|
||||||
// In SS13 the hypospray ONLY works on mobs, NOT beakers or anything else.
|
// In SS13 the hypospray ONLY works on mobs, NOT beakers or anything else.
|
||||||
|
|
||||||
return entity.HasComponent<SolutionContainerManagerComponent>()
|
return IoCManager.Resolve<IEntityManager>().HasComponent<SolutionContainerManagerComponent>(entity.Uid)
|
||||||
&& entity.HasComponent<MobStateComponent>();
|
&& IoCManager.Resolve<IEntityManager>().HasComponent<MobStateComponent>(entity.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
|
|
||||||
var solutionsSys = EntitySystem.Get<SolutionContainerSystem>();
|
var solutionsSys = EntitySystem.Get<SolutionContainerSystem>();
|
||||||
//Make sure we have the attacking entity
|
//Make sure we have the attacking entity
|
||||||
if (eventArgs.Target == null || !Owner.HasComponent<SolutionContainerManagerComponent>())
|
if (eventArgs.Target == null || !IoCManager.Resolve<IEntityManager>().HasComponent<SolutionContainerManagerComponent>(Owner.Uid))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
if (Inception != null)
|
if (Inception != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Owner.HasComponent<SolutionAreaEffectInceptionComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<SolutionAreaEffectInceptionComponent>(Owner.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Amount = amount;
|
Amount = amount;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Content.Shared.Interaction.Helpers;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -115,11 +116,11 @@ namespace Content.Server.Chemistry.Components
|
|||||||
if (!eventArgs.InRangeUnobstructed() || eventArgs.Target == null)
|
if (!eventArgs.InRangeUnobstructed() || eventArgs.Target == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Owner.HasComponent<SolutionContainerManagerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SolutionContainerManagerComponent>(Owner.Uid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var target = eventArgs.Target!;
|
var target = eventArgs.Target!;
|
||||||
if (!target.HasComponent<SolutionContainerManagerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SolutionContainerManagerComponent>(target.Uid))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace Content.Server.Climbing.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user.HasComponent<ClimbingComponent>() ||
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<ClimbingComponent>(user.Uid) ||
|
||||||
!user.TryGetComponent(out SharedBodyComponent? body))
|
!user.TryGetComponent(out SharedBodyComponent? body))
|
||||||
{
|
{
|
||||||
reason = Loc.GetString("comp-climbable-cant-climb");
|
reason = Loc.GetString("comp-climbable-cant-climb");
|
||||||
@@ -114,7 +114,7 @@ namespace Content.Server.Climbing.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == null || !dragged.HasComponent<ClimbingComponent>())
|
if (target == null || !IoCManager.Resolve<IEntityManager>().HasComponent<ClimbingComponent>(dragged.Uid))
|
||||||
{
|
{
|
||||||
reason = Loc.GetString("comp-climbable-cant-climb");
|
reason = Loc.GetString("comp-climbable-cant-climb");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ namespace Content.Server.Construction.Commands
|
|||||||
valid |= occluder.Enabled;
|
valid |= occluder.Enabled;
|
||||||
}
|
}
|
||||||
// low walls & grilles
|
// low walls & grilles
|
||||||
valid |= childEntity.HasComponent<SharedCanBuildWindowOnTopComponent>();
|
valid |= IoCManager.Resolve<IEntityManager>().HasComponent<SharedCanBuildWindowOnTopComponent>(childEntity.Uid);
|
||||||
// cables
|
// cables
|
||||||
valid |= childEntity.HasComponent<CableComponent>();
|
valid |= IoCManager.Resolve<IEntityManager>().HasComponent<CableComponent>(childEntity.Uid);
|
||||||
// anything else that might need this forced
|
// anything else that might need this forced
|
||||||
valid |= childEntity.HasTag("ForceFixRotations");
|
valid |= childEntity.HasTag("ForceFixRotations");
|
||||||
// override
|
// override
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace Content.Server.Conveyor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (component.Owner.HasComponent<ItemComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(component.Owner.Uid))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ namespace Content.Server.Conveyor
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.HasComponent<IMapGridComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<IMapGridComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Content.Server.Cuffs.Components
|
|||||||
/// <param name="prototype"></param>
|
/// <param name="prototype"></param>
|
||||||
public bool TryAddNewCuffs(IEntity user, IEntity handcuff)
|
public bool TryAddNewCuffs(IEntity user, IEntity handcuff)
|
||||||
{
|
{
|
||||||
if (!handcuff.HasComponent<HandcuffComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandcuffComponent>(handcuff.Uid))
|
||||||
{
|
{
|
||||||
Logger.Warning($"Handcuffs being applied to player are missing a {nameof(HandcuffComponent)}!");
|
Logger.Warning($"Handcuffs being applied to player are missing a {nameof(HandcuffComponent)}!");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Content.Shared.Sound;
|
|||||||
using Content.Shared.Stunnable;
|
using Content.Shared.Stunnable;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -198,7 +199,7 @@ namespace Content.Server.Cuffs.Components
|
|||||||
{
|
{
|
||||||
var cuffTime = CuffTime;
|
var cuffTime = CuffTime;
|
||||||
|
|
||||||
if (target.HasComponent<StunnedComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<StunnedComponent>(target.Uid))
|
||||||
{
|
{
|
||||||
cuffTime = MathF.Max(0.1f, cuffTime - StunBonus);
|
cuffTime = MathF.Max(0.1f, cuffTime - StunBonus);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,8 +84,8 @@ namespace Content.Server.Disposal.Unit.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return entity.HasComponent<ItemComponent>() ||
|
return IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(entity.Uid) ||
|
||||||
entity.HasComponent<SharedBodyComponent>();
|
IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryInsert(IEntity entity)
|
public bool TryInsert(IEntity entity)
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
|||||||
|
|
||||||
UpdateInterface(component, component.Powered);
|
UpdateInterface(component, component.Powered);
|
||||||
|
|
||||||
if (!component.Owner.HasComponent<AnchorableComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnchorableComponent>(component.Owner.Uid))
|
||||||
{
|
{
|
||||||
Logger.WarningS("VitalComponentMissing", $"Disposal unit {uid} is missing an {nameof(AnchorableComponent)}");
|
Logger.WarningS("VitalComponentMissing", $"Disposal unit {uid} is missing an {nameof(AnchorableComponent)}");
|
||||||
}
|
}
|
||||||
@@ -395,7 +395,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
|||||||
}
|
}
|
||||||
// This popup message doesn't appear on clicks, even when code was seperate. Unsure why.
|
// This popup message doesn't appear on clicks, even when code was seperate. Unsure why.
|
||||||
|
|
||||||
if (!eventArgs.User.HasComponent<HandsComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandsComponent>(eventArgs.User.Uid))
|
||||||
{
|
{
|
||||||
eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("ui-disposal-unit-is-valid-interaction-no-hands"));
|
eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("ui-disposal-unit-is-valid-interaction-no-hands"));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ namespace Content.Server.Doors.Components
|
|||||||
hitsomebody = true;
|
hitsomebody = true;
|
||||||
CurrentlyCrushing.Add(e.Owner.Uid);
|
CurrentlyCrushing.Add(e.Owner.Uid);
|
||||||
|
|
||||||
if (e.Owner.HasComponent<DamageableComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<DamageableComponent>(e.Owner.Uid))
|
||||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(e.Owner.Uid, CrushDamage);
|
EntitySystem.Get<DamageableSystem>().TryChangeDamage(e.Owner.Uid, CrushDamage);
|
||||||
|
|
||||||
EntitySystem.Get<StunSystem>().TryParalyze(e.Owner.Uid, TimeSpan.FromSeconds(DoorStunTime));
|
EntitySystem.Get<StunSystem>().TryParalyze(e.Owner.Uid, TimeSpan.FromSeconds(DoorStunTime));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Doors.Components;
|
using Content.Server.Doors.Components;
|
||||||
using Content.Shared.Doors;
|
using Content.Shared.Doors;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Physics.Dynamics;
|
using Robust.Shared.Physics.Dynamics;
|
||||||
|
|
||||||
namespace Content.Server.Doors
|
namespace Content.Server.Doors
|
||||||
@@ -45,7 +46,7 @@ namespace Content.Server.Doors
|
|||||||
|
|
||||||
private void HandleCollide(EntityUid uid, ServerDoorComponent component, StartCollideEvent args)
|
private void HandleCollide(EntityUid uid, ServerDoorComponent component, StartCollideEvent args)
|
||||||
{
|
{
|
||||||
if (!args.OtherFixture.Body.Owner.HasComponent<DoorBumpOpenerComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<DoorBumpOpenerComponent>(args.OtherFixture.Body.Owner.Uid))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace Content.Server.Electrocution
|
|||||||
foreach (var entity in transform.Coordinates.GetEntitiesInTile(
|
foreach (var entity in transform.Coordinates.GetEntitiesInTile(
|
||||||
LookupFlags.Approximate | LookupFlags.IncludeAnchored, _entityLookup))
|
LookupFlags.Approximate | LookupFlags.IncludeAnchored, _entityLookup))
|
||||||
{
|
{
|
||||||
if (entity.HasComponent<WindowComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<WindowComponent>(entity.Uid))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Content.Server.Explosion.Components
|
|||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
|
||||||
{
|
{
|
||||||
if (_grenadesContainer.ContainedEntities.Count >= _maxGrenades ||
|
if (_grenadesContainer.ContainedEntities.Count >= _maxGrenades ||
|
||||||
!args.Using.HasComponent<FlashOnTriggerComponent>())
|
!IoCManager.Resolve<IEntityManager>().HasComponent<FlashOnTriggerComponent>(args.Using.Uid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_grenadesContainer.Insert(args.Using);
|
_grenadesContainer.Insert(args.Using);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Content.Shared.Extinguisher;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -59,7 +60,7 @@ namespace Content.Server.Extinguisher
|
|||||||
}
|
}
|
||||||
|
|
||||||
var targetEntity = eventArgs.Target;
|
var targetEntity = eventArgs.Target;
|
||||||
if (eventArgs.Target.HasComponent<ReagentTankComponent>()
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<ReagentTankComponent>(eventArgs.Target.Uid)
|
||||||
&& solutionContainerSystem.TryGetDrainableSolution(targetEntity.Uid, out var targetSolution)
|
&& solutionContainerSystem.TryGetDrainableSolution(targetEntity.Uid, out var targetSolution)
|
||||||
&& solutionContainerSystem.TryGetDrainableSolution(Owner.Uid, out var container))
|
&& solutionContainerSystem.TryGetDrainableSolution(Owner.Uid, out var container))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Content.Server.Flash
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Entity.HasComponent<FlashableComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<FlashableComponent>(args.Entity.Uid))
|
||||||
{
|
{
|
||||||
args.CanInteract = true;
|
args.CanInteract = true;
|
||||||
Flash(args.Entity.Uid, args.User.Uid, uid, comp.FlashDuration, comp.SlowTo);
|
Flash(args.Entity.Uid, args.User.Uid, uid, comp.FlashDuration, comp.SlowTo);
|
||||||
@@ -155,7 +155,7 @@ namespace Content.Server.Flash
|
|||||||
|
|
||||||
foreach (var entity in _entityLookup.GetEntitiesInRange(transform.Coordinates, range))
|
foreach (var entity in _entityLookup.GetEntitiesInRange(transform.Coordinates, range))
|
||||||
{
|
{
|
||||||
if (!entity.HasComponent<FlashableComponent>() ||
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<FlashableComponent>(entity.Uid) ||
|
||||||
!transform.InRangeUnobstructed(entity, range, CollisionGroup.Opaque)) continue;
|
!transform.InRangeUnobstructed(entity, range, CollisionGroup.Opaque)) continue;
|
||||||
|
|
||||||
Flash(entity.Uid, user, source, duration, slowTo, displayPopup);
|
Flash(entity.Uid, user, source, duration, slowTo, displayPopup);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
{
|
{
|
||||||
var playerEntity = mind.OwnedEntity;
|
var playerEntity = mind.OwnedEntity;
|
||||||
|
|
||||||
if (playerEntity != null && playerEntity.HasComponent<GhostComponent>())
|
if (playerEntity != null && IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(playerEntity.Uid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mind.VisitingEntity != null)
|
if (mind.VisitingEntity != null)
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
}
|
}
|
||||||
else if (!mobState.IsDead())
|
else if (!mobState.IsDead())
|
||||||
{
|
{
|
||||||
if (entity.HasComponent<HandsComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<HandsComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Content.Server.GameTicking.Rules
|
|||||||
{
|
{
|
||||||
if (playerSession.AttachedEntity == null
|
if (playerSession.AttachedEntity == null
|
||||||
|| !playerSession.AttachedEntity.TryGetComponent(out MobStateComponent? mobState)
|
|| !playerSession.AttachedEntity.TryGetComponent(out MobStateComponent? mobState)
|
||||||
|| !playerSession.AttachedEntity.HasComponent<SuspicionRoleComponent>())
|
|| !IoCManager.Resolve<IEntityManager>().HasComponent<SuspicionRoleComponent>(playerSession.AttachedEntity.Uid))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Content.Server.Ghost
|
|||||||
var entity = args.SenderSession.AttachedEntity;
|
var entity = args.SenderSession.AttachedEntity;
|
||||||
|
|
||||||
if (entity == null ||
|
if (entity == null ||
|
||||||
!entity.HasComponent<GhostComponent>())
|
!IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
Logger.Warning($"User {args.SenderSession.Name} sent a {nameof(GhostWarpsRequestEvent)} without being a ghost.");
|
Logger.Warning($"User {args.SenderSession.Name} sent a {nameof(GhostWarpsRequestEvent)} without being a ghost.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Content.Server.Ghost.Roles
|
|||||||
|
|
||||||
public void OpenEui(IPlayerSession session)
|
public void OpenEui(IPlayerSession session)
|
||||||
{
|
{
|
||||||
if (session.AttachedEntity == null || !session.AttachedEntity.HasComponent<GhostComponent>())
|
if (session.AttachedEntity == null || !IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(session.AttachedEntity.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(_openUis.ContainsKey(session))
|
if(_openUis.ContainsKey(session))
|
||||||
@@ -194,7 +194,7 @@ namespace Content.Server.Ghost.Roles
|
|||||||
{
|
{
|
||||||
// Close the session of any player that has a ghost roles window open and isn't a ghost anymore.
|
// Close the session of any player that has a ghost roles window open and isn't a ghost anymore.
|
||||||
if (!_openUis.ContainsKey(message.Player)) return;
|
if (!_openUis.ContainsKey(message.Player)) return;
|
||||||
if (message.Entity.HasComponent<GhostComponent>()) return;
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(message.Entity.Uid)) return;
|
||||||
CloseEui(message.Player);
|
CloseEui(message.Player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ namespace Content.Server.Hands.Systems
|
|||||||
{
|
{
|
||||||
foreach (var inhand in component.GetAllHeldItems())
|
foreach (var inhand in component.GetAllHeldItems())
|
||||||
{
|
{
|
||||||
if (inhand.Owner.HasComponent<HandVirtualItemComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<HandVirtualItemComponent>(inhand.Owner.Uid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
args.PushText(Loc.GetString("comp-hands-examine", ("user", component.Owner), ("item", inhand.Owner)));
|
args.PushText(Loc.GetString("comp-hands-examine", ("user", component.Owner), ("item", inhand.Owner)));
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ namespace Content.Server.Interaction
|
|||||||
/// <param name="uid"></param>
|
/// <param name="uid"></param>
|
||||||
internal void AiUseInteraction(IEntity entity, EntityCoordinates coords, EntityUid uid)
|
internal void AiUseInteraction(IEntity entity, EntityCoordinates coords, EntityUid uid)
|
||||||
{
|
{
|
||||||
if (entity.HasComponent<ActorComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<ActorComponent>(entity.Uid))
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
|
|
||||||
UserInteraction(entity, coords, uid);
|
UserInteraction(entity, coords, uid);
|
||||||
@@ -522,7 +522,7 @@ namespace Content.Server.Interaction
|
|||||||
}
|
}
|
||||||
else if (!wideAttack &&
|
else if (!wideAttack &&
|
||||||
(targetEnt != null || EntityManager.TryGetEntity(targetUid, out targetEnt)) &&
|
(targetEnt != null || EntityManager.TryGetEntity(targetUid, out targetEnt)) &&
|
||||||
targetEnt.HasComponent<ItemComponent>())
|
IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(targetEnt.Uid))
|
||||||
{
|
{
|
||||||
// We pick up items if our hand is empty, even if we're in combat mode.
|
// We pick up items if our hand is empty, even if we're in combat mode.
|
||||||
InteractHand(user, targetEnt);
|
InteractHand(user, targetEnt);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
{
|
{
|
||||||
if (args.Handled) return;
|
if (args.Handled) return;
|
||||||
|
|
||||||
if (!args.User.HasComponent<HandsComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandsComponent>(args.User.Uid))
|
||||||
{
|
{
|
||||||
component.Owner.PopupMessage(args.User,
|
component.Owner.PopupMessage(args.User,
|
||||||
Loc.GetString("reagent-grinder-component-interact-using-no-hands"));
|
Loc.GetString("reagent-grinder-component-interact-using-no-hands"));
|
||||||
@@ -341,7 +341,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0
|
var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0
|
||||||
if (item.HasComponent<StackComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<StackComponent>(item.Uid))
|
||||||
{
|
{
|
||||||
RaiseLocalEvent(item.Uid, juiceEvent);
|
RaiseLocalEvent(item.Uid, juiceEvent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Content.Server.Lathe.Components
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LatheSyncRequestMessage _:
|
case LatheSyncRequestMessage _:
|
||||||
if (!Owner.HasComponent<MaterialStorageComponent>()) return;
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<MaterialStorageComponent>(Owner.Uid)) return;
|
||||||
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
||||||
if (_producingRecipe != null)
|
if (_producingRecipe != null)
|
||||||
UserInterface?.SendMessage(new LatheProducingRecipeMessage(_producingRecipe.ID));
|
UserInterface?.SendMessage(new LatheProducingRecipeMessage(_producingRecipe.ID));
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ namespace Content.Server.Mind
|
|||||||
|
|
||||||
DebugTools.AssertNotNull(oldVisitingEnt);
|
DebugTools.AssertNotNull(oldVisitingEnt);
|
||||||
|
|
||||||
if (oldVisitingEnt!.HasComponent<VisitingMindComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<VisitingMindComponent>(oldVisitingEnt!.Uid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().RemoveComponent<VisitingMindComponent>(oldVisitingEnt.Uid);
|
IoCManager.Resolve<IEntityManager>().RemoveComponent<VisitingMindComponent>(oldVisitingEnt.Uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Content.Shared.Standing;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -28,7 +29,7 @@ namespace Content.Server.Morgue.Components
|
|||||||
|
|
||||||
protected override bool AddToContents(IEntity entity)
|
protected override bool AddToContents(IEntity entity)
|
||||||
{
|
{
|
||||||
if (entity.HasComponent<SharedBodyComponent>() && !EntitySystem.Get<StandingStateSystem>().IsDown(entity.Uid)) return false;
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity.Uid) && !EntitySystem.Get<StandingStateSystem>().IsDown(entity.Uid)) return false;
|
||||||
return base.AddToContents(entity);
|
return base.AddToContents(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace Content.Server.Morgue.Components
|
|||||||
|
|
||||||
protected override bool AddToContents(IEntity entity)
|
protected override bool AddToContents(IEntity entity)
|
||||||
{
|
{
|
||||||
if (entity.HasComponent<SharedBodyComponent>() && !EntitySystem.Get<StandingStateSystem>().IsDown(entity.Uid))
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity.Uid) && !EntitySystem.Get<StandingStateSystem>().IsDown(entity.Uid))
|
||||||
return false;
|
return false;
|
||||||
return base.AddToContents(entity);
|
return base.AddToContents(entity);
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ namespace Content.Server.Morgue.Components
|
|||||||
foreach (var entity in Contents.ContainedEntities)
|
foreach (var entity in Contents.ContainedEntities)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
if (!hasMob && entity.HasComponent<SharedBodyComponent>())
|
if (!hasMob && IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity.Uid))
|
||||||
hasMob = true;
|
hasMob = true;
|
||||||
if (!hasSoul && entity.TryGetComponent<ActorComponent>(out var actor) && actor.PlayerSession != null)
|
if (!hasSoul && entity.TryGetComponent<ActorComponent>(out var actor) && actor.PlayerSession != null)
|
||||||
hasSoul = true;
|
hasSoul = true;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ namespace Content.Server.PDA
|
|||||||
JobTitle = pda.ContainedID?.JobTitle
|
JobTitle = pda.ContainedID?.JobTitle
|
||||||
};
|
};
|
||||||
|
|
||||||
var hasUplink = pda.Owner.HasComponent<UplinkComponent>();
|
var hasUplink = IoCManager.Resolve<IEntityManager>().HasComponent<UplinkComponent>(pda.Owner.Uid);
|
||||||
|
|
||||||
var ui = pda.Owner.GetUIOrNull(PDAUiKey.Key);
|
var ui = pda.Owner.GetUIOrNull(PDAUiKey.Key);
|
||||||
ui?.SetState(new PDAUpdateState(pda.FlashlightOn, pda.PenSlot.HasItem, ownerInfo, hasUplink));
|
ui?.SetState(new PDAUpdateState(pda.FlashlightOn, pda.PenSlot.HasItem, ownerInfo, hasUplink));
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Content.Server.Physics.Controllers
|
|||||||
|
|
||||||
foreach (var (singularity, physics) in EntityManager.EntityQuery<ServerSingularityComponent, PhysicsComponent>())
|
foreach (var (singularity, physics) in EntityManager.EntityQuery<ServerSingularityComponent, PhysicsComponent>())
|
||||||
{
|
{
|
||||||
if (singularity.Owner.HasComponent<ActorComponent>() ||
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<ActorComponent>(singularity.Owner.Uid) ||
|
||||||
singularity.BeingDeletedByAnotherSingularity) continue;
|
singularity.BeingDeletedByAnotherSingularity) continue;
|
||||||
|
|
||||||
singularity.MoveAccumulator -= frameTime;
|
singularity.MoveAccumulator -= frameTime;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Content.Server.PneumaticCannon
|
|||||||
private void OnInteractUsing(EntityUid uid, PneumaticCannonComponent component, InteractUsingEvent args)
|
private void OnInteractUsing(EntityUid uid, PneumaticCannonComponent component, InteractUsingEvent args)
|
||||||
{
|
{
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
if (args.Used.HasComponent<GasTankComponent>()
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<GasTankComponent>(args.Used.Uid)
|
||||||
&& component.GasTankSlot.CanInsert(args.Used)
|
&& component.GasTankSlot.CanInsert(args.Used)
|
||||||
&& component.GasTankRequired)
|
&& component.GasTankRequired)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
|
|
||||||
public bool InRange(IEntity pointer, EntityCoordinates coordinates)
|
public bool InRange(IEntity pointer, EntityCoordinates coordinates)
|
||||||
{
|
{
|
||||||
if (pointer.HasComponent<GhostComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(pointer.Uid))
|
||||||
{
|
{
|
||||||
return pointer.Transform.Coordinates.InRange(EntityManager, coordinates, 15);
|
return pointer.Transform.Coordinates.InRange(EntityManager, coordinates, 15);
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EntityManager.TryGetEntity(uid, out var entity) && entity.HasComponent<PointingArrowComponent>())
|
if (EntityManager.TryGetEntity(uid, out var entity) && IoCManager.Resolve<IEntityManager>().HasComponent<PointingArrowComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
// this is a pointing arrow. no pointing here...
|
// this is a pointing arrow. no pointing here...
|
||||||
return false;
|
return false;
|
||||||
@@ -200,7 +200,7 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Check if the object is already being pointed at
|
//Check if the object is already being pointed at
|
||||||
if (args.Target.HasComponent<PointingArrowComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<PointingArrowComponent>(args.Target.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!args.User.TryGetComponent<ActorComponent>(out var actor) ||
|
if (!args.User.TryGetComponent<ActorComponent>(out var actor) ||
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Content.Server.PowerCell.Components
|
|||||||
|
|
||||||
public override bool IsEntityCompatible(IEntity entity)
|
public override bool IsEntityCompatible(IEntity entity)
|
||||||
{
|
{
|
||||||
return entity.HasComponent<BatteryComponent>();
|
return IoCManager.Resolve<IEntityManager>().HasComponent<BatteryComponent>(entity.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override BatteryComponent GetBatteryFrom(IEntity entity)
|
protected override BatteryComponent GetBatteryFrom(IEntity entity)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Content.Server.PowerCell
|
|||||||
!args.CanAccess ||
|
!args.CanAccess ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
component.HasCell ||
|
component.HasCell ||
|
||||||
!args.Using.HasComponent<PowerCellComponent>() ||
|
!IoCManager.Resolve<IEntityManager>().HasComponent<PowerCellComponent>(args.Using.Uid) ||
|
||||||
!_actionBlockerSystem.CanDrop(args.User.Uid))
|
!_actionBlockerSystem.CanDrop(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Content.Server.Projectiles
|
|||||||
var playerFilter = Filter.Pvs(coordinates);
|
var playerFilter = Filter.Pvs(coordinates);
|
||||||
|
|
||||||
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(otherEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(otherEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && component.SoundHitSpecies != null &&
|
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(otherEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(otherEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && component.SoundHitSpecies != null &&
|
||||||
otherEntity.HasComponent<SharedBodyComponent>())
|
IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(otherEntity.Uid))
|
||||||
{
|
{
|
||||||
SoundSystem.Play(playerFilter, component.SoundHitSpecies.GetSound(), coordinates);
|
SoundSystem.Play(playerFilter, component.SoundHitSpecies.GetSound(), coordinates);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Content.Server.Recycling
|
|||||||
private bool CanGib(RecyclerComponent component, IEntity entity)
|
private bool CanGib(RecyclerComponent component, IEntity entity)
|
||||||
{
|
{
|
||||||
// We suppose this entity has a Recyclable component.
|
// We suppose this entity has a Recyclable component.
|
||||||
return entity.HasComponent<SharedBodyComponent>() && !component.Safe &&
|
return IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity.Uid) && !component.Safe &&
|
||||||
component.Owner.TryGetComponent(out ApcPowerReceiverComponent? receiver) && receiver.Powered;
|
component.Owner.TryGetComponent(out ApcPowerReceiverComponent? receiver) && receiver.Powered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace Content.Server.Sandbox
|
|||||||
if (player.AttachedEntity.TryGetComponent(out InventoryComponent? inv)
|
if (player.AttachedEntity.TryGetComponent(out InventoryComponent? inv)
|
||||||
&& inv.TryGetSlotItem(Slots.IDCARD, out ItemComponent? wornItem))
|
&& inv.TryGetSlotItem(Slots.IDCARD, out ItemComponent? wornItem))
|
||||||
{
|
{
|
||||||
if (wornItem.Owner.HasComponent<AccessComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<AccessComponent>(wornItem.Owner.Uid))
|
||||||
{
|
{
|
||||||
UpgradeId(wornItem.Owner);
|
UpgradeId(wornItem.Owner);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.Shuttles.Components;
|
using Content.Server.Shuttles.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
|
|
||||||
namespace Content.Server.Shuttles.EntitySystems
|
namespace Content.Server.Shuttles.EntitySystems
|
||||||
@@ -56,7 +57,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
|||||||
|
|
||||||
private void OnShuttleStartup(EntityUid uid, ShuttleComponent component, ComponentStartup args)
|
private void OnShuttleStartup(EntityUid uid, ShuttleComponent component, ComponentStartup args)
|
||||||
{
|
{
|
||||||
if (!component.Owner.HasComponent<IMapGridComponent>())
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<IMapGridComponent>(component.Owner.Uid))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,10 +102,10 @@ namespace Content.Server.Singularity.EntitySystems
|
|||||||
private bool CanDestroy(SharedSingularityComponent component, IEntity entity)
|
private bool CanDestroy(SharedSingularityComponent component, IEntity entity)
|
||||||
{
|
{
|
||||||
return entity == component.Owner ||
|
return entity == component.Owner ||
|
||||||
entity.HasComponent<IMapGridComponent>() ||
|
IoCManager.Resolve<IEntityManager>().HasComponent<IMapGridComponent>(entity.Uid) ||
|
||||||
entity.HasComponent<GhostComponent>() ||
|
IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(entity.Uid) ||
|
||||||
entity.HasComponent<ContainmentFieldComponent>() ||
|
IoCManager.Resolve<IEntityManager>().HasComponent<ContainmentFieldComponent>(entity.Uid) ||
|
||||||
entity.HasComponent<ContainmentFieldGeneratorComponent>();
|
IoCManager.Resolve<IEntityManager>().HasComponent<ContainmentFieldGeneratorComponent>(entity.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleDestroy(ServerSingularityComponent component, IEntity entity)
|
private void HandleDestroy(ServerSingularityComponent component, IEntity entity)
|
||||||
@@ -149,9 +149,9 @@ namespace Content.Server.Singularity.EntitySystems
|
|||||||
|
|
||||||
private bool CanPull(IEntity entity)
|
private bool CanPull(IEntity entity)
|
||||||
{
|
{
|
||||||
return !(entity.HasComponent<GhostComponent>() ||
|
return !(IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(entity.Uid) ||
|
||||||
entity.HasComponent<IMapGridComponent>() ||
|
IoCManager.Resolve<IEntityManager>().HasComponent<IMapGridComponent>(entity.Uid) ||
|
||||||
entity.HasComponent<MapComponent>() ||
|
IoCManager.Resolve<IEntityManager>().HasComponent<MapComponent>(entity.Uid) ||
|
||||||
entity.IsInContainer());
|
entity.IsInContainer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ namespace Content.Server.Storage.Components
|
|||||||
return false;
|
return false;
|
||||||
Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) attacked by user (UID {eventArgs.User.Uid}) with entity (UID {eventArgs.Using.Uid}).");
|
Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) attacked by user (UID {eventArgs.User.Uid}) with entity (UID {eventArgs.Using.Uid}).");
|
||||||
|
|
||||||
if (Owner.HasComponent<PlaceableSurfaceComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<PlaceableSurfaceComponent>(Owner.Uid))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -570,14 +570,14 @@ namespace Content.Server.Storage.Components
|
|||||||
|
|
||||||
// Pick up all entities in a radius around the clicked location.
|
// Pick up all entities in a radius around the clicked location.
|
||||||
// The last half of the if is because carpets exist and this is terrible
|
// The last half of the if is because carpets exist and this is terrible
|
||||||
if (_areaInsert && (eventArgs.Target == null || !eventArgs.Target.HasComponent<SharedItemComponent>()))
|
if (_areaInsert && (eventArgs.Target == null || !IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(eventArgs.Target.Uid)))
|
||||||
{
|
{
|
||||||
var validStorables = new List<IEntity>();
|
var validStorables = new List<IEntity>();
|
||||||
foreach (var entity in IoCManager.Resolve<IEntityLookup>().GetEntitiesInRange(eventArgs.ClickLocation, _areaInsertRadius, LookupFlags.None))
|
foreach (var entity in IoCManager.Resolve<IEntityLookup>().GetEntitiesInRange(eventArgs.ClickLocation, _areaInsertRadius, LookupFlags.None))
|
||||||
{
|
{
|
||||||
if (entity.IsInContainer()
|
if (entity.IsInContainer()
|
||||||
|| entity == eventArgs.User
|
|| entity == eventArgs.User
|
||||||
|| !entity.HasComponent<SharedItemComponent>()
|
|| !IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(entity.Uid)
|
||||||
|| !EntitySystem.Get<InteractionSystem>().InRangeUnobstructed(eventArgs.User, entity))
|
|| !EntitySystem.Get<InteractionSystem>().InRangeUnobstructed(eventArgs.User, entity))
|
||||||
continue;
|
continue;
|
||||||
validStorables.Add(entity);
|
validStorables.Add(entity);
|
||||||
@@ -605,7 +605,7 @@ namespace Content.Server.Storage.Components
|
|||||||
// Check again, situation may have changed for some entities, but we'll still pick up any that are valid
|
// Check again, situation may have changed for some entities, but we'll still pick up any that are valid
|
||||||
if (entity.IsInContainer()
|
if (entity.IsInContainer()
|
||||||
|| entity == eventArgs.User
|
|| entity == eventArgs.User
|
||||||
|| !entity.HasComponent<SharedItemComponent>())
|
|| !IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(entity.Uid))
|
||||||
continue;
|
continue;
|
||||||
var position = EntityCoordinates.FromMap(Owner.Transform.Parent?.Owner ?? Owner, entity.Transform.MapPosition);
|
var position = EntityCoordinates.FromMap(Owner.Transform.Parent?.Owner ?? Owner, entity.Transform.MapPosition);
|
||||||
if (PlayerInsertEntityInWorld(eventArgs.User, entity))
|
if (PlayerInsertEntityInWorld(eventArgs.User, entity))
|
||||||
@@ -636,7 +636,7 @@ namespace Content.Server.Storage.Components
|
|||||||
if (eventArgs.Target == null
|
if (eventArgs.Target == null
|
||||||
|| eventArgs.Target.IsInContainer()
|
|| eventArgs.Target.IsInContainer()
|
||||||
|| eventArgs.Target == eventArgs.User
|
|| eventArgs.Target == eventArgs.User
|
||||||
|| !eventArgs.Target.HasComponent<SharedItemComponent>())
|
|| !IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(eventArgs.Target.Uid))
|
||||||
return false;
|
return false;
|
||||||
var position = EntityCoordinates.FromMap(Owner.Transform.Parent?.Owner ?? Owner, eventArgs.Target.Transform.MapPosition);
|
var position = EntityCoordinates.FromMap(Owner.Transform.Parent?.Owner ?? Owner, eventArgs.Target.Transform.MapPosition);
|
||||||
if (PlayerInsertEntityInWorld(eventArgs.User, eventArgs.Target))
|
if (PlayerInsertEntityInWorld(eventArgs.User, eventArgs.Target))
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ namespace Content.Server.Strip
|
|||||||
{
|
{
|
||||||
var owner = hands.GetItem(hand)?.Owner;
|
var owner = hands.GetItem(hand)?.Owner;
|
||||||
|
|
||||||
if (owner?.HasComponent<HandVirtualItemComponent>() ?? true)
|
if ((owner != null ? IoCManager.Resolve<IEntityManager>().HasComponent<HandVirtualItemComponent>(owner.Uid) : (bool?) null) ?? true)
|
||||||
{
|
{
|
||||||
dictionary[hand] = "None";
|
dictionary[hand] = "None";
|
||||||
continue;
|
continue;
|
||||||
@@ -359,7 +359,7 @@ namespace Content.Server.Strip
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (heldItem.Owner.HasComponent<HandVirtualItemComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<HandVirtualItemComponent>(heldItem.Owner.Uid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!hands.CanDrop(hand, false))
|
if (!hands.CanDrop(hand, false))
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ namespace Content.Server.Throwing
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.HasComponent<MobStateComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<MobStateComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
Logger.Warning("Throwing not supported for mobs!");
|
Logger.Warning("Throwing not supported for mobs!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var comp = entity.EnsureComponent<ThrownItemComponent>();
|
var comp = entity.EnsureComponent<ThrownItemComponent>();
|
||||||
if (entity.HasComponent<ItemComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(entity.Uid))
|
||||||
{
|
{
|
||||||
comp.Thrower = user;
|
comp.Thrower = user;
|
||||||
// Give it a l'il spin.
|
// Give it a l'il spin.
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ namespace Content.Server.Traitor.Uplink
|
|||||||
var heldItems = hands.GetAllHeldItems();
|
var heldItems = hands.GetAllHeldItems();
|
||||||
foreach (var item in heldItems)
|
foreach (var item in heldItems)
|
||||||
{
|
{
|
||||||
if (item.Owner.HasComponent<PDAComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<PDAComponent>(item.Owner.Uid))
|
||||||
return item.Owner;
|
return item.Owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
|||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (eventArgs.Using.HasComponent<AmmoComponent>())
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<AmmoComponent>(eventArgs.Using.Uid))
|
||||||
{
|
{
|
||||||
return TryInsertAmmo(eventArgs.User, eventArgs.Using);
|
return TryInsertAmmo(eventArgs.User, eventArgs.Using);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace Content.Server.Weapon.Ranged.Barrels
|
|||||||
!args.CanAccess ||
|
!args.CanAccess ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
component.PowerCell != null ||
|
component.PowerCell != null ||
|
||||||
!args.Using.HasComponent<BatteryComponent>() ||
|
!IoCManager.Resolve<IEntityManager>().HasComponent<BatteryComponent>(args.Using.Uid) ||
|
||||||
!_actionBlockerSystem.CanDrop(args.User.Uid))
|
!_actionBlockerSystem.CanDrop(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user