Inline EntityManager
This commit is contained in:
@@ -3,6 +3,7 @@ using Robust.Client.Animations;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.Animations;
|
using Robust.Shared.Animations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -13,7 +14,7 @@ namespace Content.Client.Animations
|
|||||||
{
|
{
|
||||||
public static void AnimateEntityPickup(IEntity entity, EntityCoordinates initialPosition, Vector2 finalPosition)
|
public static void AnimateEntityPickup(IEntity entity, EntityCoordinates initialPosition, Vector2 finalPosition)
|
||||||
{
|
{
|
||||||
var animatableClone = entity.EntityManager.SpawnEntity("clientsideclone", initialPosition);
|
var animatableClone = IoCManager.Resolve<IEntityManager>().SpawnEntity("clientsideclone", initialPosition);
|
||||||
animatableClone.Name = entity.Name;
|
animatableClone.Name = entity.Name;
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out SpriteComponent? sprite0))
|
if (!entity.TryGetComponent(out SpriteComponent? sprite0))
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Body.Components;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Client.Body.UI
|
namespace Content.Client.Body.UI
|
||||||
@@ -35,7 +36,7 @@ namespace Content.Client.Body.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Owner.Owner.EntityManager.TryGetEntity(scannerState.Uid, out _entity))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(scannerState.Uid, out _entity))
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner.Uid} at {Owner.Owner.Transform.MapPosition}");
|
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner.Uid} at {Owner.Owner.Transform.MapPosition}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Robust.Client.Graphics;
|
|||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
@@ -98,7 +99,7 @@ namespace Content.Client.Chat.UI
|
|||||||
_verticalOffsetAchieved = MathHelper.Lerp(_verticalOffsetAchieved, VerticalOffset, 10 * args.DeltaSeconds);
|
_verticalOffsetAchieved = MathHelper.Lerp(_verticalOffsetAchieved, VerticalOffset, 10 * args.DeltaSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_senderEntity.Transform.Coordinates.IsValid(_senderEntity.EntityManager))
|
if (!_senderEntity.Transform.Coordinates.IsValid(IoCManager.Resolve<IEntityManager>()))
|
||||||
{
|
{
|
||||||
Modulate = Color.White.WithAlpha(0);
|
Modulate = Color.White.WithAlpha(0);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using Content.Shared.Doors;
|
using Content.Shared.Doors;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||||
using DrawDepthTag = Robust.Shared.GameObjects.DrawDepth;
|
using DrawDepthTag = Robust.Shared.GameObjects.DrawDepth;
|
||||||
@@ -38,7 +39,7 @@ namespace Content.Client.Doors
|
|||||||
|
|
||||||
base.State = value;
|
base.State = value;
|
||||||
|
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new DoorStateChangedEvent(State), false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new DoorStateChangedEvent(State), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
// ensures lastposition initial value is populated on spawn. Just calling
|
// ensures lastposition initial value is populated on spawn. Just calling
|
||||||
// the hook here would cause a dirty event to fire needlessly
|
// the hook here would cause a dirty event to fire needlessly
|
||||||
UpdateLastPosition();
|
UpdateLastPosition();
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, null, Mode));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, null, Mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Sprite != null && Mode == IconSmoothingMode.Corners)
|
if (Sprite != null && Mode == IconSmoothingMode.Corners)
|
||||||
@@ -260,7 +260,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
|
|
||||||
if (Owner.Transform.Anchored)
|
if (Owner.Transform.Anchored)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
{
|
{
|
||||||
if (Owner.Transform.Anchored)
|
if (Owner.Transform.Anchored)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode));
|
||||||
UpdateLastPosition();
|
UpdateLastPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,7 +278,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
{
|
{
|
||||||
foreach (var entity in candidates)
|
foreach (var entity in candidates)
|
||||||
{
|
{
|
||||||
if (!Owner.EntityManager.TryGetComponent(entity, out IconSmoothComponent? other))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IconSmoothComponent? other))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Content.Client.Interactable.Components
|
|||||||
if (Owner.TryGetComponent(out ISpriteComponent? sprite))
|
if (Owner.TryGetComponent(out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
sprite.PostShader = MakeNewShader(inInteractionRange, renderScale);
|
sprite.PostShader = MakeNewShader(inInteractionRange, renderScale);
|
||||||
sprite.RenderOrder = Owner.EntityManager.CurrentTick.Value;
|
sprite.RenderOrder = IoCManager.Resolve<IEntityManager>().CurrentTick.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace Content.Client.Inventory
|
|||||||
|
|
||||||
foreach (var (slot, entityUid) in state.Entities)
|
foreach (var (slot, entityUid) in state.Entities)
|
||||||
{
|
{
|
||||||
if (!Owner.EntityManager.TryGetEntity(entityUid, out var entity))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(entityUid, out var entity))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ namespace Content.Client.Inventory
|
|||||||
if (state.HoverEntity != null)
|
if (state.HoverEntity != null)
|
||||||
{
|
{
|
||||||
var (slot, (entityUid, fits)) = state.HoverEntity.Value;
|
var (slot, (entityUid, fits)) = state.HoverEntity.Value;
|
||||||
var entity = Owner.EntityManager.GetEntity(entityUid);
|
var entity = IoCManager.Resolve<IEntityManager>().GetEntity(entityUid);
|
||||||
|
|
||||||
InterfaceController?.HoverInSlot(slot, entity, fits);
|
InterfaceController?.HoverInSlot(slot, entity, fits);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ namespace Content.Client.Items.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
var collectMsg = new ItemStatusCollectMessage();
|
var collectMsg = new ItemStatusCollectMessage();
|
||||||
_entity.EntityManager.EventBus.RaiseLocalEvent(_entity.Uid, collectMsg);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(_entity.Uid, collectMsg);
|
||||||
|
|
||||||
foreach (var control in collectMsg.Controls)
|
foreach (var control in collectMsg.Controls)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Spawners
|
namespace Content.Client.Spawners
|
||||||
@@ -32,7 +33,7 @@ namespace Content.Client.Spawners
|
|||||||
{
|
{
|
||||||
foreach (var proto in _prototypes)
|
foreach (var proto in _prototypes)
|
||||||
{
|
{
|
||||||
var entity = Owner.EntityManager.SpawnEntity(proto, Owner.Transform.Coordinates);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(proto, Owner.Transform.Coordinates);
|
||||||
_entity.Add(entity);
|
_entity.Add(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,7 +42,7 @@ namespace Content.Client.Spawners
|
|||||||
{
|
{
|
||||||
foreach (var entity in _entity)
|
foreach (var entity in _entity)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.DeleteEntity(entity);
|
IoCManager.Resolve<IEntityManager>().DeleteEntity(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace Content.Client.Storage
|
|||||||
}
|
}
|
||||||
|
|
||||||
_storedEntities = state.StoredEntities
|
_storedEntities = state.StoredEntities
|
||||||
.Select(id => Owner.EntityManager.GetEntity(id))
|
.Select(id => IoCManager.Resolve<IEntityManager>().GetEntity(id))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ namespace Content.Client.Storage
|
|||||||
/// <param name="storageState"></param>
|
/// <param name="storageState"></param>
|
||||||
private void HandleStorageMessage(StorageHeldItemsMessage storageState)
|
private void HandleStorageMessage(StorageHeldItemsMessage storageState)
|
||||||
{
|
{
|
||||||
_storedEntities = storageState.StoredEntities.Select(id => Owner.EntityManager.GetEntity(id)).ToList();
|
_storedEntities = storageState.StoredEntities.Select(id => IoCManager.Resolve<IEntityManager>().GetEntity(id)).ToList();
|
||||||
StorageSizeUsed = storageState.StorageSizeUsed;
|
StorageSizeUsed = storageState.StorageSizeUsed;
|
||||||
StorageCapacityMax = storageState.StorageSizeMax;
|
StorageCapacityMax = storageState.StorageSizeMax;
|
||||||
_window?.BuildEntityList(storageState.StoredEntities.ToList());
|
_window?.BuildEntityList(storageState.StoredEntities.ToList());
|
||||||
@@ -118,7 +118,7 @@ namespace Content.Client.Storage
|
|||||||
var entityId = msg.StoredEntities[i];
|
var entityId = msg.StoredEntities[i];
|
||||||
var initialPosition = msg.EntityPositions[i];
|
var initialPosition = msg.EntityPositions[i];
|
||||||
|
|
||||||
if (Owner.EntityManager.TryGetEntity(entityId, out var entity))
|
if (IoCManager.Resolve<IEntityManager>().TryGetEntity(entityId, out var entity))
|
||||||
{
|
{
|
||||||
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, Owner.Transform.LocalPosition);
|
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, Owner.Transform.LocalPosition);
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ namespace Content.Client.Storage
|
|||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
buttonEventArgs.Event.Handle();
|
buttonEventArgs.Event.Handle();
|
||||||
}
|
}
|
||||||
else if (Owner.EntityManager.TryGetEntity(entityUid, out var entity))
|
else if (IoCManager.Resolve<IEntityManager>().TryGetEntity(entityUid, out var entity))
|
||||||
{
|
{
|
||||||
_itemSlotManager.OnButtonPressed(buttonEventArgs.Event, entity);
|
_itemSlotManager.OnButtonPressed(buttonEventArgs.Event, entity);
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ namespace Content.Client.Storage
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void GenerateButton(EntityUid entityUid, EntityContainerButton button)
|
private void GenerateButton(EntityUid entityUid, EntityContainerButton button)
|
||||||
{
|
{
|
||||||
if (!Owner.EntityManager.TryGetEntity(entityUid, out var entity))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(entityUid, out var entity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entity.TryGetComponent(out ISpriteComponent? sprite);
|
entity.TryGetComponent(out ISpriteComponent? sprite);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace Content.Client.Suspicion
|
|||||||
}
|
}
|
||||||
|
|
||||||
_overlayActive = true;
|
_overlayActive = true;
|
||||||
var overlay = new TraitorOverlay(Owner.EntityManager, _resourceCache, _eyeManager);
|
var overlay = new TraitorOverlay(IoCManager.Resolve<IEntityManager>(), _resourceCache, _eyeManager);
|
||||||
_overlayManager.AddOverlay(overlay);
|
_overlayManager.AddOverlay(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Content.Client.Wall.Components
|
|||||||
{
|
{
|
||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
_overlayEntity = Owner.EntityManager.SpawnEntity("LowWallOverlay", Owner.Transform.Coordinates);
|
_overlayEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity("LowWallOverlay", Owner.Transform.Coordinates);
|
||||||
_overlayEntity.Transform.AttachParent(Owner);
|
_overlayEntity.Transform.AttachParent(Owner);
|
||||||
_overlayEntity.Transform.LocalPosition = Vector2.Zero;
|
_overlayEntity.Transform.LocalPosition = Vector2.Zero;
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ namespace Content.Client.Wall.Components
|
|||||||
|
|
||||||
foreach (var entity in grid.GetLocal(coords))
|
foreach (var entity in grid.GetLocal(coords))
|
||||||
{
|
{
|
||||||
if (Owner.EntityManager.TryGetComponent(entity, out WindowComponent? window))
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out WindowComponent? window))
|
||||||
{
|
{
|
||||||
//window.UpdateSprite();
|
//window.UpdateSprite();
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ namespace Content.Client.Wall.Components
|
|||||||
{
|
{
|
||||||
foreach (var entity in candidates)
|
foreach (var entity in candidates)
|
||||||
{
|
{
|
||||||
if (!Owner.EntityManager.TryGetComponent(entity, out IconSmoothComponent? other))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IconSmoothComponent? other))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace Content.Server.AI.Utility.AiLogic
|
|||||||
{
|
{
|
||||||
var behaviorManager = IoCManager.Resolve<INpcBehaviorManager>();
|
var behaviorManager = IoCManager.Resolve<INpcBehaviorManager>();
|
||||||
behaviorManager.RebuildActions(this);
|
behaviorManager.RebuildActions(this);
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new SleepAiMessage(this, false));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new SleepAiMessage(this, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Content.Server.AME
|
|||||||
if (nodeOwner.TryGetComponent(out AMEShieldComponent? shield))
|
if (nodeOwner.TryGetComponent(out AMEShieldComponent? shield))
|
||||||
{
|
{
|
||||||
var nodeNeighbors = grid.GetCellsInSquareArea(nodeOwner.Transform.Coordinates, 1)
|
var nodeNeighbors = grid.GetCellsInSquareArea(nodeOwner.Transform.Coordinates, 1)
|
||||||
.Select(sgc => nodeOwner.EntityManager.GetEntity(sgc))
|
.Select(sgc => IoCManager.Resolve<IEntityManager>().GetEntity(sgc))
|
||||||
.Where(entity => entity != nodeOwner && entity.HasComponent<AMEShieldComponent>());
|
.Where(entity => entity != nodeOwner && entity.HasComponent<AMEShieldComponent>());
|
||||||
|
|
||||||
if (nodeNeighbors.Count() >= 8)
|
if (nodeNeighbors.Count() >= 8)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Content.Server.Actions.Actions
|
|||||||
foreach (var ent in ents)
|
foreach (var ent in ents)
|
||||||
{
|
{
|
||||||
var ghostBoo = new GhostBooEvent();
|
var ghostBoo = new GhostBooEvent();
|
||||||
ent.EntityManager.EventBus.RaiseLocalEvent(ent.Uid, ghostBoo);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(ent.Uid, ghostBoo);
|
||||||
|
|
||||||
if (ghostBoo.Handled)
|
if (ghostBoo.Handled)
|
||||||
booCounter++;
|
booCounter++;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Content.Server.Actions.Spells
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Look this is shitty and ideally a test would do it
|
// TODO: Look this is shitty and ideally a test would do it
|
||||||
var spawnedProto = caster.EntityManager.SpawnEntity(ItemProto, caster.Transform.MapPosition);
|
var spawnedProto = IoCManager.Resolve<IEntityManager>().SpawnEntity(ItemProto, caster.Transform.MapPosition);
|
||||||
|
|
||||||
if (!spawnedProto.TryGetComponent(out ItemComponent? itemComponent))
|
if (!spawnedProto.TryGetComponent(out ItemComponent? itemComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.Popups;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
@@ -174,7 +175,7 @@ namespace Content.Server.Atmos.Components
|
|||||||
if (!_checkPlayer && _position.HasValue)
|
if (!_checkPlayer && _position.HasValue)
|
||||||
{
|
{
|
||||||
// Check if position is out of range => don't update
|
// Check if position is out of range => don't update
|
||||||
if (!_position.Value.InRange(Owner.EntityManager, pos, SharedInteractionSystem.InteractionRange))
|
if (!_position.Value.InRange(IoCManager.Resolve<IEntityManager>(), pos, SharedInteractionSystem.InteractionRange))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pos = _position.Value;
|
pos = _position.Value;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.Sound;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -57,7 +58,7 @@ namespace Content.Server.Body.Components
|
|||||||
{
|
{
|
||||||
// Using MapPosition instead of Coordinates here prevents
|
// Using MapPosition instead of Coordinates here prevents
|
||||||
// a crash within the character preview menu in the lobby
|
// a crash within the character preview menu in the lobby
|
||||||
var entity = Owner.EntityManager.SpawnEntity(preset.PartIDs[slot.Id], Owner.Transform.MapPosition);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(preset.PartIDs[slot.Id], Owner.Transform.MapPosition);
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out SharedBodyPartComponent? part))
|
if (!entity.TryGetComponent(out SharedBodyPartComponent? part))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Content.Server.Body.Components
|
|||||||
// identical on it
|
// identical on it
|
||||||
foreach (var mechanismId in MechanismIds)
|
foreach (var mechanismId in MechanismIds)
|
||||||
{
|
{
|
||||||
var entity = Owner.EntityManager.SpawnEntity(mechanismId, Owner.Transform.MapPosition);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(mechanismId, Owner.Transform.MapPosition);
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out SharedMechanismComponent? mechanism))
|
if (!entity.TryGetComponent(out SharedMechanismComponent? mechanism))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Content.Shared.Popups;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -159,7 +160,7 @@ namespace Content.Server.Body.Surgery.Components
|
|||||||
#pragma warning disable 618
|
#pragma warning disable 618
|
||||||
SendMessage(message);
|
SendMessage(message);
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, message);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSurgeryUIBodyPartRequest(IPlayerSession session, Dictionary<string, int> options)
|
private void UpdateSurgeryUIBodyPartRequest(IPlayerSession session, Dictionary<string, int> options)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Interaction.Events;
|
|||||||
using Content.Shared.Random.Helpers;
|
using Content.Shared.Random.Helpers;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Botany.Components
|
namespace Content.Server.Botany.Components
|
||||||
{
|
{
|
||||||
@@ -22,7 +23,7 @@ namespace Content.Server.Botany.Components
|
|||||||
{
|
{
|
||||||
for (var i = 0; i < 2; i++)
|
for (var i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
var plank = Owner.EntityManager.SpawnEntity("MaterialWoodPlank1", Owner.Transform.Coordinates);
|
var plank = IoCManager.Resolve<IEntityManager>().SpawnEntity("MaterialWoodPlank1", Owner.Transform.Coordinates);
|
||||||
plank.RandomOffset(0.25f);
|
plank.RandomOffset(0.25f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Content.Server.Botany.Components
|
|||||||
|
|
||||||
for (var i = 0; i < random; i++)
|
for (var i = 0; i < random; i++)
|
||||||
{
|
{
|
||||||
produce.Seed.SpawnSeedPacket(Owner.Transform.Coordinates, Owner.EntityManager);
|
produce.Seed.SpawnSeedPacket(Owner.Transform.Coordinates, IoCManager.Resolve<IEntityManager>());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ namespace Content.Server.Buckle.Components
|
|||||||
EntitySystem.Get<StandingStateSystem>().Stand(Owner.Uid);
|
EntitySystem.Get<StandingStateSystem>().Stand(Owner.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
_mobState?.CurrentState?.EnterState(Owner.Uid, Owner.EntityManager);
|
_mobState?.CurrentState?.EnterState(Owner.Uid, IoCManager.Resolve<IEntityManager>());
|
||||||
|
|
||||||
UpdateBuckleStatus();
|
UpdateBuckleStatus();
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ namespace Content.Server.Cargo.Components
|
|||||||
// TODO replace with shuttle code
|
// TODO replace with shuttle code
|
||||||
// TEMPORARY loop for spawning stuff on telepad (looks for a telepad adjacent to the console)
|
// TEMPORARY loop for spawning stuff on telepad (looks for a telepad adjacent to the console)
|
||||||
IEntity? cargoTelepad = null;
|
IEntity? cargoTelepad = null;
|
||||||
var indices = Owner.Transform.Coordinates.ToVector2i(Owner.EntityManager, _mapManager);
|
var indices = Owner.Transform.Coordinates.ToVector2i(IoCManager.Resolve<IEntityManager>(), _mapManager);
|
||||||
var offsets = new Vector2i[] { new Vector2i(0, 1), new Vector2i(1, 1), new Vector2i(1, 0), new Vector2i(1, -1),
|
var offsets = new Vector2i[] { new Vector2i(0, 1), new Vector2i(1, 1), new Vector2i(1, 0), new Vector2i(1, -1),
|
||||||
new Vector2i(0, -1), new Vector2i(-1, -1), new Vector2i(-1, 0), new Vector2i(-1, 1), };
|
new Vector2i(0, -1), new Vector2i(-1, -1), new Vector2i(-1, 0), new Vector2i(-1, 1), };
|
||||||
var adjacentEntities = new List<IEnumerable<IEntity>>(); //Probably better than IEnumerable.concat
|
var adjacentEntities = new List<IEnumerable<IEntity>>(); //Probably better than IEnumerable.concat
|
||||||
|
|||||||
@@ -119,13 +119,13 @@ namespace Content.Server.Cargo.Components
|
|||||||
if (!_prototypeManager.TryIndex(data.ProductId, out CargoProductPrototype? prototype))
|
if (!_prototypeManager.TryIndex(data.ProductId, out CargoProductPrototype? prototype))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var product = Owner.EntityManager.SpawnEntity(prototype.Product, Owner.Transform.Coordinates);
|
var product = IoCManager.Resolve<IEntityManager>().SpawnEntity(prototype.Product, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
product.Transform.Anchored = false;
|
product.Transform.Anchored = false;
|
||||||
|
|
||||||
// spawn a piece of paper.
|
// spawn a piece of paper.
|
||||||
var printed = Owner.EntityManager.SpawnEntity(PrinterOutput, Owner.Transform.Coordinates);
|
var printed = IoCManager.Resolve<IEntityManager>().SpawnEntity(PrinterOutput, Owner.Transform.Coordinates);
|
||||||
if (!Owner.EntityManager.TryGetComponent(printed.Uid, out PaperComponent paper))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(printed.Uid, out PaperComponent paper))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// fill in the order data
|
// fill in the order data
|
||||||
@@ -138,7 +138,7 @@ namespace Content.Server.Cargo.Components
|
|||||||
("approver", data.Approver)));
|
("approver", data.Approver)));
|
||||||
|
|
||||||
// attempt to attach the label
|
// attempt to attach the label
|
||||||
if (Owner.EntityManager.TryGetComponent(product.Uid, out PaperLabelComponent label))
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(product.Uid, out PaperLabelComponent label))
|
||||||
{
|
{
|
||||||
EntitySystem.Get<ItemSlotsSystem>().TryInsert(OwnerUid, label.LabelSlot, printed);
|
EntitySystem.Get<ItemSlotsSystem>().TryInsert(OwnerUid, label.LabelSlot, printed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ using Robust.Shared.Serialization.Manager.Attributes;
|
|||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Content.Server.Labels.Components;
|
using Content.Server.Labels.Components;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.Components
|
namespace Content.Server.Chemistry.Components
|
||||||
{
|
{
|
||||||
@@ -71,7 +72,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
if (UserInterface != null)
|
if (UserInterface != null)
|
||||||
{
|
{
|
||||||
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
|
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
|
||||||
@@ -257,7 +258,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
{
|
{
|
||||||
actualAmount = FixedPoint2.Min(reagent.Quantity, amount);
|
actualAmount = FixedPoint2.Min(reagent.Quantity, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntitySystem.Get<SolutionContainerSystem>().TryRemoveReagent(beaker.Uid, beakerSolution, id, actualAmount);
|
EntitySystem.Get<SolutionContainerSystem>().TryRemoveReagent(beaker.Uid, beakerSolution, id, actualAmount);
|
||||||
BufferSolution.AddReagent(id, actualAmount);
|
BufferSolution.AddReagent(id, actualAmount);
|
||||||
break;
|
break;
|
||||||
@@ -301,7 +302,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(30));
|
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(30));
|
||||||
for (int i = 0; i < bottleAmount; i++)
|
for (int i = 0; i < bottleAmount; i++)
|
||||||
{
|
{
|
||||||
var bottle = Owner.EntityManager.SpawnEntity("ChemistryEmptyBottle01", Owner.Transform.Coordinates);
|
var bottle = IoCManager.Resolve<IEntityManager>().SpawnEntity("ChemistryEmptyBottle01", Owner.Transform.Coordinates);
|
||||||
|
|
||||||
//Adding label
|
//Adding label
|
||||||
LabelComponent labelComponent = bottle.EnsureComponent<LabelComponent>();
|
LabelComponent labelComponent = bottle.EnsureComponent<LabelComponent>();
|
||||||
@@ -343,7 +344,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(50));
|
var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(50));
|
||||||
for (int i = 0; i < pillAmount; i++)
|
for (int i = 0; i < pillAmount; i++)
|
||||||
{
|
{
|
||||||
var pill = Owner.EntityManager.SpawnEntity("pill", Owner.Transform.Coordinates);
|
var pill = IoCManager.Resolve<IEntityManager>().SpawnEntity("pill", Owner.Transform.Coordinates);
|
||||||
|
|
||||||
//Adding label
|
//Adding label
|
||||||
LabelComponent labelComponent = pill.EnsureComponent<LabelComponent>();
|
LabelComponent labelComponent = pill.EnsureComponent<LabelComponent>();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.FixedPoint;
|
|||||||
using Content.Shared.Foam;
|
using Content.Shared.Foam;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.Components
|
namespace Content.Server.Chemistry.Components
|
||||||
@@ -78,7 +79,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(_foamedMetalPrototype))
|
if (!string.IsNullOrEmpty(_foamedMetalPrototype))
|
||||||
{
|
{
|
||||||
Owner.EntityManager.SpawnEntity(_foamedMetalPrototype, Owner.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(_foamedMetalPrototype, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.QueueDelete();
|
Owner.QueueDelete();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
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;
|
||||||
@@ -124,7 +125,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
|
|
||||||
public override ComponentState GetComponentState()
|
public override ComponentState GetComponentState()
|
||||||
{
|
{
|
||||||
var solutionSys = Owner.EntityManager.EntitySysManager.GetEntitySystem<SolutionContainerSystem>();
|
var solutionSys = IoCManager.Resolve<IEntityManager>().EntitySysManager.GetEntitySystem<SolutionContainerSystem>();
|
||||||
return solutionSys.TryGetSolution(Owner.Uid, SolutionName, out var solution)
|
return solutionSys.TryGetSolution(Owner.Uid, SolutionName, out var solution)
|
||||||
? new HyposprayComponentState(solution.CurrentVolume, solution.MaxVolume)
|
? new HyposprayComponentState(solution.CurrentVolume, solution.MaxVolume)
|
||||||
: new HyposprayComponentState(FixedPoint2.Zero, FixedPoint2.Zero);
|
: new HyposprayComponentState(FixedPoint2.Zero, FixedPoint2.Zero);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Interaction.Helpers;
|
using Content.Shared.Interaction.Helpers;
|
||||||
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 Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -303,7 +304,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
|
|
||||||
public override ComponentState GetComponentState()
|
public override ComponentState GetComponentState()
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EntitySysManager.GetEntitySystem<SolutionContainerSystem>()
|
IoCManager.Resolve<IEntityManager>().EntitySysManager.GetEntitySystem<SolutionContainerSystem>()
|
||||||
.TryGetSolution(Owner.Uid, SolutionName, out var solution);
|
.TryGetSolution(Owner.Uid, SolutionName, out var solution);
|
||||||
|
|
||||||
var currentVolume = solution?.CurrentVolume ?? FixedPoint2.Zero;
|
var currentVolume = solution?.CurrentVolume ?? FixedPoint2.Zero;
|
||||||
|
|||||||
@@ -74,16 +74,16 @@ namespace Content.Server.Chemistry.Components
|
|||||||
var coords = Owner.Transform.Coordinates;
|
var coords = Owner.Transform.Coordinates;
|
||||||
foreach (var neighbor in grid.GetInDir(coords, dir))
|
foreach (var neighbor in grid.GetInDir(coords, dir))
|
||||||
{
|
{
|
||||||
if (Owner.EntityManager.TryGetComponent(neighbor,
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(neighbor,
|
||||||
out SolutionAreaEffectComponent? comp) && comp.Inception == Inception)
|
out SolutionAreaEffectComponent? comp) && comp.Inception == Inception)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Owner.EntityManager.TryGetComponent(neighbor,
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(neighbor,
|
||||||
out AirtightComponent? airtight) && airtight.AirBlocked)
|
out AirtightComponent? airtight) && airtight.AirBlocked)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newEffect = Owner.EntityManager.SpawnEntity(Owner.Prototype.ID, grid.DirectionToGrid(coords, dir));
|
var newEffect = IoCManager.Resolve<IEntityManager>().SpawnEntity(Owner.Prototype.ID, grid.DirectionToGrid(coords, dir));
|
||||||
|
|
||||||
if (!newEffect.TryGetComponent(out SolutionAreaEffectComponent? effectComponent))
|
if (!newEffect.TryGetComponent(out SolutionAreaEffectComponent? effectComponent))
|
||||||
{
|
{
|
||||||
@@ -133,7 +133,7 @@ namespace Content.Server.Chemistry.Components
|
|||||||
|
|
||||||
var chemistry = EntitySystem.Get<ReactiveSystem>();
|
var chemistry = EntitySystem.Get<ReactiveSystem>();
|
||||||
var mapGrid = MapManager.GetGrid(Owner.Transform.GridID);
|
var mapGrid = MapManager.GetGrid(Owner.Transform.GridID);
|
||||||
var tile = mapGrid.GetTileRef(Owner.Transform.Coordinates.ToVector2i(Owner.EntityManager, MapManager));
|
var tile = mapGrid.GetTileRef(Owner.Transform.Coordinates.ToVector2i(IoCManager.Resolve<IEntityManager>(), MapManager));
|
||||||
|
|
||||||
var solutionFraction = 1 / Math.Floor(averageExposures);
|
var solutionFraction = 1 / Math.Floor(averageExposures);
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||||||
owner.PopupMessageEveryone(Loc.GetString("rehydratable-component-expands-message", ("owner", owner)));
|
owner.PopupMessageEveryone(Loc.GetString("rehydratable-component-expands-message", ("owner", owner)));
|
||||||
if (!string.IsNullOrEmpty(component.TargetPrototype))
|
if (!string.IsNullOrEmpty(component.TargetPrototype))
|
||||||
{
|
{
|
||||||
var ent = component.Owner.EntityManager.SpawnEntity(component.TargetPrototype,
|
var ent = IoCManager.Resolve<IEntityManager>().SpawnEntity(component.TargetPrototype,
|
||||||
owner.Transform.Coordinates);
|
owner.Transform.Coordinates);
|
||||||
ent.Transform.AttachToGridOrMap();
|
ent.Transform.AttachToGridOrMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace Content.Server.Cloning.Components
|
|||||||
|
|
||||||
if (cloningSystem.ClonesWaitingForMind.TryGetValue(mind, out var cloneUid))
|
if (cloningSystem.ClonesWaitingForMind.TryGetValue(mind, out var cloneUid))
|
||||||
{
|
{
|
||||||
if (Owner.EntityManager.TryGetEntity(cloneUid, out var clone) &&
|
if (IoCManager.Resolve<IEntityManager>().TryGetEntity(cloneUid, out var clone) &&
|
||||||
clone.TryGetComponent<MobStateComponent>(out var cloneState) &&
|
clone.TryGetComponent<MobStateComponent>(out var cloneState) &&
|
||||||
!cloneState.IsDead() &&
|
!cloneState.IsDead() &&
|
||||||
clone.TryGetComponent(out MindComponent? cloneMindComp) &&
|
clone.TryGetComponent(out MindComponent? cloneMindComp) &&
|
||||||
@@ -135,7 +135,7 @@ namespace Content.Server.Cloning.Components
|
|||||||
return; // If we can't track down the client, we can't offer transfer. That'd be quite bad.
|
return; // If we can't track down the client, we can't offer transfer. That'd be quite bad.
|
||||||
}
|
}
|
||||||
|
|
||||||
var mob = Owner.EntityManager.SpawnEntity("MobHuman", Owner.Transform.MapPosition);
|
var mob = IoCManager.Resolve<IEntityManager>().SpawnEntity("MobHuman", Owner.Transform.MapPosition);
|
||||||
|
|
||||||
|
|
||||||
EntitySystem.Get<SharedHumanoidAppearanceSystem>().UpdateFromProfile(mob.Uid, dna.Profile);
|
EntitySystem.Get<SharedHumanoidAppearanceSystem>().UpdateFromProfile(mob.Uid, dna.Profile);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.Power.Components;
|
|||||||
using Content.Shared.Computer;
|
using Content.Shared.Computer;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -78,7 +79,7 @@ namespace Content.Server.Computer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var board = Owner.EntityManager.SpawnEntity(_boardPrototype, Owner.Transform.Coordinates);
|
var board = IoCManager.Resolve<IEntityManager>().SpawnEntity(_boardPrototype, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if(!container.Insert(board))
|
if(!container.Insert(board))
|
||||||
Logger.Warning($"Couldn't insert board {board} to computer {Owner}!");
|
Logger.Warning($"Couldn't insert board {board} to computer {Owner}!");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using Content.Server.Stack;
|
using Content.Server.Stack;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Construction.Components
|
namespace Content.Server.Construction.Components
|
||||||
@@ -52,7 +53,7 @@ namespace Content.Server.Construction.Components
|
|||||||
if (string.IsNullOrEmpty(BoardPrototype))
|
if (string.IsNullOrEmpty(BoardPrototype))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var entityManager = Owner.EntityManager;
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
if (existedBoard || existedParts)
|
if (existedBoard || existedParts)
|
||||||
{
|
{
|
||||||
@@ -88,7 +89,7 @@ namespace Content.Server.Construction.Components
|
|||||||
{
|
{
|
||||||
var stack = EntitySystem.Get<StackSystem>().Spawn(amount, stackType, Owner.Transform.Coordinates);
|
var stack = EntitySystem.Get<StackSystem>().Spawn(amount, stackType, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if (!partContainer.Insert(Owner.EntityManager.GetEntity(stack)))
|
if (!partContainer.Insert(IoCManager.Resolve<IEntityManager>().GetEntity(stack)))
|
||||||
throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {Owner.Prototype?.ID ?? "N/A"}");
|
throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {Owner.Prototype?.ID ?? "N/A"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ namespace Content.Server.Construction.Components
|
|||||||
if (splitStack == null)
|
if (splitStack == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!_partContainer.Insert(Owner.EntityManager.GetEntity(splitStack.Value)))
|
if(!_partContainer.Insert(IoCManager.Resolve<IEntityManager>().GetEntity(splitStack.Value)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_materialProgress[type] += needed;
|
_materialProgress[type] += needed;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.Stacks;
|
|||||||
using Content.Shared.Tools;
|
using Content.Shared.Tools;
|
||||||
using Content.Shared.Tools.Components;
|
using Content.Shared.Tools.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -65,7 +66,7 @@ namespace Content.Server.Construction.Components
|
|||||||
// spawn each result after refine
|
// spawn each result after refine
|
||||||
foreach (var result in _refineResult!)
|
foreach (var result in _refineResult!)
|
||||||
{
|
{
|
||||||
var droppedEnt = Owner.EntityManager.SpawnEntity(result, resultPosition);
|
var droppedEnt = IoCManager.Resolve<IEntityManager>().SpawnEntity(result, resultPosition);
|
||||||
|
|
||||||
// TODO: If something has a stack... Just use a prototype with a single thing in the stack.
|
// TODO: If something has a stack... Just use a prototype with a single thing in the stack.
|
||||||
// This is not a good way to do it.
|
// This is not a good way to do it.
|
||||||
|
|||||||
@@ -125,13 +125,13 @@ namespace Content.Server.Crayon
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eventArgs.ClickLocation.IsValid(Owner.EntityManager))
|
if (!eventArgs.ClickLocation.IsValid(IoCManager.Resolve<IEntityManager>()))
|
||||||
{
|
{
|
||||||
eventArgs.User.PopupMessage(Loc.GetString("crayon-interact-invalid-location"));
|
eventArgs.User.PopupMessage(Loc.GetString("crayon-interact-invalid-location"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = Owner.EntityManager.SpawnEntity("CrayonDecal", eventArgs.ClickLocation);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity("CrayonDecal", eventArgs.ClickLocation);
|
||||||
if (entity.TryGetComponent(out AppearanceComponent? appearance))
|
if (entity.TryGetComponent(out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
appearance.SetData(CrayonVisuals.State, SelectedState);
|
appearance.SetData(CrayonVisuals.State, SelectedState);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
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.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -207,7 +208,7 @@ namespace Content.Server.Cuffs.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
var attempt = new UncuffAttemptEvent(user.Uid, Owner.Uid);
|
var attempt = new UncuffAttemptEvent(user.Uid, Owner.Uid);
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(user.Uid, attempt);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(user.Uid, attempt);
|
||||||
|
|
||||||
if (attempt.Cancelled)
|
if (attempt.Cancelled)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
|
|
||||||
public bool TryInsert(DisposalUnitComponent from)
|
public bool TryInsert(DisposalUnitComponent from)
|
||||||
{
|
{
|
||||||
var holder = Owner.EntityManager.SpawnEntity(HolderPrototypeId, Owner.Transform.MapPosition);
|
var holder = IoCManager.Resolve<IEntityManager>().SpawnEntity(HolderPrototypeId, Owner.Transform.MapPosition);
|
||||||
var holderComponent = holder.GetComponent<DisposalHolderComponent>();
|
var holderComponent = holder.GetComponent<DisposalHolderComponent>();
|
||||||
|
|
||||||
foreach (var entity in from.ContainedEntities.ToArray())
|
foreach (var entity in from.ContainedEntities.ToArray())
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.Doors;
|
|||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -175,7 +176,7 @@ namespace Content.Server.Doors.Components
|
|||||||
_boltLightsWirePulsed ? StatusLightState.On : StatusLightState.Off, "BLTL");
|
_boltLightsWirePulsed ? StatusLightState.On : StatusLightState.Off, "BLTL");
|
||||||
|
|
||||||
var ev = new DoorGetCloseTimeModifierEvent();
|
var ev = new DoorGetCloseTimeModifierEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
||||||
|
|
||||||
var timingStatus =
|
var timingStatus =
|
||||||
new StatusLightData(Color.Orange, !AutoClose ? StatusLightState.Off :
|
new StatusLightData(Color.Orange, !AutoClose ? StatusLightState.Off :
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using Content.Shared.Tools;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -77,7 +78,7 @@ namespace Content.Server.Doors.Components
|
|||||||
_ => throw new ArgumentOutOfRangeException(),
|
_ => throw new ArgumentOutOfRangeException(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new DoorStateChangedEvent(State), false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new DoorStateChangedEvent(State), false);
|
||||||
_autoCloseCancelTokenSource?.Cancel();
|
_autoCloseCancelTokenSource?.Cancel();
|
||||||
|
|
||||||
Dirty();
|
Dirty();
|
||||||
@@ -257,7 +258,7 @@ namespace Content.Server.Doors.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
DoorClickShouldActivateEvent ev = new DoorClickShouldActivateEvent(eventArgs);
|
DoorClickShouldActivateEvent ev = new DoorClickShouldActivateEvent(eventArgs);
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
||||||
if (ev.Handled)
|
if (ev.Handled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -276,7 +277,7 @@ namespace Content.Server.Doors.Components
|
|||||||
public void TryOpen(IEntity? user=null)
|
public void TryOpen(IEntity? user=null)
|
||||||
{
|
{
|
||||||
var msg = new DoorOpenAttemptEvent();
|
var msg = new DoorOpenAttemptEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, msg);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, msg);
|
||||||
|
|
||||||
if (msg.Cancelled) return;
|
if (msg.Cancelled) return;
|
||||||
|
|
||||||
@@ -354,7 +355,7 @@ namespace Content.Server.Doors.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ev = new BeforeDoorOpenedEvent();
|
var ev = new BeforeDoorOpenedEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
||||||
return !ev.Cancelled;
|
return !ev.Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +403,7 @@ namespace Content.Server.Doors.Components
|
|||||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QuickOpen(bool refresh)
|
private void QuickOpen(bool refresh)
|
||||||
@@ -424,7 +425,7 @@ namespace Content.Server.Doors.Components
|
|||||||
public void TryClose(IEntity? user=null)
|
public void TryClose(IEntity? user=null)
|
||||||
{
|
{
|
||||||
var msg = new DoorCloseAttemptEvent();
|
var msg = new DoorCloseAttemptEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, msg);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, msg);
|
||||||
|
|
||||||
if (msg.Cancelled) return;
|
if (msg.Cancelled) return;
|
||||||
|
|
||||||
@@ -460,7 +461,7 @@ namespace Content.Server.Doors.Components
|
|||||||
public bool CanCloseGeneric()
|
public bool CanCloseGeneric()
|
||||||
{
|
{
|
||||||
var ev = new BeforeDoorClosedEvent();
|
var ev = new BeforeDoorClosedEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
||||||
if (ev.Cancelled)
|
if (ev.Cancelled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -470,7 +471,7 @@ namespace Content.Server.Doors.Components
|
|||||||
private bool SafetyCheck()
|
private bool SafetyCheck()
|
||||||
{
|
{
|
||||||
var ev = new DoorSafetyEnabledEvent();
|
var ev = new DoorSafetyEnabledEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
||||||
return ev.Safety || _inhibitCrush;
|
return ev.Safety || _inhibitCrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,7 +548,7 @@ namespace Content.Server.Doors.Components
|
|||||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -603,7 +604,7 @@ namespace Content.Server.Doors.Components
|
|||||||
public void Deny()
|
public void Deny()
|
||||||
{
|
{
|
||||||
var ev = new BeforeDoorDeniedEvent();
|
var ev = new BeforeDoorDeniedEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
||||||
if (ev.Cancelled)
|
if (ev.Cancelled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -650,14 +651,14 @@ namespace Content.Server.Doors.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var autoev = new BeforeDoorAutoCloseEvent();
|
var autoev = new BeforeDoorAutoCloseEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, autoev, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, autoev, false);
|
||||||
if (autoev.Cancelled)
|
if (autoev.Cancelled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_autoCloseCancelTokenSource = new();
|
_autoCloseCancelTokenSource = new();
|
||||||
|
|
||||||
var ev = new DoorGetCloseTimeModifierEvent();
|
var ev = new DoorGetCloseTimeModifierEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
||||||
var realCloseTime = AutoCloseDelay * ev.CloseTimeModifier;
|
var realCloseTime = AutoCloseDelay * ev.CloseTimeModifier;
|
||||||
|
|
||||||
Owner.SpawnRepeatingTimer(realCloseTime, async () =>
|
Owner.SpawnRepeatingTimer(realCloseTime, async () =>
|
||||||
@@ -683,10 +684,10 @@ namespace Content.Server.Doors.Components
|
|||||||
if (tool.Qualities.Contains(_pryingQuality) && !IsWeldedShut)
|
if (tool.Qualities.Contains(_pryingQuality) && !IsWeldedShut)
|
||||||
{
|
{
|
||||||
var ev = new DoorGetPryTimeModifierEvent();
|
var ev = new DoorGetPryTimeModifierEvent();
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, ev, false);
|
||||||
|
|
||||||
var canEv = new BeforeDoorPryEvent(eventArgs);
|
var canEv = new BeforeDoorPryEvent(eventArgs);
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, canEv, false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, canEv, false);
|
||||||
|
|
||||||
if (canEv.Cancelled) return false;
|
if (canEv.Cancelled) return false;
|
||||||
|
|
||||||
@@ -695,7 +696,7 @@ namespace Content.Server.Doors.Components
|
|||||||
|
|
||||||
if (successfulPry && !IsWeldedShut)
|
if (successfulPry && !IsWeldedShut)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new OnDoorPryEvent(eventArgs), false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new OnDoorPryEvent(eventArgs), false);
|
||||||
if (State == DoorState.Closed)
|
if (State == DoorState.Closed)
|
||||||
{
|
{
|
||||||
Open();
|
Open();
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace Content.Server.Explosion.Components
|
|||||||
if (_unspawnedCount > 0)
|
if (_unspawnedCount > 0)
|
||||||
{
|
{
|
||||||
_unspawnedCount--;
|
_unspawnedCount--;
|
||||||
grenade = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.MapPosition);
|
grenade = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, Owner.Transform.MapPosition);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Server.Throwing;
|
using Content.Server.Throwing;
|
||||||
using Content.Shared.Acts;
|
using Content.Shared.Acts;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Server.Explosion.Components
|
namespace Content.Server.Explosion.Components
|
||||||
@@ -16,11 +17,11 @@ namespace Content.Server.Explosion.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var sourceLocation = eventArgs.Source;
|
var sourceLocation = eventArgs.Source;
|
||||||
var targetLocation = Owner.EntityManager.GetComponent<TransformComponent>(eventArgs.Target).Coordinates;
|
var targetLocation = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.Target).Coordinates;
|
||||||
|
|
||||||
if (sourceLocation.Equals(targetLocation)) return;
|
if (sourceLocation.Equals(targetLocation)) return;
|
||||||
|
|
||||||
var offset = (targetLocation.ToMapPos(Owner.EntityManager) - sourceLocation.ToMapPos(Owner.EntityManager));
|
var offset = (targetLocation.ToMapPos(IoCManager.Resolve<IEntityManager>()) - sourceLocation.ToMapPos(IoCManager.Resolve<IEntityManager>()));
|
||||||
|
|
||||||
//Don't throw if the direction is center (0,0)
|
//Don't throw if the direction is center (0,0)
|
||||||
if (offset == Vector2.Zero) return;
|
if (offset == Vector2.Zero) return;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
var playerPos = eventArgs.User.Transform.Coordinates;
|
var playerPos = eventArgs.User.Transform.Coordinates;
|
||||||
var entManager = Owner.EntityManager;
|
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
if (eventArgs.ClickLocation.GetGridId(entManager) != playerPos.GetGridId(entManager))
|
if (eventArgs.ClickLocation.GetGridId(entManager) != playerPos.GetGridId(entManager))
|
||||||
return true;
|
return true;
|
||||||
@@ -126,7 +126,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
|
|
||||||
var target = eventArgs.User.Transform.Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter);
|
var target = eventArgs.User.Transform.Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter);
|
||||||
|
|
||||||
if (target.TryDistance(Owner.EntityManager, playerPos, out var distance) && distance > SprayDistance)
|
if (target.TryDistance(IoCManager.Resolve<IEntityManager>(), playerPos, out var distance) && distance > SprayDistance)
|
||||||
target = eventArgs.User.Transform.Coordinates.Offset(diffNorm * SprayDistance);
|
target = eventArgs.User.Transform.Coordinates.Offset(diffNorm * SprayDistance);
|
||||||
|
|
||||||
var solution = EntitySystem.Get<SolutionContainerSystem>().SplitSolution(Owner.Uid, contents, _transferAmount);
|
var solution = EntitySystem.Get<SolutionContainerSystem>().SplitSolution(Owner.Uid, contents, _transferAmount);
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ namespace Content.Server.Fluids.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
puddle ??= () =>
|
puddle ??= () =>
|
||||||
puddleComponent.Owner.EntityManager.SpawnEntity(puddleComponent.Owner.Prototype?.ID,
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(puddleComponent.Owner.Prototype?.ID,
|
||||||
mapGrid.DirectionToGrid(coords, direction))
|
mapGrid.DirectionToGrid(coords, direction))
|
||||||
.GetComponent<PuddleComponent>();
|
.GetComponent<PuddleComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.Players;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -41,10 +42,10 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
if (string.IsNullOrEmpty(Prototype))
|
if (string.IsNullOrEmpty(Prototype))
|
||||||
throw new NullReferenceException("Prototype string cannot be null or empty!");
|
throw new NullReferenceException("Prototype string cannot be null or empty!");
|
||||||
|
|
||||||
var mob = Owner.EntityManager.SpawnEntity(Prototype, Owner.Transform.Coordinates);
|
var mob = IoCManager.Resolve<IEntityManager>().SpawnEntity(Prototype, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if (MakeSentient)
|
if (MakeSentient)
|
||||||
MakeSentientCommand.MakeSentient(mob.Uid, Owner.EntityManager);
|
MakeSentientCommand.MakeSentient(mob.Uid, IoCManager.Resolve<IEntityManager>());
|
||||||
|
|
||||||
mob.EnsureComponent<MindComponent>();
|
mob.EnsureComponent<MindComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.Mind.Components;
|
|||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.Ghost.Roles.Components
|
namespace Content.Server.Ghost.Roles.Components
|
||||||
@@ -29,7 +30,7 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (MakeSentient)
|
if (MakeSentient)
|
||||||
MakeSentientCommand.MakeSentient(OwnerUid, Owner.EntityManager);
|
MakeSentientCommand.MakeSentient(OwnerUid, IoCManager.Resolve<IEntityManager>());
|
||||||
|
|
||||||
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
|
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
|
||||||
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, OwnerUid, OwnerUid, this);
|
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, OwnerUid, OwnerUid, this);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Content.Server.Hands.Components
|
|||||||
}
|
}
|
||||||
if (heldEntity.TryGetComponent(out SpriteComponent? sprite))
|
if (heldEntity.TryGetComponent(out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
sprite.RenderOrder = heldEntity.EntityManager.CurrentTick.Value;
|
sprite.RenderOrder = IoCManager.Resolve<IEntityManager>().CurrentTick.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ namespace Content.Server.Hands.Components
|
|||||||
if (finalPosition.EqualsApprox(initialPosition.Position))
|
if (finalPosition.EqualsApprox(initialPosition.Position))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Owner.EntityManager.EntityNetManager!.SendSystemNetworkMessage(
|
IoCManager.Resolve<IEntityManager>().EntityNetManager!.SendSystemNetworkMessage(
|
||||||
new PickupAnimationMessage(entity.Uid, finalPosition, initialPosition));
|
new PickupAnimationMessage(entity.Uid, finalPosition, initialPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Server.Inventory.Components;
|
using Content.Server.Inventory.Components;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.Shared.Inventory.EquipmentSlotDefines;
|
using static Content.Shared.Inventory.EquipmentSlotDefines;
|
||||||
@@ -10,7 +11,7 @@ namespace Content.Server.Inventory
|
|||||||
{
|
{
|
||||||
public static bool SpawnItemInSlot(this InventoryComponent inventory, Slots slot, string prototype, bool mobCheck = false)
|
public static bool SpawnItemInSlot(this InventoryComponent inventory, Slots slot, string prototype, bool mobCheck = false)
|
||||||
{
|
{
|
||||||
var entityManager = inventory.Owner.EntityManager;
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var protoManager = IoCManager.Resolve<IPrototypeManager>();
|
var protoManager = IoCManager.Resolve<IPrototypeManager>();
|
||||||
var user = inventory.Owner;
|
var user = inventory.Owner;
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Content.Server.Jobs
|
|||||||
if (!EntitySystem.Get<HolidaySystem>().IsCurrentlyHoliday(Holiday))
|
if (!EntitySystem.Get<HolidaySystem>().IsCurrentlyHoliday(Holiday))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var entity = mob.EntityManager.SpawnEntity(Prototype, mob.Transform.Coordinates);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(Prototype, mob.Transform.Coordinates);
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out ItemComponent? item) || !mob.TryGetComponent(out HandsComponent? hands))
|
if (!entity.TryGetComponent(out ItemComponent? item) || !mob.TryGetComponent(out HandsComponent? hands))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Content.Shared.Nutrition.Components;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
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;
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(_meatPrototype))
|
if (!string.IsNullOrEmpty(_meatPrototype))
|
||||||
{
|
{
|
||||||
var meat = Owner.EntityManager.SpawnEntity(_meatPrototype, Owner.Transform.Coordinates);
|
var meat = IoCManager.Resolve<IEntityManager>().SpawnEntity(_meatPrototype, Owner.Transform.Coordinates);
|
||||||
meat.Name = _meatName;
|
meat.Name = _meatName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -365,13 +365,13 @@ namespace Content.Server.Kitchen.Components
|
|||||||
if (recipeToCook != null)
|
if (recipeToCook != null)
|
||||||
{
|
{
|
||||||
SubtractContents(recipeToCook);
|
SubtractContents(recipeToCook);
|
||||||
Owner.EntityManager.SpawnEntity(recipeToCook.Result, Owner.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(recipeToCook.Result, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VaporizeReagents();
|
VaporizeReagents();
|
||||||
VaporizeSolids();
|
VaporizeSolids();
|
||||||
Owner.EntityManager.SpawnEntity(_badRecipeName, Owner.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(_badRecipeName, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,9 +424,9 @@ namespace Content.Server.Kitchen.Components
|
|||||||
|
|
||||||
private void EjectSolid(EntityUid entityId)
|
private void EjectSolid(EntityUid entityId)
|
||||||
{
|
{
|
||||||
if (Owner.EntityManager.EntityExists(entityId))
|
if (IoCManager.Resolve<IEntityManager>().EntityExists(entityId))
|
||||||
{
|
{
|
||||||
_storage.Remove(Owner.EntityManager.GetEntity(entityId));
|
_storage.Remove(IoCManager.Resolve<IEntityManager>().GetEntity(entityId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Content.Shared.Research.Prototypes;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.Lathe.Components
|
namespace Content.Server.Lathe.Components
|
||||||
@@ -122,7 +123,7 @@ namespace Content.Server.Lathe.Components
|
|||||||
{
|
{
|
||||||
Producing = false;
|
Producing = false;
|
||||||
_producingRecipe = null;
|
_producingRecipe = null;
|
||||||
Owner.EntityManager.SpawnEntity(recipe.Result, Owner.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(recipe.Result, Owner.Transform.Coordinates);
|
||||||
UserInterface?.SendMessage(new LatheStoppedProducingRecipeMessage());
|
UserInterface?.SendMessage(new LatheStoppedProducingRecipeMessage());
|
||||||
State = LatheState.Base;
|
State = LatheState.Base;
|
||||||
SetAppearance(LatheVisualState.Idle);
|
SetAppearance(LatheVisualState.Idle);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Examine;
|
|||||||
using Content.Shared.Light.Component;
|
using Content.Shared.Light.Component;
|
||||||
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.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -30,7 +31,7 @@ namespace Content.Server.Light.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_state = value;
|
_state = value;
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new EmergencyLightMessage(this, _state));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new EmergencyLightMessage(this, _state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
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;
|
||||||
@@ -71,7 +72,7 @@ namespace Content.Server.Light.Components
|
|||||||
protected override void OnRemove()
|
protected override void OnRemove()
|
||||||
{
|
{
|
||||||
base.OnRemove();
|
base.OnRemove();
|
||||||
Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
@@ -119,7 +120,7 @@ namespace Content.Server.Light.Components
|
|||||||
SetState(false);
|
SetState(false);
|
||||||
Activated = false;
|
Activated = false;
|
||||||
UpdateLightAction();
|
UpdateLightAction();
|
||||||
Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||||
|
|
||||||
if (makeNoise)
|
if (makeNoise)
|
||||||
{
|
{
|
||||||
@@ -158,7 +159,7 @@ namespace Content.Server.Light.Components
|
|||||||
Activated = true;
|
Activated = true;
|
||||||
UpdateLightAction();
|
UpdateLightAction();
|
||||||
SetState(true);
|
SetState(true);
|
||||||
Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this));
|
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this));
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), TurnOnSound.GetSound(), Owner);
|
SoundSystem.Play(Filter.Pvs(Owner), TurnOnSound.GetSound(), Owner);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Content.Server.Mind.Components
|
|||||||
public void InternalEjectMind()
|
public void InternalEjectMind()
|
||||||
{
|
{
|
||||||
if (!Deleted)
|
if (!Deleted)
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new MindRemovedMessage());
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new MindRemovedMessage());
|
||||||
Mind = null;
|
Mind = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ namespace Content.Server.Mind.Components
|
|||||||
public void InternalAssignMind(Mind value)
|
public void InternalAssignMind(Mind value)
|
||||||
{
|
{
|
||||||
Mind = value;
|
Mind = value;
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new MindAddedMessage());
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new MindAddedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Shutdown()
|
protected override void Shutdown()
|
||||||
@@ -103,13 +103,13 @@ namespace Content.Server.Mind.Components
|
|||||||
// Async this so that we don't throw if the grid we're on is being deleted.
|
// Async this so that we don't throw if the grid we're on is being deleted.
|
||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
var gridId = spawnPosition.GetGridId(Owner.EntityManager);
|
var gridId = spawnPosition.GetGridId(IoCManager.Resolve<IEntityManager>());
|
||||||
if (gridId == GridId.Invalid || !mapMan.GridExists(gridId))
|
if (gridId == GridId.Invalid || !mapMan.GridExists(gridId))
|
||||||
{
|
{
|
||||||
spawnPosition = EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
spawnPosition = EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
var ghost = Owner.EntityManager.SpawnEntity("MobObserver", spawnPosition);
|
var ghost = IoCManager.Resolve<IEntityManager>().SpawnEntity("MobObserver", spawnPosition);
|
||||||
var ghostComponent = ghost.GetComponent<GhostComponent>();
|
var ghostComponent = ghost.GetComponent<GhostComponent>();
|
||||||
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghostComponent, false);
|
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghostComponent, false);
|
||||||
|
|
||||||
|
|||||||
@@ -184,7 +184,8 @@ namespace Content.Server.Mind
|
|||||||
role.Greet();
|
role.Greet();
|
||||||
|
|
||||||
var message = new RoleAddedEvent(role);
|
var message = new RoleAddedEvent(role);
|
||||||
OwnedEntity?.EntityManager.EventBus.RaiseLocalEvent(OwnedEntity.Uid, message);
|
IEntity? tempQualifier = OwnedEntity;
|
||||||
|
(tempQualifier != null ? IoCManager.Resolve<IEntityManager>() : null).EventBus.RaiseLocalEvent(OwnedEntity.Uid, message);
|
||||||
|
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
@@ -206,7 +207,8 @@ namespace Content.Server.Mind
|
|||||||
_roles.Remove(role);
|
_roles.Remove(role);
|
||||||
|
|
||||||
var message = new RoleRemovedEvent(role);
|
var message = new RoleRemovedEvent(role);
|
||||||
OwnedEntity?.EntityManager.EventBus.RaiseLocalEvent(OwnedEntity.Uid, message);
|
IEntity? tempQualifier = OwnedEntity;
|
||||||
|
(tempQualifier != null ? IoCManager.Resolve<IEntityManager>() : null).EventBus.RaiseLocalEvent(OwnedEntity.Uid, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasRole<T>() where T : Role
|
public bool HasRole<T>() where T : Role
|
||||||
@@ -380,7 +382,7 @@ namespace Content.Server.Mind
|
|||||||
oldVisitingEnt.RemoveComponent<VisitingMindComponent>();
|
oldVisitingEnt.RemoveComponent<VisitingMindComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
oldVisitingEnt.EntityManager.EventBus.RaiseLocalEvent(oldVisitingEnt.Uid, new MindUnvisitedMessage());
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(oldVisitingEnt.Uid, new MindUnvisitedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetSession([NotNullWhen(true)] out IPlayerSession? session)
|
public bool TryGetSession([NotNullWhen(true)] out IPlayerSession? session)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Robust.Server.GameObjects;
|
|||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
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;
|
||||||
@@ -119,7 +120,7 @@ namespace Content.Server.Morgue.Components
|
|||||||
item.Delete();
|
item.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
var ash = Owner.EntityManager.SpawnEntity("Ash", Owner.Transform.Coordinates);
|
var ash = IoCManager.Resolve<IEntityManager>().SpawnEntity("Ash", Owner.Transform.Coordinates);
|
||||||
Contents.Insert(ash);
|
Contents.Insert(ash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace Content.Server.Morgue.Components
|
|||||||
|
|
||||||
if (_tray == null)
|
if (_tray == null)
|
||||||
{
|
{
|
||||||
_tray = Owner.EntityManager.SpawnEntity(_trayPrototypeId, Owner.Transform.Coordinates);
|
_tray = IoCManager.Resolve<IEntityManager>().SpawnEntity(_trayPrototypeId, Owner.Transform.Coordinates);
|
||||||
var trayComp = _tray.EnsureComponent<MorgueTrayComponent>();
|
var trayComp = _tray.EnsureComponent<MorgueTrayComponent>();
|
||||||
trayComp.Morgue = Owner;
|
trayComp.Morgue = Owner;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
var position = Owner.Transform.Coordinates;
|
var position = Owner.Transform.Coordinates;
|
||||||
foreach (var entity in grid.GetInDir(position, pipeDir.ToDirection()))
|
foreach (var entity in grid.GetInDir(position, pipeDir.ToDirection()))
|
||||||
{
|
{
|
||||||
if (!Owner.EntityManager.TryGetComponent<NodeContainerComponent>(entity, out var container))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<NodeContainerComponent>(entity, out var container))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach (var node in container.Nodes.Values)
|
foreach (var node in container.Nodes.Values)
|
||||||
@@ -196,7 +196,7 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
var position = Owner.Transform.Coordinates;
|
var position = Owner.Transform.Coordinates;
|
||||||
foreach (var entity in grid.GetLocal(position))
|
foreach (var entity in grid.GetLocal(position))
|
||||||
{
|
{
|
||||||
if (!Owner.EntityManager.TryGetComponent<NodeContainerComponent>(entity, out var container))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<NodeContainerComponent>(entity, out var container))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach (var node in container.Nodes.Values)
|
foreach (var node in container.Nodes.Values)
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
{
|
{
|
||||||
//We're empty. Become trash.
|
//We're empty. Become trash.
|
||||||
var position = component.Owner.Transform.Coordinates;
|
var position = component.Owner.Transform.Coordinates;
|
||||||
var finisher = component.Owner.EntityManager.SpawnEntity(component.TrashPrototype, position);
|
var finisher = IoCManager.Resolve<IEntityManager>().SpawnEntity(component.TrashPrototype, position);
|
||||||
|
|
||||||
// If the user is holding the item
|
// If the user is holding the item
|
||||||
if (userUid != null &&
|
if (userUid != null &&
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
var coords = Owner.Transform.Coordinates;
|
var coords = Owner.Transform.Coordinates;
|
||||||
foreach (var maybeFuel in grid.GetCardinalNeighborCells(coords))
|
foreach (var maybeFuel in grid.GetCardinalNeighborCells(coords))
|
||||||
{
|
{
|
||||||
if (Owner.EntityManager.TryGetComponent(maybeFuel, out _partFuelChamber))
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(maybeFuel, out _partFuelChamber))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -464,7 +464,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
var coords = Owner.Transform.Coordinates;
|
var coords = Owner.Transform.Coordinates;
|
||||||
foreach (var ent in grid.GetOffset(coords, offset))
|
foreach (var ent in grid.GetOffset(coords, offset))
|
||||||
{
|
{
|
||||||
if (Owner.EntityManager.TryGetComponent(ent, out part) && !part.Deleted)
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(ent, out part) && !part.Deleted)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Content.Shared.Singularity.Components;
|
using Content.Shared.Singularity.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
|||||||
|
|
||||||
public void Fire(ParticleAcceleratorPowerState strength)
|
public void Fire(ParticleAcceleratorPowerState strength)
|
||||||
{
|
{
|
||||||
var projectile = Owner.EntityManager.SpawnEntity("ParticlesProjectile", Owner.Transform.Coordinates);
|
var projectile = IoCManager.Resolve<IEntityManager>().SpawnEntity("ParticlesProjectile", Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if (!projectile.TryGetComponent<ParticleProjectileComponent>(out var particleProjectileComponent))
|
if (!projectile.TryGetComponent<ParticleProjectileComponent>(out var particleProjectileComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Shared.Pulling;
|
using Content.Shared.Pulling;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Controllers;
|
using Robust.Shared.Physics.Controllers;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -74,7 +75,7 @@ namespace Content.Server.Physics.Controllers
|
|||||||
// Now that's over with...
|
// Now that's over with...
|
||||||
|
|
||||||
var pullerPosition = puller.Transform.MapPosition;
|
var pullerPosition = puller.Transform.MapPosition;
|
||||||
var movingTo = pullable.MovingTo.Value.ToMap(pullable.Owner.EntityManager);
|
var movingTo = pullable.MovingTo.Value.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||||
if (movingTo.MapId != pullerPosition.MapId)
|
if (movingTo.MapId != pullerPosition.MapId)
|
||||||
{
|
{
|
||||||
_pullableSystem.StopMoveTo(pullable);
|
_pullableSystem.StopMoveTo(pullable);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace Content.Server.Power.Components
|
|||||||
#pragma warning disable 618
|
#pragma warning disable 618
|
||||||
SendMessage(new PowerChangedMessage(Powered));
|
SendMessage(new PowerChangedMessage(Powered));
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new PowerChangedEvent(Powered, NetworkLoad.ReceivingPower));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new PowerChangedEvent(Powered, NetworkLoad.ReceivingPower));
|
||||||
|
|
||||||
if (Owner.TryGetComponent<AppearanceComponent>(out var appearance))
|
if (Owner.TryGetComponent<AppearanceComponent>(out var appearance))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Tools;
|
using Content.Shared.Tools;
|
||||||
using Content.Shared.Tools.Components;
|
using Content.Shared.Tools.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -47,7 +48,7 @@ namespace Content.Server.Power.Components
|
|||||||
if (EntitySystem.Get<ElectrocutionSystem>().TryDoElectrifiedAct(Owner.Uid, eventArgs.User.Uid)) return false;
|
if (EntitySystem.Get<ElectrocutionSystem>().TryDoElectrifiedAct(Owner.Uid, eventArgs.User.Uid)) return false;
|
||||||
|
|
||||||
Owner.Delete();
|
Owner.Delete();
|
||||||
var droppedEnt = Owner.EntityManager.SpawnEntity(_cableDroppedOnCutPrototype, eventArgs.ClickLocation);
|
var droppedEnt = IoCManager.Resolve<IEntityManager>().SpawnEntity(_cableDroppedOnCutPrototype, eventArgs.ClickLocation);
|
||||||
|
|
||||||
// TODO: Literally just use a prototype that has a single thing in the stack, it's not that complicated...
|
// TODO: Literally just use a prototype that has a single thing in the stack, it's not that complicated...
|
||||||
if (droppedEnt.TryGetComponent<StackComponent>(out var stack))
|
if (droppedEnt.TryGetComponent<StackComponent>(out var stack))
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Content.Server.Power.Components
|
|||||||
if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
|
if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GetGridId(Owner.EntityManager), out var grid))
|
if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GetGridId(IoCManager.Resolve<IEntityManager>()), out var grid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var snapPos = grid.TileIndicesFor(eventArgs.ClickLocation);
|
var snapPos = grid.TileIndicesFor(eventArgs.ClickLocation);
|
||||||
@@ -51,7 +51,7 @@ namespace Content.Server.Power.Components
|
|||||||
|
|
||||||
foreach (var anchored in grid.GetAnchoredEntities(snapPos))
|
foreach (var anchored in grid.GetAnchoredEntities(snapPos))
|
||||||
{
|
{
|
||||||
if (Owner.EntityManager.TryGetComponent<CableComponent>(anchored, out var wire) && wire.CableType == _blockingCableType)
|
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<CableComponent>(anchored, out var wire) && wire.CableType == _blockingCableType)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ namespace Content.Server.Power.Components
|
|||||||
&& !EntitySystem.Get<StackSystem>().Use(Owner.Uid, 1, stack))
|
&& !EntitySystem.Get<StackSystem>().Use(Owner.Uid, 1, stack))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Owner.EntityManager.SpawnEntity(_cablePrototypeID, grid.GridTileToLocal(snapPos));
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(_cablePrototypeID, grid.GridTileToLocal(snapPos));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace Content.Server.Power.EntitySystems
|
|||||||
if (EntityManager.TryGetComponent<ExtensionCableReceiverComponent>(entity.Uid, out var receiver) &&
|
if (EntityManager.TryGetComponent<ExtensionCableReceiverComponent>(entity.Uid, out var receiver) &&
|
||||||
receiver.Connectable &&
|
receiver.Connectable &&
|
||||||
receiver.Provider == null &&
|
receiver.Provider == null &&
|
||||||
entity.Transform.Coordinates.TryDistance(owner.EntityManager, owner.Transform.Coordinates, out var distance) &&
|
entity.Transform.Coordinates.TryDistance(IoCManager.Resolve<IEntityManager>(), owner.Transform.Coordinates, out var distance) &&
|
||||||
distance < Math.Min(range, receiver.ReceptionRange))
|
distance < Math.Min(range, receiver.ReceptionRange))
|
||||||
{
|
{
|
||||||
yield return receiver;
|
yield return receiver;
|
||||||
@@ -185,7 +185,7 @@ namespace Content.Server.Power.EntitySystems
|
|||||||
|
|
||||||
if (!provider.Connectable) continue;
|
if (!provider.Connectable) continue;
|
||||||
|
|
||||||
if (!entity.Transform.Coordinates.TryDistance(owner.EntityManager, owner.Transform.Coordinates, out var distance)) continue;
|
if (!entity.Transform.Coordinates.TryDistance(IoCManager.Resolve<IEntityManager>(), owner.Transform.Coordinates, out var distance)) continue;
|
||||||
|
|
||||||
if (!(distance < Math.Min(range, provider.TransferRange))) continue;
|
if (!(distance < Math.Min(range, provider.TransferRange))) continue;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.Sound;
|
|||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
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.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -148,7 +149,7 @@ namespace Content.Server.PowerCell.Components
|
|||||||
SoundSystem.Play(Filter.Pvs(Owner), CellRemoveSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
|
SoundSystem.Play(Filter.Pvs(Owner), CellRemoveSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(true), false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(true), false);
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +172,7 @@ namespace Content.Server.PowerCell.Components
|
|||||||
SoundSystem.Play(Filter.Pvs(Owner), CellInsertSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
|
SoundSystem.Play(Filter.Pvs(Owner), CellInsertSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(false), false);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(false), false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +199,7 @@ namespace Content.Server.PowerCell.Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var cell = Owner.EntityManager.SpawnEntity(type, Owner.Transform.Coordinates);
|
var cell = IoCManager.Resolve<IEntityManager>().SpawnEntity(type, Owner.Transform.Coordinates);
|
||||||
_cellContainer.Insert(cell);
|
_cellContainer.Insert(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Content.Server.Projectiles.Components
|
|||||||
var gridOrMap = user.Transform.GridID == GridId.Invalid ? mapManager.GetMapEntityId(user.Transform.MapID) :
|
var gridOrMap = user.Transform.GridID == GridId.Invalid ? mapManager.GetMapEntityId(user.Transform.MapID) :
|
||||||
mapManager.GetGrid(user.Transform.GridID).GridEntityId;
|
mapManager.GetGrid(user.Transform.GridID).GridEntityId;
|
||||||
|
|
||||||
var parentXform = Owner.EntityManager.GetComponent<TransformComponent>(gridOrMap);
|
var parentXform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridOrMap);
|
||||||
|
|
||||||
var localCoordinates = new EntityCoordinates(gridOrMap, parentXform.InvWorldMatrix.Transform(user.Transform.WorldPosition));
|
var localCoordinates = new EntityCoordinates(gridOrMap, parentXform.InvWorldMatrix.Transform(user.Transform.WorldPosition));
|
||||||
var localAngle = angle - parentXform.WorldRotation;
|
var localAngle = angle - parentXform.WorldRotation;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Recycling.Components
|
namespace Content.Server.Recycling.Components
|
||||||
@@ -32,7 +33,7 @@ namespace Content.Server.Recycling.Components
|
|||||||
{
|
{
|
||||||
for (var i = 0; i < Math.Max(_amount * efficiency, 1); i++)
|
for (var i = 0; i < Math.Max(_amount * efficiency, 1); i++)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.SpawnEntity(_prototype, Owner.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(_prototype, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Rotatable;
|
using Content.Shared.Rotatable;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
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.Physics;
|
using Robust.Shared.Physics;
|
||||||
@@ -83,7 +84,7 @@ namespace Content.Server.Rotatable
|
|||||||
}
|
}
|
||||||
|
|
||||||
var oldTransform = component.Owner.Transform;
|
var oldTransform = component.Owner.Transform;
|
||||||
var entity = component.Owner.EntityManager.SpawnEntity(component.MirrorEntity, oldTransform.Coordinates);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(component.MirrorEntity, oldTransform.Coordinates);
|
||||||
var newTransform = entity.Transform;
|
var newTransform = entity.Transform;
|
||||||
newTransform.LocalRotation = oldTransform.LocalRotation;
|
newTransform.LocalRotation = oldTransform.LocalRotation;
|
||||||
newTransform.Anchored = false;
|
newTransform.Anchored = false;
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ namespace Content.Server.Singularity.EntitySystems
|
|||||||
|
|
||||||
private void Fire(EmitterComponent component)
|
private void Fire(EmitterComponent component)
|
||||||
{
|
{
|
||||||
var projectile = component.Owner.EntityManager.SpawnEntity(component.BoltType, component.Owner.Transform.Coordinates);
|
var projectile = IoCManager.Resolve<IEntityManager>().SpawnEntity(component.BoltType, component.Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if (!projectile.TryGetComponent<PhysicsComponent>(out var physicsComponent))
|
if (!projectile.TryGetComponent<PhysicsComponent>(out var physicsComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace Content.Server.Spawners.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!Owner.Deleted)
|
if(!Owner.Deleted)
|
||||||
Owner.EntityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void MapInit()
|
public virtual void MapInit()
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Content.Server.Spawners.Components
|
|||||||
{
|
{
|
||||||
if (RarePrototypes.Count > 0 && (RareChance == 1.0f || _robustRandom.Prob(RareChance)))
|
if (RarePrototypes.Count > 0 && (RareChance == 1.0f || _robustRandom.Prob(RareChance)))
|
||||||
{
|
{
|
||||||
Owner.EntityManager.SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ namespace Content.Server.Spawners.Components
|
|||||||
var x_negative = random.Prob(0.5f) ? -1 : 1;
|
var x_negative = random.Prob(0.5f) ? -1 : 1;
|
||||||
var y_negative = random.Prob(0.5f) ? -1 : 1;
|
var y_negative = random.Prob(0.5f) ? -1 : 1;
|
||||||
|
|
||||||
var entity = Owner.EntityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
||||||
entity.Transform.LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative);
|
entity.Transform.LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace Content.Server.Spawners.Components
|
|||||||
for (int i = 0; i < number; i++)
|
for (int i = 0; i < number; i++)
|
||||||
{
|
{
|
||||||
var entity = _robustRandom.Pick(Prototypes);
|
var entity = _robustRandom.Pick(Prototypes);
|
||||||
Owner.EntityManager.SpawnEntity(entity, Owner.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(entity, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.Storage.Components
|
|||||||
// No contents, we do nothing
|
// No contents, we do nothing
|
||||||
if (Contents.ContainedEntities.Count == 0) return;
|
if (Contents.ContainedEntities.Count == 0) return;
|
||||||
|
|
||||||
var lockers = Owner.EntityManager.EntityQuery<EntityStorageComponent>().Select(c => c.Owner).ToList();
|
var lockers = IoCManager.Resolve<IEntityManager>().EntityQuery<EntityStorageComponent>().Select(c => c.Owner).ToList();
|
||||||
|
|
||||||
if (lockers.Contains(Owner))
|
if (lockers.Contains(Owner))
|
||||||
lockers.Remove(Owner);
|
lockers.Remove(Owner);
|
||||||
|
|||||||
@@ -218,14 +218,14 @@ namespace Content.Server.Storage.Components
|
|||||||
// 5. if this is NOT AN ITEM, then mobs can always be eaten unless unless a previous law prevents it
|
// 5. if this is NOT AN ITEM, then mobs can always be eaten unless unless a previous law prevents it
|
||||||
|
|
||||||
// Let's not insert admin ghosts, yeah? This is really a a hack and should be replaced by attempt events
|
// Let's not insert admin ghosts, yeah? This is really a a hack and should be replaced by attempt events
|
||||||
if (Owner.EntityManager.HasComponent<GhostComponent>(entity.Uid))
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(entity.Uid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// checks
|
// checks
|
||||||
|
|
||||||
var targetIsItem = Owner.EntityManager.HasComponent<SharedItemComponent>(entity.Uid);
|
var targetIsItem = IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(entity.Uid);
|
||||||
var targetIsMob = Owner.EntityManager.HasComponent<SharedBodyComponent>(entity.Uid);
|
var targetIsMob = IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity.Uid);
|
||||||
var storageIsItem = Owner.EntityManager.HasComponent<SharedItemComponent>(OwnerUid);
|
var storageIsItem = IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(OwnerUid);
|
||||||
|
|
||||||
var allowedToEat = false;
|
var allowedToEat = false;
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Content.Server.Storage.Components
|
|||||||
private const string LoggerName = "Storage";
|
private const string LoggerName = "Storage";
|
||||||
|
|
||||||
public Container? Storage;
|
public Container? Storage;
|
||||||
|
|
||||||
private readonly Dictionary<IEntity, int> _sizeCache = new();
|
private readonly Dictionary<IEntity, int> _sizeCache = new();
|
||||||
|
|
||||||
[DataField("occludesLight")]
|
[DataField("occludesLight")]
|
||||||
@@ -462,13 +462,13 @@ namespace Content.Server.Storage.Components
|
|||||||
var ownerTransform = Owner.Transform;
|
var ownerTransform = Owner.Transform;
|
||||||
var playerTransform = player.Transform;
|
var playerTransform = player.Transform;
|
||||||
|
|
||||||
if (!playerTransform.Coordinates.InRange(Owner.EntityManager, ownerTransform.Coordinates, 2) ||
|
if (!playerTransform.Coordinates.InRange(IoCManager.Resolve<IEntityManager>(), ownerTransform.Coordinates, 2) ||
|
||||||
Owner.IsInContainer() && !playerTransform.ContainsEntity(ownerTransform))
|
Owner.IsInContainer() && !playerTransform.ContainsEntity(ownerTransform))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Owner.EntityManager.TryGetEntity(remove.EntityUid, out var entity) || Storage?.Contains(entity) == false)
|
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(remove.EntityUid, out var entity) || Storage?.Contains(entity) == false)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Content.Server.Storage.Components
|
|||||||
for (var i = 0; i < storageItem.Amount; i++)
|
for (var i = 0; i < storageItem.Amount; i++)
|
||||||
{
|
{
|
||||||
storage.Insert(
|
storage.Insert(
|
||||||
Owner.EntityManager.SpawnEntity(storageItem.PrototypeId, Owner.Transform.Coordinates));
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(storageItem.PrototypeId, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId);
|
if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.MobState.Components;
|
|||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
@@ -96,7 +97,7 @@ namespace Content.Server.Throwing
|
|||||||
if (user != null && pushbackRatio > 0.0f && user.TryGetComponent(out IPhysBody? body))
|
if (user != null && pushbackRatio > 0.0f && user.TryGetComponent(out IPhysBody? body))
|
||||||
{
|
{
|
||||||
var msg = new ThrowPushbackAttemptEvent();
|
var msg = new ThrowPushbackAttemptEvent();
|
||||||
body.Owner.EntityManager.EventBus.RaiseLocalEvent(body.Owner.Uid, msg);
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(body.Owner.Uid, msg);
|
||||||
|
|
||||||
if (!msg.Cancelled)
|
if (!msg.Cancelled)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ namespace Content.Server.Tiles
|
|||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
var location = eventArgs.ClickLocation.AlignWithClosestGridTile();
|
var location = eventArgs.ClickLocation.AlignWithClosestGridTile();
|
||||||
var locationMap = location.ToMap(Owner.EntityManager);
|
var locationMap = location.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||||
if (locationMap.MapId == MapId.Nullspace)
|
if (locationMap.MapId == MapId.Nullspace)
|
||||||
return true;
|
return true;
|
||||||
mapManager.TryGetGrid(location.GetGridId(Owner.EntityManager), out var mapGrid);
|
mapManager.TryGetGrid(location.GetGridId(IoCManager.Resolve<IEntityManager>()), out var mapGrid);
|
||||||
|
|
||||||
if (_outputTiles == null)
|
if (_outputTiles == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Content.Server.Tools.Components
|
|||||||
if (!Owner.TryGetComponent<ToolComponent>(out var tool) && _toolComponentNeeded)
|
if (!Owner.TryGetComponent<ToolComponent>(out var tool) && _toolComponentNeeded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_mapManager.TryGetGrid(clickLocation.GetGridId(Owner.EntityManager), out var mapGrid))
|
if (!_mapManager.TryGetGrid(clickLocation.GetGridId(IoCManager.Resolve<IEntityManager>()), out var mapGrid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var tile = mapGrid.GetTileRef(clickLocation);
|
var tile = mapGrid.GetTileRef(clickLocation);
|
||||||
@@ -55,7 +55,7 @@ namespace Content.Server.Tools.Components
|
|||||||
if (_toolComponentNeeded && !await EntitySystem.Get<ToolSystem>().UseTool(Owner.Uid, user.Uid, null, 0f, 0f, _qualityNeeded, toolComponent:tool))
|
if (_toolComponentNeeded && !await EntitySystem.Get<ToolSystem>().UseTool(Owner.Uid, user.Uid, null, 0f, 0f, _qualityNeeded, toolComponent:tool))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
coordinates.PryTile(Owner.EntityManager, _mapManager);
|
coordinates.PryTile(IoCManager.Resolve<IEntityManager>(), _mapManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace Content.Server.TraitorDeathMatch.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4 is the per-PDA bonus amount.
|
// 4 is the per-PDA bonus amount.
|
||||||
var accounts = Owner.EntityManager.EntitySysManager.GetEntitySystem<UplinkAccountsSystem>();
|
var accounts = IoCManager.Resolve<IEntityManager>().EntitySysManager.GetEntitySystem<UplinkAccountsSystem>();
|
||||||
var transferAmount = victimAccount.Balance + 4;
|
var transferAmount = victimAccount.Balance + 4;
|
||||||
accounts.SetBalance(victimAccount, 0);
|
accounts.SetBalance(victimAccount, 0);
|
||||||
accounts.AddToBalance(userAccount, transferAmount);
|
accounts.AddToBalance(userAccount, transferAmount);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ namespace Content.Server.VendingMachines
|
|||||||
{
|
{
|
||||||
_ejecting = false;
|
_ejecting = false;
|
||||||
TrySetVisualState(VendingMachineVisualState.Normal);
|
TrySetVisualState(VendingMachineVisualState.Normal);
|
||||||
Owner.EntityManager.SpawnEntity(id, Owner.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(id, Owner.Transform.Coordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), _soundVend.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
SoundSystem.Play(Filter.Pvs(Owner), _soundVend.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace Content.Server.Weapon.Melee
|
|||||||
var target = args.TargetEntity;
|
var target = args.TargetEntity;
|
||||||
|
|
||||||
var location = args.User.Transform.Coordinates;
|
var location = args.User.Transform.Coordinates;
|
||||||
var diff = args.ClickLocation.ToMapPos(owner.EntityManager) - location.ToMapPos(owner.EntityManager);
|
var diff = args.ClickLocation.ToMapPos(IoCManager.Resolve<IEntityManager>()) - location.ToMapPos(IoCManager.Resolve<IEntityManager>());
|
||||||
var angle = Angle.FromWorldVec(diff);
|
var angle = Angle.FromWorldVec(diff);
|
||||||
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
@@ -139,7 +139,7 @@ namespace Content.Server.Weapon.Melee
|
|||||||
var owner = EntityManager.GetEntity(uid);
|
var owner = EntityManager.GetEntity(uid);
|
||||||
|
|
||||||
var location = args.User.Transform.Coordinates;
|
var location = args.User.Transform.Coordinates;
|
||||||
var diff = args.ClickLocation.ToMapPos(owner.EntityManager) - location.ToMapPos(owner.EntityManager);
|
var diff = args.ClickLocation.ToMapPos(IoCManager.Resolve<IEntityManager>()) - location.ToMapPos(IoCManager.Resolve<IEntityManager>());
|
||||||
var angle = Angle.FromWorldVec(diff);
|
var angle = Angle.FromWorldVec(diff);
|
||||||
|
|
||||||
// This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes.
|
// This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes.
|
||||||
@@ -220,7 +220,7 @@ namespace Content.Server.Weapon.Melee
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var location = args.User.Transform.Coordinates;
|
var location = args.User.Transform.Coordinates;
|
||||||
var diff = args.ClickLocation.ToMapPos(owner.EntityManager) - location.ToMapPos(owner.EntityManager);
|
var diff = args.ClickLocation.ToMapPos(IoCManager.Resolve<IEntityManager>()) - location.ToMapPos(IoCManager.Resolve<IEntityManager>());
|
||||||
var angle = Angle.FromWorldVec(diff);
|
var angle = Angle.FromWorldVec(diff);
|
||||||
|
|
||||||
var hitEvent = new MeleeInteractEvent(args.Target, args.User);
|
var hitEvent = new MeleeInteractEvent(args.Target, args.User);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||||
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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -90,7 +91,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
|||||||
|
|
||||||
if (_unspawnedCount > 0)
|
if (_unspawnedCount > 0)
|
||||||
{
|
{
|
||||||
ammo = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
ammo = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
// when dumping from held ammo box, this detaches the spawned ammo from the player.
|
// when dumping from held ammo box, this detaches the spawned ammo from the player.
|
||||||
ammo.Transform.AttachParentToContainerOrGrid();
|
ammo.Transform.AttachParentToContainerOrGrid();
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
|||||||
appearanceComponent.SetData(AmmoVisuals.Spent, true);
|
appearanceComponent.SetData(AmmoVisuals.Spent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = Owner.EntityManager.SpawnEntity(_projectileId, spawnAt);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_projectileId, spawnAt);
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||||
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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -127,7 +128,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
|||||||
else if (_unspawnedCount > 0)
|
else if (_unspawnedCount > 0)
|
||||||
{
|
{
|
||||||
_unspawnedCount--;
|
_unspawnedCount--;
|
||||||
ammo = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
ammo = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateAppearance();
|
UpdateAppearance();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||||
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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
|||||||
|
|
||||||
if (_unspawnedCount > 0)
|
if (_unspawnedCount > 0)
|
||||||
{
|
{
|
||||||
entity = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||||
_unspawnedCount--;
|
_unspawnedCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -110,7 +111,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
if (_unspawnedCount > 0)
|
if (_unspawnedCount > 0)
|
||||||
{
|
{
|
||||||
_unspawnedCount--;
|
_unspawnedCount--;
|
||||||
var chamberEntity = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
var chamberEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||||
_chamberContainer.Insert(chamberEntity);
|
_chamberContainer.Insert(chamberEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,7 +320,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
else if (_unspawnedCount > 0)
|
else if (_unspawnedCount > 0)
|
||||||
{
|
{
|
||||||
_unspawnedCount--;
|
_unspawnedCount--;
|
||||||
var ammoEntity = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
var ammoEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||||
_chamberContainer.Insert(ammoEntity);
|
_chamberContainer.Insert(ammoEntity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -182,7 +183,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
if (_unspawnedCount > 0)
|
if (_unspawnedCount > 0)
|
||||||
{
|
{
|
||||||
_unspawnedCount--;
|
_unspawnedCount--;
|
||||||
var ammoEntity = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
var ammoEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||||
_chamberContainer.Insert(ammoEntity);
|
_chamberContainer.Insert(ammoEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
|
|
||||||
for (var i = 0; i < _unspawnedCount; i++)
|
for (var i = 0; i < _unspawnedCount; i++)
|
||||||
{
|
{
|
||||||
var entity = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, Owner.Transform.Coordinates);
|
||||||
_ammoSlots[idx] = entity;
|
_ammoSlots[idx] = entity;
|
||||||
_ammoContainer.Insert(entity);
|
_ammoContainer.Insert(entity);
|
||||||
idx++;
|
idx++;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
@@ -96,7 +97,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
_powerCellContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-powercell-container", out var existing);
|
_powerCellContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-powercell-container", out var existing);
|
||||||
if (!existing && _powerCellPrototype != null)
|
if (!existing && _powerCellPrototype != null)
|
||||||
{
|
{
|
||||||
var powerCellEntity = Owner.EntityManager.SpawnEntity(_powerCellPrototype, Owner.Transform.Coordinates);
|
var powerCellEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_powerCellPrototype, Owner.Transform.Coordinates);
|
||||||
_powerCellContainer.Insert(powerCellEntity);
|
_powerCellContainer.Insert(powerCellEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +134,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
var ammo = _ammoContainer.ContainedEntity;
|
var ammo = _ammoContainer.ContainedEntity;
|
||||||
if (ammo == null)
|
if (ammo == null)
|
||||||
{
|
{
|
||||||
ammo = Owner.EntityManager.SpawnEntity(_ammoPrototype, Owner.Transform.Coordinates);
|
ammo = IoCManager.Resolve<IEntityManager>().SpawnEntity(_ammoPrototype, Owner.Transform.Coordinates);
|
||||||
_ammoContainer.Insert(ammo);
|
_ammoContainer.Insert(ammo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +175,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entity = Owner.EntityManager.SpawnEntity(_ammoPrototype, spawnAt);
|
entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_ammoPrototype, spawnAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.TryGetComponent(out ProjectileComponent? projectileComponent))
|
if (entity.TryGetComponent(out ProjectileComponent? projectileComponent))
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -179,7 +180,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
|
|
||||||
if (!existing && _magFillPrototype != null)
|
if (!existing && _magFillPrototype != null)
|
||||||
{
|
{
|
||||||
var magEntity = Owner.EntityManager.SpawnEntity(_magFillPrototype, Owner.Transform.Coordinates);
|
var magEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_magFillPrototype, Owner.Transform.Coordinates);
|
||||||
MagazineContainer.Insert(magEntity);
|
MagazineContainer.Insert(magEntity);
|
||||||
}
|
}
|
||||||
Dirty();
|
Dirty();
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
projectile =
|
projectile =
|
||||||
Owner.EntityManager.SpawnEntity(baseProjectile.Prototype?.ID, baseProjectile.Transform.Coordinates);
|
IoCManager.Resolve<IEntityManager>().SpawnEntity(baseProjectile.Prototype?.ID, baseProjectile.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
firedProjectiles[i] = projectile.Uid;
|
firedProjectiles[i] = projectile.Uid;
|
||||||
@@ -366,8 +366,8 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
projectile.Transform.WorldRotation = projectileAngle + MathHelper.PiOver2;
|
projectile.Transform.WorldRotation = projectileAngle + MathHelper.PiOver2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(OwnerUid, new GunShotEvent(firedProjectiles));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnerUid, new GunShotEvent(firedProjectiles));
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(ammo.Uid, new AmmoShotEvent(firedProjectiles));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(ammo.Uid, new AmmoShotEvent(firedProjectiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -391,7 +391,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void FireHitscan(IEntity shooter, HitscanComponent hitscan, Angle angle)
|
private void FireHitscan(IEntity shooter, HitscanComponent hitscan, Angle angle)
|
||||||
{
|
{
|
||||||
var ray = new CollisionRay(Owner.Transform.Coordinates.ToMapPos(Owner.EntityManager), angle.ToVec(), (int) hitscan.CollisionMask);
|
var ray = new CollisionRay(Owner.Transform.Coordinates.ToMapPos(IoCManager.Resolve<IEntityManager>()), angle.ToVec(), (int) hitscan.CollisionMask);
|
||||||
var physicsManager = EntitySystem.Get<SharedPhysicsSystem>();
|
var physicsManager = EntitySystem.Get<SharedPhysicsSystem>();
|
||||||
var rayCastResults = physicsManager.IntersectRay(Owner.Transform.MapID, ray, hitscan.MaxLength, shooter, false).ToList();
|
var rayCastResults = physicsManager.IntersectRay(Owner.Transform.MapID, ray, hitscan.MaxLength, shooter, false).ToList();
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ namespace Content.Shared.Body.Components
|
|||||||
|
|
||||||
foreach (var mechanism in _mechanisms)
|
foreach (var mechanism in _mechanisms)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(mechanism.OwnerUid, new AddedToBodyEvent(body));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(mechanism.OwnerUid, new AddedToBodyEvent(body));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +319,7 @@ namespace Content.Shared.Body.Components
|
|||||||
|
|
||||||
foreach (var mechanism in _mechanisms)
|
foreach (var mechanism in _mechanisms)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(mechanism.OwnerUid, new RemovedFromBodyEvent(old));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(mechanism.OwnerUid, new RemovedFromBodyEvent(old));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Shared.Body.Events;
|
using Content.Shared.Body.Events;
|
||||||
using Content.Shared.Body.Part;
|
using Content.Shared.Body.Part;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
@@ -36,11 +37,11 @@ namespace Content.Shared.Body.Components
|
|||||||
{
|
{
|
||||||
if (old.Body == null)
|
if (old.Body == null)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(OwnerUid, new RemovedFromPartEvent(old));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnerUid, new RemovedFromPartEvent(old));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(OwnerUid, new RemovedFromPartInBodyEvent(old.Body, old));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnerUid, new RemovedFromPartInBodyEvent(old.Body, old));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,11 +49,11 @@ namespace Content.Shared.Body.Components
|
|||||||
{
|
{
|
||||||
if (value.Body == null)
|
if (value.Body == null)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(OwnerUid, new AddedToPartEvent(value));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnerUid, new AddedToPartEvent(value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseLocalEvent(OwnerUid, new AddedToPartInBodyEvent(value.Body, value));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(OwnerUid, new AddedToPartInBodyEvent(value.Body, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.MobState.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;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
@@ -163,7 +164,7 @@ namespace Content.Shared.Examine
|
|||||||
public static bool InRangeUnOccluded(IEntity origin, EntityCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
|
public static bool InRangeUnOccluded(IEntity origin, EntityCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
|
||||||
{
|
{
|
||||||
var originPos = origin.Transform.MapPosition;
|
var originPos = origin.Transform.MapPosition;
|
||||||
var otherPos = other.ToMap(origin.EntityManager);
|
var otherPos = other.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||||
|
|
||||||
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
|
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
|
||||||
}
|
}
|
||||||
@@ -186,7 +187,7 @@ namespace Content.Shared.Examine
|
|||||||
public static bool InRangeUnOccluded(DragDropEvent args, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
|
public static bool InRangeUnOccluded(DragDropEvent args, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
|
||||||
{
|
{
|
||||||
var originPos = args.User.Transform.MapPosition;
|
var originPos = args.User.Transform.MapPosition;
|
||||||
var otherPos = args.DropLocation.ToMap(args.User.EntityManager);
|
var otherPos = args.DropLocation.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||||
|
|
||||||
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
|
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
|
||||||
}
|
}
|
||||||
@@ -194,7 +195,7 @@ namespace Content.Shared.Examine
|
|||||||
public static bool InRangeUnOccluded(AfterInteractEventArgs args, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
|
public static bool InRangeUnOccluded(AfterInteractEventArgs args, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
|
||||||
{
|
{
|
||||||
var originPos = args.User.Transform.MapPosition;
|
var originPos = args.User.Transform.MapPosition;
|
||||||
var otherPos = args.Target?.Transform.MapPosition ?? args.ClickLocation.ToMap(args.User.EntityManager);
|
var otherPos = args.Target?.Transform.MapPosition ?? args.ClickLocation.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||||
|
|
||||||
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
|
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace Content.Shared.Hands.Components
|
|||||||
UpdateHandVisualizer();
|
UpdateHandVisualizer();
|
||||||
Dirty();
|
Dirty();
|
||||||
|
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new HandsModifiedMessage { Hands = this });
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new HandsModifiedMessage { Hands = this });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateHandVisualizer()
|
public void UpdateHandVisualizer()
|
||||||
@@ -491,7 +491,7 @@ namespace Content.Shared.Hands.Components
|
|||||||
private Vector2 GetFinalDropCoordinates(EntityCoordinates targetCoords)
|
private Vector2 GetFinalDropCoordinates(EntityCoordinates targetCoords)
|
||||||
{
|
{
|
||||||
var origin = Owner.Transform.MapPosition;
|
var origin = Owner.Transform.MapPosition;
|
||||||
var target = targetCoords.ToMap(Owner.EntityManager);
|
var target = targetCoords.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||||
|
|
||||||
var dropVector = target.Position - origin.Position;
|
var dropVector = target.Position - origin.Position;
|
||||||
var requestedDropDistance = dropVector.Length;
|
var requestedDropDistance = dropVector.Length;
|
||||||
@@ -771,7 +771,7 @@ namespace Content.Shared.Hands.Components
|
|||||||
|
|
||||||
private void HandCountChanged()
|
private void HandCountChanged()
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new HandCountChangedEvent(Owner));
|
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new HandCountChangedEvent(Owner));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user