Inline GetComponent
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
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 static Content.Shared.AME.SharedAMEControllerComponent;
|
using static Content.Shared.AME.SharedAMEControllerComponent;
|
||||||
|
|
||||||
namespace Content.Client.AME.Visualizers
|
namespace Content.Client.AME.Visualizers
|
||||||
@@ -11,7 +12,7 @@ namespace Content.Client.AME.Visualizers
|
|||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
sprite.LayerMapSet(Layers.Display, sprite.AddLayerState("control_on"));
|
sprite.LayerMapSet(Layers.Display, sprite.AddLayerState("control_on"));
|
||||||
sprite.LayerSetVisible(Layers.Display, false);
|
sprite.LayerSetVisible(Layers.Display, false);
|
||||||
@@ -20,7 +21,7 @@ namespace Content.Client.AME.Visualizers
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
if (component.TryGetData<string>(AMEControllerVisuals.DisplayState, out var state))
|
if (component.TryGetData<string>(AMEControllerVisuals.DisplayState, out var state))
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
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 static Content.Shared.AME.SharedAMEShieldComponent;
|
using static Content.Shared.AME.SharedAMEShieldComponent;
|
||||||
|
|
||||||
namespace Content.Client.AME.Visualizers
|
namespace Content.Client.AME.Visualizers
|
||||||
@@ -11,7 +12,7 @@ namespace Content.Client.AME.Visualizers
|
|||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
sprite.LayerMapSet(Layers.Core, sprite.AddLayerState("core"));
|
sprite.LayerMapSet(Layers.Core, sprite.AddLayerState("core"));
|
||||||
sprite.LayerSetVisible(Layers.Core, false);
|
sprite.LayerSetVisible(Layers.Core, false);
|
||||||
sprite.LayerMapSet(Layers.CoreState, sprite.AddLayerState("core_weak"));
|
sprite.LayerMapSet(Layers.CoreState, sprite.AddLayerState("core_weak"));
|
||||||
@@ -21,7 +22,7 @@ namespace Content.Client.AME.Visualizers
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
if (component.TryGetData<string>(AMEShieldVisuals.Core, out var core))
|
if (component.TryGetData<string>(AMEShieldVisuals.Core, out var core))
|
||||||
{
|
{
|
||||||
if (core == "isCore")
|
if (core == "isCore")
|
||||||
|
|||||||
@@ -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.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Client.Animations
|
namespace Content.Client.Animations
|
||||||
@@ -16,7 +17,7 @@ namespace Content.Client.Animations
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
var animations = Owner.GetComponent<AnimationPlayerComponent>();
|
var animations = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(Owner.Uid);
|
||||||
animations.Play(new Animation
|
animations.Play(new Animation
|
||||||
{
|
{
|
||||||
Length = TimeSpan.FromSeconds(20),
|
Length = TimeSpan.FromSeconds(20),
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ namespace Content.Client.Animations
|
|||||||
Logger.Error("Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", entity.Name, nameof(SpriteComponent));
|
Logger.Error("Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", entity.Name, nameof(SpriteComponent));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var sprite = animatableClone.GetComponent<SpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(animatableClone.Uid);
|
||||||
sprite.CopyFrom(sprite0);
|
sprite.CopyFrom(sprite0);
|
||||||
|
|
||||||
var animations = animatableClone.GetComponent<AnimationPlayerComponent>();
|
var animations = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(animatableClone.Uid);
|
||||||
animations.AnimationCompleted += (_) => {
|
animations.AnimationCompleted += (_) => {
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(animatableClone.Uid);
|
IoCManager.Resolve<IEntityManager>().DeleteEntity(animatableClone.Uid);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Atmos.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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Atmos.Visualizers
|
namespace Content.Client.Atmos.Visualizers
|
||||||
@@ -26,7 +27,7 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
sprite.LayerMapReserveBlank(FireVisualLayers.Fire);
|
sprite.LayerMapReserveBlank(FireVisualLayers.Fire);
|
||||||
sprite.LayerSetVisible(FireVisualLayers.Fire, false);
|
sprite.LayerSetVisible(FireVisualLayers.Fire, false);
|
||||||
@@ -49,7 +50,7 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
|
|
||||||
private void SetOnFire(AppearanceComponent component, bool onFire, float fireStacks)
|
private void SetOnFire(AppearanceComponent component, bool onFire, float fireStacks)
|
||||||
{
|
{
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (_sprite != null)
|
if (_sprite != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Atmos.Visualizers
|
namespace Content.Client.Atmos.Visualizers
|
||||||
@@ -19,7 +20,7 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
sprite.LayerMapSet(Layers.PressureLight, sprite.AddLayerState(_statePressure[0]));
|
sprite.LayerMapSet(Layers.PressureLight, sprite.AddLayerState(_statePressure[0]));
|
||||||
sprite.LayerSetShader(Layers.PressureLight, "unshaded");
|
sprite.LayerSetShader(Layers.PressureLight, "unshaded");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Atmos.Piping.Unary.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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Atmos.Visualizers
|
namespace Content.Client.Atmos.Visualizers
|
||||||
@@ -16,7 +17,7 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
if (_stateConnected != null)
|
if (_stateConnected != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Botany;
|
|||||||
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.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Client.Botany
|
namespace Content.Client.Botany
|
||||||
@@ -13,7 +14,7 @@ namespace Content.Client.Botany
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
sprite.LayerMapReserveBlank(PlantHolderLayers.Plant);
|
sprite.LayerMapReserveBlank(PlantHolderLayers.Plant);
|
||||||
sprite.LayerMapReserveBlank(PlantHolderLayers.HealthLight);
|
sprite.LayerMapReserveBlank(PlantHolderLayers.HealthLight);
|
||||||
@@ -55,7 +56,7 @@ namespace Content.Client.Botany
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (component.TryGetData<SpriteSpecifier>(PlantHolderVisuals.Plant, out var specifier))
|
if (component.TryGetData<SpriteSpecifier>(PlantHolderVisuals.Plant, out var specifier))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,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.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Client.Buckle
|
namespace Content.Client.Buckle
|
||||||
@@ -30,7 +31,7 @@ namespace Content.Client.Buckle
|
|||||||
|
|
||||||
private void SetRotation(AppearanceComponent component, Angle rotation)
|
private void SetRotation(AppearanceComponent component, Angle rotation)
|
||||||
{
|
{
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -53,7 +54,7 @@ namespace Content.Client.Chemistry.Visualizers
|
|||||||
{
|
{
|
||||||
if (!state) return;
|
if (!state) return;
|
||||||
|
|
||||||
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
var animPlayer = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if(!animPlayer.HasRunningAnimation(AnimationKey))
|
if(!animPlayer.HasRunningAnimation(AnimationKey))
|
||||||
animPlayer.Play(VaporFlick, AnimationKey);
|
animPlayer.Play(VaporFlick, AnimationKey);
|
||||||
@@ -61,7 +62,7 @@ namespace Content.Client.Chemistry.Visualizers
|
|||||||
|
|
||||||
private void SetColor(AppearanceComponent component, Color color)
|
private void SetColor(AppearanceComponent component, Color color)
|
||||||
{
|
{
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
sprite.Color = color;
|
sprite.Color = color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Computer;
|
|||||||
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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Computer
|
namespace Content.Client.Computer
|
||||||
@@ -23,7 +24,7 @@ namespace Content.Client.Computer
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
sprite.LayerSetState(Layers.Screen, ScreenState);
|
sprite.LayerSetState(Layers.Screen, ScreenState);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(KeyboardState))
|
if (!string.IsNullOrEmpty(KeyboardState))
|
||||||
@@ -37,7 +38,7 @@ namespace Content.Client.Computer
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (!component.TryGetData(ComputerVisuals.Powered, out bool powered))
|
if (!component.TryGetData(ComputerVisuals.Powered, out bool powered))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -171,12 +171,12 @@ namespace Content.Client.Construction
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
var ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
||||||
var comp = ghost.GetComponent<ConstructionGhostComponent>();
|
var comp = IoCManager.Resolve<IEntityManager>().GetComponent<ConstructionGhostComponent>(ghost.Uid);
|
||||||
comp.Prototype = prototype;
|
comp.Prototype = prototype;
|
||||||
comp.GhostId = _nextId++;
|
comp.GhostId = _nextId++;
|
||||||
ghost.Transform.LocalRotation = dir.ToAngle();
|
ghost.Transform.LocalRotation = dir.ToAngle();
|
||||||
_ghosts.Add(comp.GhostId, comp);
|
_ghosts.Add(comp.GhostId, comp);
|
||||||
var sprite = ghost.GetComponent<SpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ghost.Uid);
|
||||||
sprite.Color = new Color(48, 255, 48, 128);
|
sprite.Color = new Color(48, 255, 48, 128);
|
||||||
sprite.AddBlankLayer(0); // There is no way to actually check if this already exists, so we blindly insert a new one
|
sprite.AddBlankLayer(0); // There is no way to actually check if this already exists, so we blindly insert a new one
|
||||||
sprite.LayerSetSprite(0, prototype.Icon);
|
sprite.LayerSetSprite(0, prototype.Icon);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
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;
|
||||||
|
|
||||||
namespace Content.Client.Construction
|
namespace Content.Client.Construction
|
||||||
{
|
{
|
||||||
@@ -14,7 +15,7 @@ namespace Content.Client.Construction
|
|||||||
|
|
||||||
if (component.TryGetData<int>(MachineFrameVisuals.State, out var data))
|
if (component.TryGetData<int>(MachineFrameVisuals.State, out var data))
|
||||||
{
|
{
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
sprite.LayerSetState(0, $"box_{data}");
|
sprite.LayerSetState(0, $"box_{data}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
e =>
|
e =>
|
||||||
{
|
{
|
||||||
var hash = 0;
|
var hash = 0;
|
||||||
foreach (var element in e.GetComponent<ISpriteComponent>().AllLayers.Where(obj => obj.Visible).Select(s => s.RsiState.Name))
|
foreach (var element in IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(e.Uid).AllLayers.Where(obj => obj.Visible).Select(s => s.RsiState.Name))
|
||||||
{
|
{
|
||||||
hash ^= EqualityComparer<string>.Default.GetHashCode(element!);
|
hash ^= EqualityComparer<string>.Default.GetHashCode(element!);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Crayon;
|
|||||||
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.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Client.Crayon
|
namespace Content.Client.Crayon
|
||||||
@@ -13,7 +14,7 @@ namespace Content.Client.Crayon
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<SpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (component.TryGetData(CrayonVisuals.State, out string state))
|
if (component.TryGetData(CrayonVisuals.State, out string state))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
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;
|
||||||
using static Content.Shared.Disposal.Components.SharedDisposalUnitComponent;
|
using static Content.Shared.Disposal.Components.SharedDisposalUnitComponent;
|
||||||
@@ -88,7 +89,7 @@ namespace Content.Client.Disposal.Visualizers
|
|||||||
case VisualState.Flushing:
|
case VisualState.Flushing:
|
||||||
sprite.LayerSetState(DisposalUnitVisualLayers.Base, _stateAnchored);
|
sprite.LayerSetState(DisposalUnitVisualLayers.Base, _stateAnchored);
|
||||||
|
|
||||||
var animPlayer = appearance.Owner.GetComponent<AnimationPlayerComponent>();
|
var animPlayer = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(appearance.Owner.Uid);
|
||||||
|
|
||||||
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -122,8 +122,8 @@ namespace Content.Client.Doors
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
var animPlayer = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(component.Owner.Uid);
|
||||||
if (!component.TryGetData(DoorVisuals.VisualState, out DoorVisualState state))
|
if (!component.TryGetData(DoorVisuals.VisualState, out DoorVisualState state))
|
||||||
{
|
{
|
||||||
state = DoorVisualState.Closed;
|
state = DoorVisualState.Closed;
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ namespace Content.Client.DragDrop
|
|||||||
// pop up drag shadow under mouse
|
// pop up drag shadow under mouse
|
||||||
var mousePos = _eyeManager.ScreenToMap(_dragDropHelper.MouseScreenPosition);
|
var mousePos = _eyeManager.ScreenToMap(_dragDropHelper.MouseScreenPosition);
|
||||||
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
||||||
var dragSprite = _dragShadow.GetComponent<SpriteComponent>();
|
var dragSprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(_dragShadow.Uid);
|
||||||
dragSprite.CopyFrom(draggedSprite);
|
dragSprite.CopyFrom(draggedSprite);
|
||||||
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
||||||
dragSprite.Color = dragSprite.Color.WithAlpha(0.7f);
|
dragSprite.Color = dragSprite.Color.WithAlpha(0.7f);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Extinguisher;
|
|||||||
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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Extinguisher
|
namespace Content.Client.Extinguisher
|
||||||
@@ -26,7 +27,7 @@ namespace Content.Client.Extinguisher
|
|||||||
|
|
||||||
private void SetSafety(AppearanceComponent component, bool safety)
|
private void SetSafety(AppearanceComponent component, bool safety)
|
||||||
{
|
{
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
sprite.LayerSetState(FireExtinguisherVisualLayers.Base, safety ? _safetyOnState : _safetyOffState);
|
sprite.LayerSetState(FireExtinguisherVisualLayers.Base, safety ? _safetyOnState : _safetyOffState);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Gravity;
|
|||||||
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.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ namespace Content.Client.Gravity
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<SpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (component.TryGetData(GravityGeneratorVisuals.State, out GravityGeneratorStatus state))
|
if (component.TryGetData(GravityGeneratorVisuals.State, out GravityGeneratorStatus state))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Robust.Client.GameObjects;
|
|||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -33,7 +34,7 @@ namespace Content.Client.Gravity.UI
|
|||||||
OnButton.OnPressed += _ => _owner.SetPowerSwitch(true);
|
OnButton.OnPressed += _ => _owner.SetPowerSwitch(true);
|
||||||
OffButton.OnPressed += _ => _owner.SetPowerSwitch(false);
|
OffButton.OnPressed += _ => _owner.SetPowerSwitch(false);
|
||||||
|
|
||||||
EntityView.Sprite = component.Owner.GetComponent<SpriteComponent>();
|
EntityView.Sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(component.Owner.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateState(SharedGravityGeneratorComponent.GeneratorState state)
|
public void UpdateState(SharedGravityGeneratorComponent.GeneratorState state)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
Sprite = Owner.GetComponent<ISpriteComponent>();
|
Sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(Owner.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ namespace Content.Client.Items.Managers
|
|||||||
|
|
||||||
// Set green / red overlay at 50% transparency
|
// Set green / red overlay at 50% transparency
|
||||||
var hoverEntity = _entityManager.SpawnEntity("hoverentity", MapCoordinates.Nullspace);
|
var hoverEntity = _entityManager.SpawnEntity("hoverentity", MapCoordinates.Nullspace);
|
||||||
var hoverSprite = hoverEntity.GetComponent<SpriteComponent>();
|
var hoverSprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(hoverEntity.Uid);
|
||||||
hoverSprite.CopyFrom(entity.GetComponent<SpriteComponent>());
|
hoverSprite.CopyFrom(IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(entity.Uid));
|
||||||
hoverSprite.Color = fits ? new Color(0, 255, 0, 127) : new Color(255, 0, 0, 127);
|
hoverSprite.Color = fits ? new Color(0, 255, 0, 127) : new Color(255, 0, 0, 127);
|
||||||
|
|
||||||
button.HoverSpriteView.Sprite = hoverSprite;
|
button.HoverSpriteView.Sprite = hoverSprite;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Robust.Client.UserInterface.Controls;
|
|||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
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.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -98,7 +99,7 @@ namespace Content.Client.Kitchen.UI
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var texture = entity.GetComponent<SpriteComponent>().Icon?.Default;
|
var texture = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(entity.Uid).Icon?.Default;
|
||||||
|
|
||||||
var solidItem = ChamberContentBox.BoxContents.AddItem(entity.Name, texture);
|
var solidItem = ChamberContentBox.BoxContents.AddItem(entity.Name, texture);
|
||||||
var solidIndex = ChamberContentBox.BoxContents.IndexOf(solidItem);
|
var solidIndex = ChamberContentBox.BoxContents.IndexOf(solidItem);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Power;
|
|||||||
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.Log;
|
using Robust.Shared.Log;
|
||||||
|
|
||||||
namespace Content.Client.Kitchen.Visualizers
|
namespace Content.Client.Kitchen.Visualizers
|
||||||
@@ -15,7 +16,7 @@ namespace Content.Client.Kitchen.Visualizers
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
var microwaveComponent = component.Owner.GetComponentOrNull<MicrowaveComponent>();
|
var microwaveComponent = component.Owner.GetComponentOrNull<MicrowaveComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using static Content.Shared.Kitchen.Components.SharedReagentGrinderComponent;
|
using static Content.Shared.Kitchen.Components.SharedReagentGrinderComponent;
|
||||||
|
|
||||||
namespace Content.Client.Kitchen.Visualizers
|
namespace Content.Client.Kitchen.Visualizers
|
||||||
@@ -9,7 +10,7 @@ namespace Content.Client.Kitchen.Visualizers
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
component.TryGetData(ReagentGrinderVisualState.BeakerAttached, out bool hasBeaker);
|
component.TryGetData(ReagentGrinderVisualState.BeakerAttached, out bool hasBeaker);
|
||||||
sprite.LayerSetState(0, $"juicer{(hasBeaker ? "1" : "0")}");
|
sprite.LayerSetState(0, $"juicer{(hasBeaker ? "1" : "0")}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ namespace Content.Client.Lathe.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
var animPlayer = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(component.Owner.Uid);
|
||||||
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state))
|
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state))
|
||||||
{
|
{
|
||||||
state = LatheVisualState.Idle;
|
state = LatheVisualState.Idle;
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ namespace Content.Client.Lathe.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
var animPlayer = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(component.Owner.Uid);
|
||||||
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state))
|
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state))
|
||||||
{
|
{
|
||||||
state = LatheVisualState.Idle;
|
state = LatheVisualState.Idle;
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace Content.Client.Lobby.UI
|
|||||||
{
|
{
|
||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
Sprite = entity.GetComponent<ISpriteComponent>(),
|
Sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid),
|
||||||
OverrideDirection = direction,
|
OverrideDirection = direction,
|
||||||
Scale = (2, 2)
|
Scale = (2, 2)
|
||||||
};
|
};
|
||||||
@@ -140,7 +140,7 @@ namespace Content.Client.Lobby.UI
|
|||||||
{
|
{
|
||||||
var protoMan = IoCManager.Resolve<IPrototypeManager>();
|
var protoMan = IoCManager.Resolve<IPrototypeManager>();
|
||||||
|
|
||||||
var inventory = dummy.GetComponent<ClientInventoryComponent>();
|
var inventory = IoCManager.Resolve<IEntityManager>().GetComponent<ClientInventoryComponent>(dummy.Uid);
|
||||||
|
|
||||||
var highPriorityJob = profile.JobPriorities.FirstOrDefault(p => p.Value == JobPriority.High).Key;
|
var highPriorityJob = profile.JobPriorities.FirstOrDefault(p => p.Value == JobPriority.High).Key;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
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 static Content.Shared.MedicalScanner.SharedMedicalScannerComponent;
|
using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent;
|
||||||
using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent.MedicalScannerStatus;
|
using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent.MedicalScannerStatus;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace Content.Client.MedicalScanner
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
if (!component.TryGetData(MedicalScannerVisuals.Status, out MedicalScannerStatus status)) return;
|
if (!component.TryGetData(MedicalScannerVisuals.Status, out MedicalScannerStatus status)) return;
|
||||||
sprite.LayerSetState(MedicalScannerVisualLayers.Machine, StatusToMachineStateId(status));
|
sprite.LayerSetState(MedicalScannerVisualLayers.Machine, StatusToMachineStateId(status));
|
||||||
sprite.LayerSetState(MedicalScannerVisualLayers.Terminal, StatusToTerminalStateId(status));
|
sprite.LayerSetState(MedicalScannerVisualLayers.Terminal, StatusToTerminalStateId(status));
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.MobState;
|
|||||||
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.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
|
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
|
||||||
@@ -51,7 +52,7 @@ namespace Content.Client.MobState
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
if (!component.TryGetData(DamageStateVisuals.State, out DamageState data))
|
if (!component.TryGetData(DamageStateVisuals.State, out DamageState data))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Nutrition.Visualizers
|
namespace Content.Client.Nutrition.Visualizers
|
||||||
@@ -16,7 +17,7 @@ namespace Content.Client.Nutrition.Visualizers
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
sprite.LayerMapReserveBlank(CreamPiedVisualLayers.Pie);
|
sprite.LayerMapReserveBlank(CreamPiedVisualLayers.Pie);
|
||||||
sprite.LayerSetRSI(CreamPiedVisualLayers.Pie, "Effects/creampie.rsi");
|
sprite.LayerSetRSI(CreamPiedVisualLayers.Pie, "Effects/creampie.rsi");
|
||||||
@@ -35,7 +36,7 @@ namespace Content.Client.Nutrition.Visualizers
|
|||||||
|
|
||||||
private void SetPied(AppearanceComponent component, bool pied)
|
private void SetPied(AppearanceComponent component, bool pied)
|
||||||
{
|
{
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
sprite.LayerSetVisible(CreamPiedVisualLayers.Pie, pied);
|
sprite.LayerSetVisible(CreamPiedVisualLayers.Pie, pied);
|
||||||
sprite.LayerSetState(CreamPiedVisualLayers.Pie, _state);
|
sprite.LayerSetState(CreamPiedVisualLayers.Pie, _state);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.PDA;
|
|||||||
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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.PDA
|
namespace Content.Client.PDA
|
||||||
@@ -27,7 +28,7 @@ namespace Content.Client.PDA
|
|||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
if (_state != null)
|
if (_state != null)
|
||||||
{
|
{
|
||||||
@@ -45,7 +46,7 @@ namespace Content.Client.PDA
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
sprite.LayerSetVisible(PDAVisualLayers.Flashlight, false);
|
sprite.LayerSetVisible(PDAVisualLayers.Flashlight, false);
|
||||||
if (component.TryGetData(UnpoweredFlashlightVisuals.LightOn, out bool isFlashlightOn))
|
if (component.TryGetData(UnpoweredFlashlightVisuals.LightOn, out bool isFlashlightOn))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,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.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Client.Pointing
|
namespace Content.Client.Pointing
|
||||||
@@ -24,7 +25,7 @@ namespace Content.Client.Pointing
|
|||||||
|
|
||||||
private void SetRotation(AppearanceComponent component, Angle rotation)
|
private void SetRotation(AppearanceComponent component, Angle rotation)
|
||||||
{
|
{
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.APC;
|
|||||||
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;
|
||||||
|
|
||||||
namespace Content.Client.Power.APC
|
namespace Content.Client.Power.APC
|
||||||
{
|
{
|
||||||
@@ -12,7 +13,7 @@ namespace Content.Client.Power.APC
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
sprite.LayerMapSet(Layers.ChargeState, sprite.AddLayerState("apco3-0"));
|
sprite.LayerMapSet(Layers.ChargeState, sprite.AddLayerState("apco3-0"));
|
||||||
sprite.LayerSetShader(Layers.ChargeState, "unshaded");
|
sprite.LayerSetShader(Layers.ChargeState, "unshaded");
|
||||||
@@ -34,7 +35,7 @@ namespace Content.Client.Power.APC
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
if (component.TryGetData<ApcChargeState>(ApcVisuals.ChargeState, out var state))
|
if (component.TryGetData<ApcChargeState>(ApcVisuals.ChargeState, out var state))
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.SMES;
|
|||||||
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;
|
||||||
|
|
||||||
namespace Content.Client.Power.SMES
|
namespace Content.Client.Power.SMES
|
||||||
{
|
{
|
||||||
@@ -13,7 +14,7 @@ namespace Content.Client.Power.SMES
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
sprite.LayerMapSet(Layers.Input, sprite.AddLayerState("smes-oc0"));
|
sprite.LayerMapSet(Layers.Input, sprite.AddLayerState("smes-oc0"));
|
||||||
sprite.LayerSetShader(Layers.Input, "unshaded");
|
sprite.LayerSetShader(Layers.Input, "unshaded");
|
||||||
@@ -28,7 +29,7 @@ namespace Content.Client.Power.SMES
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
if (!component.TryGetData<int>(SmesVisuals.LastChargeLevel, out var level) || level == 0)
|
if (!component.TryGetData<int>(SmesVisuals.LastChargeLevel, out var level) || level == 0)
|
||||||
{
|
{
|
||||||
sprite.LayerSetVisible(Layers.Charge, false);
|
sprite.LayerSetVisible(Layers.Charge, false);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Power;
|
|||||||
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;
|
||||||
|
|
||||||
namespace Content.Client.Power
|
namespace Content.Client.Power
|
||||||
{
|
{
|
||||||
@@ -12,7 +13,7 @@ namespace Content.Client.Power
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
var powered = component.TryGetData(PowerDeviceVisuals.Powered, out bool poweredVar) && poweredVar;
|
var powered = component.TryGetData(PowerDeviceVisuals.Powered, out bool poweredVar) && poweredVar;
|
||||||
sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered);
|
sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.PowerCell;
|
|||||||
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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.PowerCell
|
namespace Content.Client.PowerCell
|
||||||
@@ -16,7 +17,7 @@ namespace Content.Client.PowerCell
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
if (_prefix != null)
|
if (_prefix != null)
|
||||||
{
|
{
|
||||||
@@ -29,7 +30,7 @@ namespace Content.Client.PowerCell
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
if (component.TryGetData(PowerCellVisuals.ChargeLevel, out byte level))
|
if (component.TryGetData(PowerCellVisuals.ChargeLevel, out byte level))
|
||||||
{
|
{
|
||||||
var adjustedLevel = level * 25;
|
var adjustedLevel = level * 25;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Power;
|
|||||||
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;
|
||||||
|
|
||||||
namespace Content.Client.PowerCell
|
namespace Content.Client.PowerCell
|
||||||
{
|
{
|
||||||
@@ -12,7 +13,7 @@ namespace Content.Client.PowerCell
|
|||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
// Base item
|
// Base item
|
||||||
sprite.LayerMapSet(Layers.Base, sprite.AddLayerState("empty"));
|
sprite.LayerMapSet(Layers.Base, sprite.AddLayerState("empty"));
|
||||||
@@ -26,7 +27,7 @@ namespace Content.Client.PowerCell
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
// Update base item
|
// Update base item
|
||||||
if (component.TryGetData(CellVisual.Occupied, out bool occupied))
|
if (component.TryGetData(CellVisual.Occupied, out bool occupied))
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ namespace Content.Client.Preferences.UI
|
|||||||
|
|
||||||
var view = new SpriteView
|
var view = new SpriteView
|
||||||
{
|
{
|
||||||
Sprite = _previewDummy.GetComponent<SpriteComponent>(),
|
Sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(_previewDummy.Uid),
|
||||||
Scale = (2, 2),
|
Scale = (2, 2),
|
||||||
OverrideDirection = Direction.South
|
OverrideDirection = Direction.South
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ namespace Content.Client.Preferences.UI
|
|||||||
#region Preview
|
#region Preview
|
||||||
|
|
||||||
_previewDummy = entityManager.SpawnEntity("MobHumanDummy", MapCoordinates.Nullspace);
|
_previewDummy = entityManager.SpawnEntity("MobHumanDummy", MapCoordinates.Nullspace);
|
||||||
var sprite = _previewDummy.GetComponent<SpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(_previewDummy.Uid);
|
||||||
|
|
||||||
// Front
|
// Front
|
||||||
_previewSprite = new SpriteView
|
_previewSprite = new SpriteView
|
||||||
|
|||||||
@@ -5,6 +5,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.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Client.Rotation
|
namespace Content.Client.Rotation
|
||||||
@@ -32,7 +33,7 @@ namespace Content.Client.Rotation
|
|||||||
|
|
||||||
private void SetRotation(AppearanceComponent component, Angle rotation)
|
private void SetRotation(AppearanceComponent component, Angle rotation)
|
||||||
{
|
{
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent? animation))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ namespace Content.Client.Trigger
|
|||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
var animPlayer = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(component.Owner.Uid);
|
||||||
if (!component.TryGetData(TriggerVisuals.VisualState, out TriggerVisualState state))
|
if (!component.TryGetData(TriggerVisuals.VisualState, out TriggerVisualState state))
|
||||||
{
|
{
|
||||||
state = TriggerVisualState.Unprimed;
|
state = TriggerVisualState.Unprimed;
|
||||||
|
|||||||
@@ -141,8 +141,8 @@ namespace Content.Client.VendingMachines.UI
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
var animPlayer = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(component.Owner.Uid);
|
||||||
if (!component.TryGetData(VendingMachineVisuals.VisualState, out VendingMachineVisualState state))
|
if (!component.TryGetData(VendingMachineVisuals.VisualState, out VendingMachineVisualState state))
|
||||||
{
|
{
|
||||||
state = VendingMachineVisualState.Normal;
|
state = VendingMachineVisualState.Normal;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Client.Wall.Components
|
|||||||
_overlayEntity.Transform.AttachParent(Owner);
|
_overlayEntity.Transform.AttachParent(Owner);
|
||||||
_overlayEntity.Transform.LocalPosition = Vector2.Zero;
|
_overlayEntity.Transform.LocalPosition = Vector2.Zero;
|
||||||
|
|
||||||
_overlaySprite = _overlayEntity.GetComponent<ISpriteComponent>();
|
_overlaySprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(_overlayEntity.Uid);
|
||||||
|
|
||||||
var overState0 = $"{StateBase}over_0";
|
var overState0 = $"{StateBase}over_0";
|
||||||
_overlaySprite.LayerMapSet(OverCornerLayers.SE, _overlaySprite.AddLayerState(overState0));
|
_overlaySprite.LayerMapSet(OverCornerLayers.SE, _overlaySprite.AddLayerState(overState0));
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Content.Client.Weapons.Melee.Components
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
_sprite = Owner.GetComponent<SpriteComponent>();
|
_sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(Owner.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, IEntity attacker, bool followAttacker = true)
|
public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, IEntity attacker, bool followAttacker = true)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace Content.Client.Weapons.Melee
|
|||||||
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.Coordinates);
|
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.Coordinates);
|
||||||
entity.Transform.LocalRotation = msg.Angle;
|
entity.Transform.LocalRotation = msg.Angle;
|
||||||
|
|
||||||
var weaponArcAnimation = entity.GetComponent<MeleeWeaponArcAnimationComponent>();
|
var weaponArcAnimation = IoCManager.Resolve<IEntityManager>().GetComponent<MeleeWeaponArcAnimationComponent>(entity.Uid);
|
||||||
weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker);
|
weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker);
|
||||||
|
|
||||||
// Due to ISpriteComponent limitations, weapons that don't use an RSI won't have this effect.
|
// Due to ISpriteComponent limitations, weapons that don't use an RSI won't have this effect.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Weapons.Ranged.Barrels.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;
|
||||||
|
|
||||||
namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
||||||
{
|
{
|
||||||
@@ -11,14 +12,14 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
|||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
sprite.LayerSetState(RangedBarrelVisualLayers.Bolt, "bolt-open");
|
sprite.LayerSetState(RangedBarrelVisualLayers.Bolt, "bolt-open");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (!component.TryGetData(BarrelBoltVisuals.BoltOpen, out bool boltOpen))
|
if (!component.TryGetData(BarrelBoltVisuals.BoltOpen, out bool boltOpen))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Weapons.Ranged.Barrels.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.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
||||||
@@ -21,7 +22,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
|||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity.Uid);
|
||||||
|
|
||||||
if (sprite.LayerMapTryGet(RangedBarrelVisualLayers.Mag, out _))
|
if (sprite.LayerMapTryGet(RangedBarrelVisualLayers.Mag, out _))
|
||||||
{
|
{
|
||||||
@@ -44,7 +45,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
|||||||
// 1.If no mag then hide it OR
|
// 1.If no mag then hide it OR
|
||||||
// 2. If step 0 isn't visible then hide it (mag or unshaded)
|
// 2. If step 0 isn't visible then hide it (mag or unshaded)
|
||||||
// 3. Otherwise just do mag / unshaded as is
|
// 3. Otherwise just do mag / unshaded as is
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
component.TryGetData(MagazineBarrelVisuals.MagLoaded, out _magLoaded);
|
component.TryGetData(MagazineBarrelVisuals.MagLoaded, out _magLoaded);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Weapons.Ranged.Barrels.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;
|
||||||
|
|
||||||
namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
||||||
{
|
{
|
||||||
@@ -11,7 +12,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
|
|
||||||
if (!component.TryGetData(AmmoVisuals.Spent, out bool spent))
|
if (!component.TryGetData(AmmoVisuals.Spent, out bool spent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using static Content.Shared.Wires.SharedWiresComponent;
|
using static Content.Shared.Wires.SharedWiresComponent;
|
||||||
|
|
||||||
namespace Content.Client.Wires.Visualizers
|
namespace Content.Client.Wires.Visualizers
|
||||||
@@ -9,7 +10,7 @@ namespace Content.Client.Wires.Visualizers
|
|||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
|
||||||
if (component.TryGetData<bool>(WiresVisuals.MaintenancePanelState, out var state))
|
if (component.TryGetData<bool>(WiresVisuals.MaintenancePanelState, out var state))
|
||||||
{
|
{
|
||||||
sprite.LayerSetVisible(WiresVisualLayers.MaintenancePanel, state);
|
sprite.LayerSetVisible(WiresVisualLayers.MaintenancePanel, state);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using NUnit.Framework;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared;
|
using Robust.Shared;
|
||||||
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;
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f));
|
var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f));
|
||||||
ent.Transform.LocalRotation = angle;
|
ent.Transform.LocalRotation = angle;
|
||||||
ent.GetComponent<SpriteComponent>().Scale = (scale, scale);
|
IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ent.Uid).Scale = (scale, scale);
|
||||||
entity = ent.Uid;
|
entity = ent.Uid;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
await _client.WaitPost(() =>
|
await _client.WaitPost(() =>
|
||||||
{
|
{
|
||||||
var ent = clientEntManager.GetEntity(entity);
|
var ent = clientEntManager.GetEntity(entity);
|
||||||
var clickable = ent.GetComponent<ClickableComponent>();
|
var clickable = IoCManager.Resolve<IEntityManager>().GetComponent<ClickableComponent>(ent.Uid);
|
||||||
|
|
||||||
hit = clickable.CheckClick((clickPosX, clickPosY) + worldPos!.Value, out _, out _);
|
hit = clickable.CheckClick((clickPosX, clickPosY) + worldPos!.Value, out _, out _);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||||
dummyUid = dummy.Uid;
|
dummyUid = dummy.Uid;
|
||||||
|
|
||||||
container.GetComponent<EntityStorageComponent>().Insert(dummy);
|
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(container.Uid).Insert(dummy);
|
||||||
});
|
});
|
||||||
|
|
||||||
await RunTicksSync(c, s, 5);
|
await RunTicksSync(c, s, 5);
|
||||||
@@ -91,8 +91,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
c.Assert(() =>
|
c.Assert(() =>
|
||||||
{
|
{
|
||||||
var dummy = IoCManager.Resolve<IEntityManager>().GetEntity(dummyUid);
|
var dummy = IoCManager.Resolve<IEntityManager>().GetEntity(dummyUid);
|
||||||
var sprite = dummy.GetComponent<SpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(dummy.Uid);
|
||||||
var light = dummy.GetComponent<PointLightComponent>();
|
var light = IoCManager.Resolve<IEntityManager>().GetComponent<PointLightComponent>(dummy.Uid);
|
||||||
Assert.True(sprite.ContainerOccluded);
|
Assert.True(sprite.ContainerOccluded);
|
||||||
Assert.True(light.ContainerOccluded);
|
Assert.True(light.ContainerOccluded);
|
||||||
});
|
});
|
||||||
@@ -114,7 +114,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||||
dummyUid = dummy.Uid;
|
dummyUid = dummy.Uid;
|
||||||
|
|
||||||
container.GetComponent<EntityStorageComponent>().Insert(dummy);
|
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(container.Uid).Insert(dummy);
|
||||||
});
|
});
|
||||||
|
|
||||||
await RunTicksSync(c, s, 5);
|
await RunTicksSync(c, s, 5);
|
||||||
@@ -122,8 +122,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
c.Assert(() =>
|
c.Assert(() =>
|
||||||
{
|
{
|
||||||
var dummy = IoCManager.Resolve<IEntityManager>().GetEntity(dummyUid);
|
var dummy = IoCManager.Resolve<IEntityManager>().GetEntity(dummyUid);
|
||||||
var sprite = dummy.GetComponent<SpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(dummy.Uid);
|
||||||
var light = dummy.GetComponent<PointLightComponent>();
|
var light = IoCManager.Resolve<IEntityManager>().GetComponent<PointLightComponent>(dummy.Uid);
|
||||||
Assert.False(sprite.ContainerOccluded);
|
Assert.False(sprite.ContainerOccluded);
|
||||||
Assert.False(light.ContainerOccluded);
|
Assert.False(light.ContainerOccluded);
|
||||||
});
|
});
|
||||||
@@ -146,8 +146,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||||
dummyUid = dummy.Uid;
|
dummyUid = dummy.Uid;
|
||||||
|
|
||||||
containerA.GetComponent<EntityStorageComponent>().Insert(containerB);
|
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(containerA.Uid).Insert(containerB);
|
||||||
containerB.GetComponent<EntityStorageComponent>().Insert(dummy);
|
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(containerB.Uid).Insert(dummy);
|
||||||
});
|
});
|
||||||
|
|
||||||
await RunTicksSync(c, s, 5);
|
await RunTicksSync(c, s, 5);
|
||||||
@@ -155,8 +155,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
c.Assert(() =>
|
c.Assert(() =>
|
||||||
{
|
{
|
||||||
var dummy = IoCManager.Resolve<IEntityManager>().GetEntity(dummyUid);
|
var dummy = IoCManager.Resolve<IEntityManager>().GetEntity(dummyUid);
|
||||||
var sprite = dummy.GetComponent<SpriteComponent>();
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(dummy.Uid);
|
||||||
var light = dummy.GetComponent<PointLightComponent>();
|
var light = IoCManager.Resolve<IEntityManager>().GetComponent<PointLightComponent>(dummy.Uid);
|
||||||
Assert.True(sprite.ContainerOccluded);
|
Assert.True(sprite.ContainerOccluded);
|
||||||
Assert.True(light.ContainerOccluded);
|
Assert.True(light.ContainerOccluded);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Damage.Prototypes;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
@@ -118,7 +119,7 @@ namespace Content.IntegrationTests.Tests.Damageable
|
|||||||
sMapManager.CreateMap(mapId);
|
sMapManager.CreateMap(mapId);
|
||||||
|
|
||||||
sDamageableEntity = sEntityManager.SpawnEntity("TestDamageableEntityId", coordinates);
|
sDamageableEntity = sEntityManager.SpawnEntity("TestDamageableEntityId", coordinates);
|
||||||
sDamageableComponent = sDamageableEntity.GetComponent<DamageableComponent>();
|
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDamageableEntity.Uid);
|
||||||
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
|
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
|
||||||
|
|
||||||
group1 = sPrototypeManager.Index<DamageGroupPrototype>("TestGroup1");
|
group1 = sPrototypeManager.Index<DamageGroupPrototype>("TestGroup1");
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Shared.Damage.Prototypes;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
||||||
@@ -42,7 +43,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
||||||
|
|
||||||
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageGroupEntityId, coordinates);
|
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageGroupEntityId, coordinates);
|
||||||
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity.Uid);
|
||||||
|
|
||||||
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
||||||
sTestThresholdListenerSystem.ThresholdsReached.Clear();
|
sTestThresholdListenerSystem.ThresholdsReached.Clear();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
||||||
|
|
||||||
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageTypeEntityId, coordinates);
|
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageTypeEntityId, coordinates);
|
||||||
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity.Uid);
|
||||||
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
||||||
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
|
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
||||||
|
|
||||||
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates);
|
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates);
|
||||||
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity.Uid);
|
||||||
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Damage.Prototypes;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
using static Content.IntegrationTests.Tests.Destructible.DestructibleTestPrototypes;
|
||||||
@@ -47,8 +48,8 @@ namespace Content.IntegrationTests.Tests.Destructible
|
|||||||
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
var coordinates = new EntityCoordinates(gridId, 0, 0);
|
||||||
|
|
||||||
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleEntityId, coordinates);
|
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleEntityId, coordinates);
|
||||||
sDamageableComponent = sDestructibleEntity.GetComponent<DamageableComponent>();
|
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity.Uid);
|
||||||
sDestructibleComponent = sDestructibleEntity.GetComponent<DestructibleComponent>();
|
sDestructibleComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DestructibleComponent>(sDestructibleEntity.Uid);
|
||||||
|
|
||||||
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
|
||||||
sTestThresholdListenerSystem.ThresholdsReached.Clear();
|
sTestThresholdListenerSystem.ThresholdsReached.Clear();
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
|||||||
for (var i = 0; i < 240; i += 10)
|
for (var i = 0; i < 240; i += 10)
|
||||||
{
|
{
|
||||||
// Keep the airlock awake so they collide
|
// Keep the airlock awake so they collide
|
||||||
server.Post(() => airlock.GetComponent<IPhysBody>().WakeBody());
|
server.Post(() => IoCManager.Resolve<IEntityManager>().GetComponent<IPhysBody>(airlock.Uid).WakeBody());
|
||||||
|
|
||||||
await server.WaitRunTicks(10);
|
await server.WaitRunTicks(10);
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
// Check that the puddle was created
|
// Check that the puddle was created
|
||||||
Assert.NotNull(puddle);
|
Assert.NotNull(puddle);
|
||||||
|
|
||||||
evaporation = puddle.Owner.GetComponent<EvaporationComponent>();
|
evaporation = IoCManager.Resolve<IEntityManager>().GetComponent<EvaporationComponent>(puddle.Owner.Uid);
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1445
|
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1445
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Robust.Client.UserInterface;
|
|||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared;
|
using Robust.Shared;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -71,7 +72,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||||
var actionsComponent = playerEnt!.GetComponent<ServerActionsComponent>();
|
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt!.Uid);
|
||||||
|
|
||||||
// player should begin with their innate actions granted
|
// player should begin with their innate actions granted
|
||||||
innateActions.AddRange(actionsComponent.InnateActions);
|
innateActions.AddRange(actionsComponent.InnateActions);
|
||||||
@@ -98,7 +99,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
var local = clientPlayerMgr.LocalPlayer;
|
var local = clientPlayerMgr.LocalPlayer;
|
||||||
var controlled = local!.ControlledEntity;
|
var controlled = local!.ControlledEntity;
|
||||||
var actionsComponent = controlled!.GetComponent<ClientActionsComponent>();
|
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!.Uid);
|
||||||
|
|
||||||
// we should have our innate actions and debug1.
|
// we should have our innate actions and debug1.
|
||||||
foreach (var innateAction in innateActions)
|
foreach (var innateAction in innateActions)
|
||||||
@@ -153,7 +154,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||||
var actionsComponent = playerEnt!.GetComponent<ServerActionsComponent>();
|
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt!.Uid);
|
||||||
actionsComponent.Revoke(ActionType.DebugInstant);
|
actionsComponent.Revoke(ActionType.DebugInstant);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -164,7 +165,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
var local = clientPlayerMgr.LocalPlayer;
|
var local = clientPlayerMgr.LocalPlayer;
|
||||||
var controlled = local!.ControlledEntity;
|
var controlled = local!.ControlledEntity;
|
||||||
var actionsComponent = controlled!.GetComponent<ClientActionsComponent>();
|
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!.Uid);
|
||||||
|
|
||||||
// we should have our innate actions, but debug1 should be revoked
|
// we should have our innate actions, but debug1 should be revoked
|
||||||
foreach (var innateAction in innateActions)
|
foreach (var innateAction in innateActions)
|
||||||
@@ -245,7 +246,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
serverPlayerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
serverPlayerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||||
serverActionsComponent = serverPlayerEnt!.GetComponent<ServerActionsComponent>();
|
serverActionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(serverPlayerEnt!.Uid);
|
||||||
|
|
||||||
// spawn and give them an item that has actions
|
// spawn and give them an item that has actions
|
||||||
serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight",
|
serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight",
|
||||||
@@ -259,7 +260,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
|
|
||||||
// grant an extra item action, before pickup, initially disabled
|
// grant an extra item action, before pickup, initially disabled
|
||||||
itemActions.GrantOrUpdate(ItemActionType.DebugToggle, false);
|
itemActions.GrantOrUpdate(ItemActionType.DebugToggle, false);
|
||||||
serverPlayerEnt.GetComponent<HandsComponent>().PutInHand(serverFlashlight.GetComponent<ItemComponent>(), false);
|
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt.Uid).PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(serverFlashlight.Uid), false);
|
||||||
// grant an extra item action, after pickup, with a cooldown
|
// grant an extra item action, after pickup, with a cooldown
|
||||||
itemActions.GrantOrUpdate(ItemActionType.DebugInstant, cooldown: cooldown);
|
itemActions.GrantOrUpdate(ItemActionType.DebugInstant, cooldown: cooldown);
|
||||||
|
|
||||||
@@ -285,7 +286,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
var local = clientPlayerMgr.LocalPlayer;
|
var local = clientPlayerMgr.LocalPlayer;
|
||||||
var controlled = local!.ControlledEntity;
|
var controlled = local!.ControlledEntity;
|
||||||
clientActionsComponent = controlled!.GetComponent<ClientActionsComponent>();
|
clientActionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!.Uid);
|
||||||
|
|
||||||
var lightEntry = clientActionsComponent.ItemActionStates()
|
var lightEntry = clientActionsComponent.ItemActionStates()
|
||||||
.Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight))
|
.Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight))
|
||||||
@@ -333,7 +334,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
// drop the item, and the item actions should go away
|
// drop the item, and the item actions should go away
|
||||||
serverPlayerEnt.GetComponent<HandsComponent>()
|
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt.Uid)
|
||||||
.TryDropEntity(serverFlashlight, serverPlayerEnt.Transform.Coordinates, false);
|
.TryDropEntity(serverFlashlight, serverPlayerEnt.Transform.Coordinates, false);
|
||||||
Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight.Uid), Is.False);
|
Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight.Uid), Is.False);
|
||||||
});
|
});
|
||||||
@@ -351,7 +352,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
// pick the item up again, the states should be back to what they were when dropped,
|
// pick the item up again, the states should be back to what they were when dropped,
|
||||||
// as the states "stick" with the item
|
// as the states "stick" with the item
|
||||||
serverPlayerEnt.GetComponent<HandsComponent>().PutInHand(serverFlashlight.GetComponent<ItemComponent>(), false);
|
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt.Uid).PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(serverFlashlight.Uid), false);
|
||||||
Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight.Uid, out var lightStates));
|
Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight.Uid, out var lightStates));
|
||||||
Assert.That(lightStates.TryGetValue(ItemActionType.ToggleLight, out var lightState));
|
Assert.That(lightStates.TryGetValue(ItemActionType.ToggleLight, out var lightState));
|
||||||
Assert.That(lightState.Equals(new ActionState(true, toggledOn: true)));
|
Assert.That(lightState.Equals(new ActionState(true, toggledOn: true)));
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ using Content.Shared.Alert;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||||
{
|
{
|
||||||
@@ -29,7 +31,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||||
Assert.NotNull(playerEnt);
|
Assert.NotNull(playerEnt);
|
||||||
var alertsComponent = playerEnt.GetComponent<ServerAlertsComponent>();
|
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt.Uid);
|
||||||
Assert.NotNull(alertsComponent);
|
Assert.NotNull(alertsComponent);
|
||||||
|
|
||||||
// show 2 alerts
|
// show 2 alerts
|
||||||
@@ -49,7 +51,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
Assert.NotNull(local);
|
Assert.NotNull(local);
|
||||||
var controlled = local.ControlledEntity;
|
var controlled = local.ControlledEntity;
|
||||||
Assert.NotNull(controlled);
|
Assert.NotNull(controlled);
|
||||||
var alertsComponent = controlled.GetComponent<ClientAlertsComponent>();
|
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientAlertsComponent>(controlled.Uid);
|
||||||
Assert.NotNull(alertsComponent);
|
Assert.NotNull(alertsComponent);
|
||||||
|
|
||||||
// find the alertsui
|
// find the alertsui
|
||||||
@@ -69,7 +71,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
{
|
{
|
||||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||||
Assert.NotNull(playerEnt);
|
Assert.NotNull(playerEnt);
|
||||||
var alertsComponent = playerEnt.GetComponent<ServerAlertsComponent>();
|
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt.Uid);
|
||||||
Assert.NotNull(alertsComponent);
|
Assert.NotNull(alertsComponent);
|
||||||
|
|
||||||
alertsComponent.ClearAlert(AlertType.Debug1);
|
alertsComponent.ClearAlert(AlertType.Debug1);
|
||||||
@@ -84,7 +86,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
|||||||
Assert.NotNull(local);
|
Assert.NotNull(local);
|
||||||
var controlled = local.ControlledEntity;
|
var controlled = local.ControlledEntity;
|
||||||
Assert.NotNull(controlled);
|
Assert.NotNull(controlled);
|
||||||
var alertsComponent = controlled.GetComponent<ClientAlertsComponent>();
|
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientAlertsComponent>(controlled.Uid);
|
||||||
Assert.NotNull(alertsComponent);
|
Assert.NotNull(alertsComponent);
|
||||||
|
|
||||||
// find the alertsui
|
// find the alertsui
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
|||||||
// Now let's make the player enter a climbing transitioning state.
|
// Now let's make the player enter a climbing transitioning state.
|
||||||
climbing.IsClimbing = true;
|
climbing.IsClimbing = true;
|
||||||
climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition);
|
climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition);
|
||||||
var body = human.GetComponent<IPhysBody>();
|
var body = IoCManager.Resolve<IEntityManager>().GetComponent<IPhysBody>(human.Uid);
|
||||||
// TODO: Check it's climbing
|
// TODO: Check it's climbing
|
||||||
|
|
||||||
// Force the player out of climb state. It should immediately remove the ClimbController.
|
// Force the player out of climb state. It should immediately remove the ClimbController.
|
||||||
|
|||||||
@@ -53,15 +53,15 @@ namespace Content.IntegrationTests.Tests
|
|||||||
Assert.That(generator.HasComponent<GravityGeneratorComponent>());
|
Assert.That(generator.HasComponent<GravityGeneratorComponent>());
|
||||||
Assert.That(generator.HasComponent<ApcPowerReceiverComponent>());
|
Assert.That(generator.HasComponent<ApcPowerReceiverComponent>());
|
||||||
|
|
||||||
var powerComponent = generator.GetComponent<ApcPowerReceiverComponent>();
|
var powerComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(generator.Uid);
|
||||||
powerComponent.NeedsPower = false;
|
powerComponent.NeedsPower = false;
|
||||||
});
|
});
|
||||||
server.RunTicks(1);
|
server.RunTicks(1);
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
var generatorComponent = generator.GetComponent<GravityGeneratorComponent>();
|
var generatorComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GravityGeneratorComponent>(generator.Uid);
|
||||||
var powerComponent = generator.GetComponent<ApcPowerReceiverComponent>();
|
var powerComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(generator.Uid);
|
||||||
|
|
||||||
Assert.That(generatorComponent.GravityActive, Is.True);
|
Assert.That(generatorComponent.GravityActive, Is.True);
|
||||||
|
|
||||||
@@ -69,8 +69,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var grid1Entity = entityMan.GetEntity(grid1.GridEntityId);
|
var grid1Entity = entityMan.GetEntity(grid1.GridEntityId);
|
||||||
var grid2Entity = entityMan.GetEntity(grid2.GridEntityId);
|
var grid2Entity = entityMan.GetEntity(grid2.GridEntityId);
|
||||||
|
|
||||||
Assert.That(!grid1Entity.GetComponent<GravityComponent>().Enabled);
|
Assert.That(!IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(grid1Entity.Uid).Enabled);
|
||||||
Assert.That(grid2Entity.GetComponent<GravityComponent>().Enabled);
|
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(grid2Entity.Uid).Enabled);
|
||||||
|
|
||||||
// Re-enable needs power so it turns off again.
|
// Re-enable needs power so it turns off again.
|
||||||
// Charge rate is ridiculously high so it finishes in one tick.
|
// Charge rate is ridiculously high so it finishes in one tick.
|
||||||
@@ -79,14 +79,14 @@ namespace Content.IntegrationTests.Tests
|
|||||||
server.RunTicks(1);
|
server.RunTicks(1);
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
var generatorComponent = generator.GetComponent<GravityGeneratorComponent>();
|
var generatorComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GravityGeneratorComponent>(generator.Uid);
|
||||||
|
|
||||||
Assert.That(generatorComponent.GravityActive, Is.False);
|
Assert.That(generatorComponent.GravityActive, Is.False);
|
||||||
|
|
||||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||||
var grid2Entity = entityMan.GetEntity(grid2.GridEntityId);
|
var grid2Entity = entityMan.GetEntity(grid2.GridEntityId);
|
||||||
|
|
||||||
Assert.That(grid2Entity.GetComponent<GravityComponent>().Enabled, Is.False);
|
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(grid2Entity.Uid).Enabled, Is.False);
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace);
|
pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace);
|
||||||
var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace);
|
var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace);
|
||||||
|
|
||||||
inventory = human.GetComponent<InventoryComponent>();
|
inventory = IoCManager.Resolve<IEntityManager>().GetComponent<InventoryComponent>(human.Uid);
|
||||||
|
|
||||||
Assert.That(inventory.CanEquip(Slots.INNERCLOTHING, uniform));
|
Assert.That(inventory.CanEquip(Slots.INNERCLOTHING, uniform));
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(interactHand);
|
Assert.That(interactHand);
|
||||||
|
|
||||||
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
||||||
Assert.That(hands.PutInHand(item.GetComponent<ItemComponent>()));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing);
|
Assert.That(interactUsing);
|
||||||
@@ -168,7 +168,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(interactHand, Is.False);
|
Assert.That(interactHand, Is.False);
|
||||||
|
|
||||||
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
||||||
Assert.That(hands.PutInHand(item.GetComponent<ItemComponent>()));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
@@ -237,7 +237,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(interactHand);
|
Assert.That(interactHand);
|
||||||
|
|
||||||
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
||||||
Assert.That(hands.PutInHand(item.GetComponent<ItemComponent>()));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing);
|
Assert.That(interactUsing);
|
||||||
@@ -307,7 +307,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(interactHand, Is.False);
|
Assert.That(interactHand, Is.False);
|
||||||
|
|
||||||
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
||||||
Assert.That(hands.PutInHand(item.GetComponent<ItemComponent>()));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
@@ -392,7 +392,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
|||||||
Assert.That(interactHand);
|
Assert.That(interactHand);
|
||||||
|
|
||||||
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
Assert.That(user.TryGetComponent<HandsComponent>(out var hands));
|
||||||
Assert.That(hands.PutInHand(item.GetComponent<ItemComponent>()));
|
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||||
|
|
||||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||||
Assert.That(interactUsing, Is.False);
|
Assert.That(interactUsing, Is.False);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
human = entityMan.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace);
|
human = entityMan.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace);
|
||||||
inventory = human.GetComponent<InventoryComponent>();
|
inventory = IoCManager.Resolve<IEntityManager>().GetComponent<InventoryComponent>(human.Uid);
|
||||||
|
|
||||||
// Can't do the test if this human doesn't have the slots for it.
|
// Can't do the test if this human doesn't have the slots for it.
|
||||||
Assert.That(inventory.HasSlot(Slots.INNERCLOTHING));
|
Assert.That(inventory.HasSlot(Slots.INNERCLOTHING));
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ namespace Content.IntegrationTests.Tests.Networking
|
|||||||
|
|
||||||
await client.WaitPost(() =>
|
await client.WaitPost(() =>
|
||||||
{
|
{
|
||||||
clientComponent = cEntityManager.GetEntity(serverEnt.Uid)
|
IEntity tempQualifier = cEntityManager.GetEntity(serverEnt.Uid);
|
||||||
.GetComponent<PredictionTestComponent>();
|
clientComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PredictionTestComponent>(tempQualifier.Uid);
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.That(clientComponent.Foo, Is.False);
|
Assert.That(clientComponent.Foo, Is.False);
|
||||||
@@ -457,7 +457,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
|||||||
private void HandleMessage(SetFooMessage message, EntitySessionEventArgs args)
|
private void HandleMessage(SetFooMessage message, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
var entity = EntityManager.GetEntity(message.Uid);
|
var entity = EntityManager.GetEntity(message.Uid);
|
||||||
var component = entity.GetComponent<PredictionTestComponent>();
|
var component = IoCManager.Resolve<IEntityManager>().GetComponent<PredictionTestComponent>(entity.Uid);
|
||||||
var old = component.Foo;
|
var old = component.Foo;
|
||||||
if (Allow)
|
if (Allow)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Containers.ItemSlots;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.PDA
|
namespace Content.IntegrationTests.Tests.PDA
|
||||||
{
|
{
|
||||||
@@ -70,13 +71,13 @@ namespace Content.IntegrationTests.Tests.PDA
|
|||||||
|
|
||||||
// Put PDA in hand
|
// Put PDA in hand
|
||||||
var dummyPda = sEntityManager.SpawnEntity(PdaDummy, player.Transform.MapPosition);
|
var dummyPda = sEntityManager.SpawnEntity(PdaDummy, player.Transform.MapPosition);
|
||||||
var pdaItemComponent = dummyPda.GetComponent<ItemComponent>();
|
var pdaItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(dummyPda.Uid);
|
||||||
player.GetComponent<HandsComponent>().PutInHand(pdaItemComponent);
|
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid).PutInHand(pdaItemComponent);
|
||||||
|
|
||||||
var pdaComponent = dummyPda.GetComponent<PDAComponent>();
|
var pdaComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PDAComponent>(dummyPda.Uid);
|
||||||
var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition);
|
var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition);
|
||||||
|
|
||||||
var itemSlots = dummyPda.GetComponent<ItemSlotsComponent>();
|
var itemSlots = IoCManager.Resolve<IEntityManager>().GetComponent<ItemSlotsComponent>(dummyPda.Uid);
|
||||||
sEntityManager.EntitySysManager.GetEntitySystem<ItemSlotsSystem>()
|
sEntityManager.EntitySysManager.GetEntitySystem<ItemSlotsSystem>()
|
||||||
.TryInsert(dummyPda.Uid, pdaComponent.IdSlot, pdaIdCard);
|
.TryInsert(dummyPda.Uid, pdaComponent.IdSlot, pdaIdCard);
|
||||||
var pdaContainedId = pdaComponent.ContainedID;
|
var pdaContainedId = pdaComponent.ContainedID;
|
||||||
@@ -90,10 +91,10 @@ namespace Content.IntegrationTests.Tests.PDA
|
|||||||
|
|
||||||
// Put ID card in hand
|
// Put ID card in hand
|
||||||
var idDummy = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition);
|
var idDummy = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition);
|
||||||
var idItemComponent = idDummy.GetComponent<ItemComponent>();
|
var idItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(idDummy.Uid);
|
||||||
player.GetComponent<HandsComponent>().PutInHand(idItemComponent);
|
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid).PutInHand(idItemComponent);
|
||||||
|
|
||||||
var idCardComponent = idDummy.GetComponent<IdCardComponent>();
|
var idCardComponent = IoCManager.Resolve<IEntityManager>().GetComponent<IdCardComponent>(idDummy.Uid);
|
||||||
|
|
||||||
// The ID in the hand should be found first
|
// The ID in the hand should be found first
|
||||||
Assert.NotNull(player.GetHeldId());
|
Assert.NotNull(player.GetHeldId());
|
||||||
@@ -102,7 +103,7 @@ namespace Content.IntegrationTests.Tests.PDA
|
|||||||
Assert.That(id, Is.EqualTo(idCardComponent));
|
Assert.That(id, Is.EqualTo(idCardComponent));
|
||||||
|
|
||||||
// Remove all IDs and PDAs
|
// Remove all IDs and PDAs
|
||||||
var inventory = player.GetComponent<InventoryComponent>();
|
var inventory = IoCManager.Resolve<IEntityManager>().GetComponent<InventoryComponent>(player.Uid);
|
||||||
|
|
||||||
foreach (var slot in inventory.Slots)
|
foreach (var slot in inventory.Slots)
|
||||||
{
|
{
|
||||||
@@ -119,7 +120,7 @@ namespace Content.IntegrationTests.Tests.PDA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var hands = player.GetComponent<HandsComponent>();
|
var hands = IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid);
|
||||||
|
|
||||||
hands.Drop(dummyPda, false);
|
hands.Drop(dummyPda, false);
|
||||||
hands.Drop(idDummy, false);
|
hands.Drop(idDummy, false);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Server.Power.Nodes;
|
|||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -204,9 +205,9 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1));
|
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1));
|
||||||
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
supplier = generatorEnt.GetComponent<PowerSupplierComponent>();
|
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||||
consumer1 = consumerEnt1.GetComponent<PowerConsumerComponent>();
|
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1.Uid);
|
||||||
consumer2 = consumerEnt2.GetComponent<PowerConsumerComponent>();
|
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2.Uid);
|
||||||
|
|
||||||
// Plenty of surplus and tolerance
|
// Plenty of surplus and tolerance
|
||||||
supplier.MaxSupply = loadPower * 4;
|
supplier.MaxSupply = loadPower * 4;
|
||||||
@@ -258,9 +259,9 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1));
|
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1));
|
||||||
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
supplier = generatorEnt.GetComponent<PowerSupplierComponent>();
|
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||||
consumer1 = consumerEnt1.GetComponent<PowerConsumerComponent>();
|
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1.Uid);
|
||||||
consumer2 = consumerEnt2.GetComponent<PowerConsumerComponent>();
|
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2.Uid);
|
||||||
|
|
||||||
// Too little supply, both consumers should get 33% power.
|
// Too little supply, both consumers should get 33% power.
|
||||||
supplier.MaxSupply = loadPower;
|
supplier.MaxSupply = loadPower;
|
||||||
@@ -305,8 +306,8 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
|
var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
|
||||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
supplier = generatorEnt.GetComponent<PowerSupplierComponent>();
|
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||||
consumer = consumerEnt.GetComponent<PowerConsumerComponent>();
|
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||||
|
|
||||||
// Supply has enough total power but needs to ramp up to match.
|
// Supply has enough total power but needs to ramp up to match.
|
||||||
supplier.MaxSupply = 400;
|
supplier.MaxSupply = 400;
|
||||||
@@ -375,9 +376,9 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var generatorEnt = _entityManager.SpawnEntity("DischargingBatteryDummy", grid.ToCoordinates());
|
var generatorEnt = _entityManager.SpawnEntity("DischargingBatteryDummy", grid.ToCoordinates());
|
||||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
netBattery = generatorEnt.GetComponent<PowerNetworkBatteryComponent>();
|
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(generatorEnt.Uid);
|
||||||
battery = generatorEnt.GetComponent<BatteryComponent>();
|
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(generatorEnt.Uid);
|
||||||
consumer = consumerEnt.GetComponent<PowerConsumerComponent>();
|
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||||
|
|
||||||
battery.MaxCharge = startingCharge;
|
battery.MaxCharge = startingCharge;
|
||||||
battery.CurrentCharge = startingCharge;
|
battery.CurrentCharge = startingCharge;
|
||||||
@@ -453,9 +454,9 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
|
var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
|
||||||
var batteryEnt = _entityManager.SpawnEntity("ChargingBatteryDummy", grid.ToCoordinates(0, 2));
|
var batteryEnt = _entityManager.SpawnEntity("ChargingBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
supplier = generatorEnt.GetComponent<PowerSupplierComponent>();
|
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||||
var netBattery = batteryEnt.GetComponent<PowerNetworkBatteryComponent>();
|
var netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt.Uid);
|
||||||
battery = batteryEnt.GetComponent<BatteryComponent>();
|
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt.Uid);
|
||||||
|
|
||||||
supplier.MaxSupply = 500;
|
supplier.MaxSupply = 500;
|
||||||
supplier.SupplyRampTolerance = 500;
|
supplier.SupplyRampTolerance = 500;
|
||||||
@@ -504,10 +505,10 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3));
|
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3));
|
||||||
|
|
||||||
consumer = consumerEnt.GetComponent<PowerConsumerComponent>();
|
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||||
supplier = supplyEnt.GetComponent<PowerSupplierComponent>();
|
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||||
netBattery = batteryEnt.GetComponent<PowerNetworkBatteryComponent>();
|
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt.Uid);
|
||||||
battery = batteryEnt.GetComponent<BatteryComponent>();
|
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt.Uid);
|
||||||
|
|
||||||
// Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200.
|
// Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200.
|
||||||
consumer.DrawRate = 1000;
|
consumer.DrawRate = 1000;
|
||||||
@@ -572,10 +573,10 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3));
|
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3));
|
||||||
|
|
||||||
consumer = consumerEnt.GetComponent<PowerConsumerComponent>();
|
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||||
supplier = supplyEnt.GetComponent<PowerSupplierComponent>();
|
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||||
netBattery = batteryEnt.GetComponent<PowerNetworkBatteryComponent>();
|
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt.Uid);
|
||||||
battery = batteryEnt.GetComponent<BatteryComponent>();
|
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt.Uid);
|
||||||
|
|
||||||
// Consumer needs 1000 W, supply and battery can only provide 400 each.
|
// Consumer needs 1000 W, supply and battery can only provide 400 each.
|
||||||
// BUT the battery has 50% input efficiency, so 50% of the power of the supply gets lost.
|
// BUT the battery has 50% input efficiency, so 50% of the power of the supply gets lost.
|
||||||
@@ -650,13 +651,13 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0));
|
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0));
|
||||||
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4));
|
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4));
|
||||||
|
|
||||||
consumer1 = consumerEnt1.GetComponent<PowerConsumerComponent>();
|
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1.Uid);
|
||||||
consumer2 = consumerEnt2.GetComponent<PowerConsumerComponent>();
|
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2.Uid);
|
||||||
supplier = supplyEnt.GetComponent<PowerSupplierComponent>();
|
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||||
var netBattery1 = batteryEnt1.GetComponent<PowerNetworkBatteryComponent>();
|
var netBattery1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt1.Uid);
|
||||||
var netBattery2 = batteryEnt2.GetComponent<PowerNetworkBatteryComponent>();
|
var netBattery2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt2.Uid);
|
||||||
var battery1 = batteryEnt1.GetComponent<BatteryComponent>();
|
var battery1 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt1.Uid);
|
||||||
var battery2 = batteryEnt2.GetComponent<BatteryComponent>();
|
var battery2 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt2.Uid);
|
||||||
|
|
||||||
// There are two loads, 500 W and 1000 W respectively.
|
// There are two loads, 500 W and 1000 W respectively.
|
||||||
// The 500 W load is behind a 50% efficient battery,
|
// The 500 W load is behind a 50% efficient battery,
|
||||||
@@ -737,13 +738,13 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0));
|
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0));
|
||||||
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4));
|
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4));
|
||||||
|
|
||||||
consumer1 = consumerEnt1.GetComponent<PowerConsumerComponent>();
|
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1.Uid);
|
||||||
consumer2 = consumerEnt2.GetComponent<PowerConsumerComponent>();
|
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2.Uid);
|
||||||
supplier = supplyEnt.GetComponent<PowerSupplierComponent>();
|
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||||
var netBattery1 = batteryEnt1.GetComponent<PowerNetworkBatteryComponent>();
|
var netBattery1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt1.Uid);
|
||||||
var netBattery2 = batteryEnt2.GetComponent<PowerNetworkBatteryComponent>();
|
var netBattery2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt2.Uid);
|
||||||
var battery1 = batteryEnt1.GetComponent<BatteryComponent>();
|
var battery1 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt1.Uid);
|
||||||
var battery2 = batteryEnt2.GetComponent<BatteryComponent>();
|
var battery2 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt2.Uid);
|
||||||
|
|
||||||
consumer1.DrawRate = 500;
|
consumer1.DrawRate = 500;
|
||||||
consumer2.DrawRate = 1000;
|
consumer2.DrawRate = 1000;
|
||||||
@@ -805,10 +806,10 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3));
|
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3));
|
||||||
|
|
||||||
consumer = consumerEnt.GetComponent<PowerConsumerComponent>();
|
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||||
supplier = supplyEnt.GetComponent<PowerSupplierComponent>();
|
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||||
netBattery = batteryEnt.GetComponent<PowerNetworkBatteryComponent>();
|
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt.Uid);
|
||||||
var battery = batteryEnt.GetComponent<BatteryComponent>();
|
var battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt.Uid);
|
||||||
|
|
||||||
// Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200.
|
// Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200.
|
||||||
consumer.DrawRate = 1000;
|
consumer.DrawRate = 1000;
|
||||||
@@ -881,10 +882,10 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
||||||
|
|
||||||
var battery = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
var battery = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||||
var batteryNodeContainer = battery.GetComponent<NodeContainerComponent>();
|
var batteryNodeContainer = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(battery.Uid);
|
||||||
|
|
||||||
leftNode = leftEnt.GetComponent<NodeContainerComponent>().GetNode<CableNode>("power");
|
leftNode = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(leftEnt.Uid).GetNode<CableNode>("power");
|
||||||
rightNode = rightEnt.GetComponent<NodeContainerComponent>().GetNode<CableNode>("power");
|
rightNode = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(rightEnt.Uid).GetNode<CableNode>("power");
|
||||||
|
|
||||||
batteryInput = batteryNodeContainer.GetNode<Node>("input");
|
batteryInput = batteryNodeContainer.GetNode<Node>("input");
|
||||||
batteryOutput = batteryNodeContainer.GetNode<Node>("output");
|
batteryOutput = batteryNodeContainer.GetNode<Node>("output");
|
||||||
@@ -930,9 +931,9 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var substationEnt = _entityManager.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1));
|
var substationEnt = _entityManager.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1));
|
||||||
var apcEnt = _entityManager.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2));
|
var apcEnt = _entityManager.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
var generatorSupplier = generatorEnt.GetComponent<PowerSupplierComponent>();
|
var generatorSupplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||||
substationNetBattery = substationEnt.GetComponent<PowerNetworkBatteryComponent>();
|
substationNetBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(substationEnt.Uid);
|
||||||
apcBattery = apcEnt.GetComponent<BatteryComponent>();
|
apcBattery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(apcEnt.Uid);
|
||||||
|
|
||||||
generatorSupplier.MaxSupply = 1000;
|
generatorSupplier.MaxSupply = 1000;
|
||||||
generatorSupplier.SupplyRampTolerance = 1000;
|
generatorSupplier.SupplyRampTolerance = 1000;
|
||||||
@@ -972,9 +973,9 @@ namespace Content.IntegrationTests.Tests.Power
|
|||||||
var apcExtensionEnt = _entityManager.SpawnEntity("CableApcExtension", grid.ToCoordinates(0, 0));
|
var apcExtensionEnt = _entityManager.SpawnEntity("CableApcExtension", grid.ToCoordinates(0, 0));
|
||||||
var powerReceiverEnt = _entityManager.SpawnEntity("ApcPowerReceiverDummy", grid.ToCoordinates(0, 2));
|
var powerReceiverEnt = _entityManager.SpawnEntity("ApcPowerReceiverDummy", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
receiver = powerReceiverEnt.GetComponent<ApcPowerReceiverComponent>();
|
receiver = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(powerReceiverEnt.Uid);
|
||||||
var battery = apcEnt.GetComponent<BatteryComponent>();
|
var battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(apcEnt.Uid);
|
||||||
apcNetBattery = apcEnt.GetComponent<PowerNetworkBatteryComponent>();
|
apcNetBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(apcEnt.Uid);
|
||||||
|
|
||||||
_extensionCableSystem.SetProviderTransferRange(apcExtensionEnt.Uid, 5);
|
_extensionCableSystem.SetProviderTransferRange(apcExtensionEnt.Uid, 5);
|
||||||
_extensionCableSystem.SetReceiverReceptionRange(powerReceiverEnt.Uid, 5);
|
_extensionCableSystem.SetReceiverReceptionRange(powerReceiverEnt.Uid, 5);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
|||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ namespace Content.IntegrationTests.Tests.Tag
|
|||||||
{
|
{
|
||||||
sMapManager.CreateNewMapEntity(MapId.Nullspace);
|
sMapManager.CreateNewMapEntity(MapId.Nullspace);
|
||||||
sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace);
|
sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace);
|
||||||
sTagComponent = sTagDummy.GetComponent<TagComponent>();
|
sTagComponent = IoCManager.Resolve<IEntityManager>().GetComponent<TagComponent>(sTagDummy.Uid);
|
||||||
});
|
});
|
||||||
|
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Containers.ItemSlots;
|
|||||||
using Content.Shared.Whitelist;
|
using Content.Shared.Whitelist;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Utility
|
namespace Content.IntegrationTests.Tests.Utility
|
||||||
@@ -98,7 +99,7 @@ namespace Content.IntegrationTests.Tests.Utility
|
|||||||
|
|
||||||
// Test from serialized
|
// Test from serialized
|
||||||
var dummy = entityManager.SpawnEntity("WhitelistDummy", mapCoordinates);
|
var dummy = entityManager.SpawnEntity("WhitelistDummy", mapCoordinates);
|
||||||
var whitelistSer = dummy.GetComponent<ItemSlotsComponent>().Slots.Values.First().Whitelist;
|
var whitelistSer = IoCManager.Resolve<IEntityManager>().GetComponent<ItemSlotsComponent>(dummy.Uid).Slots.Values.First().Whitelist;
|
||||||
Assert.That(whitelistSer, Is.Not.Null);
|
Assert.That(whitelistSer, Is.Not.Null);
|
||||||
|
|
||||||
Assert.That(whitelistSer.Components, Is.Not.Null);
|
Assert.That(whitelistSer.Components, Is.Not.Null);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Access.Components;
|
|||||||
using Content.Server.Access.Systems;
|
using Content.Server.Access.Systems;
|
||||||
using Content.Server.AI.Components;
|
using Content.Server.AI.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
|
|
||||||
namespace Content.Server.AI.Pathfinding.Accessible
|
namespace Content.Server.AI.Pathfinding.Accessible
|
||||||
@@ -35,7 +36,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
|||||||
|
|
||||||
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
|
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
|
||||||
var access = accessSystem.FindAccessTags(entity.Uid);
|
var access = accessSystem.FindAccessTags(entity.Uid);
|
||||||
var visionRadius = entity.GetComponent<AiControllerComponent>().VisionRadius;
|
var visionRadius = IoCManager.Resolve<IEntityManager>().GetComponent<AiControllerComponent>(entity.Uid).VisionRadius;
|
||||||
|
|
||||||
return new ReachableArgs(visionRadius, access, collisionMask);
|
return new ReachableArgs(visionRadius, access, collisionMask);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,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.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -156,7 +157,7 @@ namespace Content.Server.AME.Components
|
|||||||
return new AMEControllerBoundUserInterfaceState(Powered, IsMasterController(), false, HasJar, 0, InjectionAmount, GetCoreCount());
|
return new AMEControllerBoundUserInterfaceState(Powered, IsMasterController(), false, HasJar, 0, InjectionAmount, GetCoreCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
var jarcomponent = jar.GetComponent<AMEFuelContainerComponent>();
|
var jarcomponent = IoCManager.Resolve<IEntityManager>().GetComponent<AMEFuelContainerComponent>(jar.Uid);
|
||||||
return new AMEControllerBoundUserInterfaceState(Powered, IsMasterController(), _injecting, HasJar, jarcomponent.FuelAmount, InjectionAmount, GetCoreCount());
|
return new AMEControllerBoundUserInterfaceState(Powered, IsMasterController(), _injecting, HasJar, jarcomponent.FuelAmount, InjectionAmount, GetCoreCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,8 +133,8 @@ namespace Content.Server.Access.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var targetIdComponent = targetIdEntity.GetComponent<IdCardComponent>();
|
var targetIdComponent = IoCManager.Resolve<IEntityManager>().GetComponent<IdCardComponent>(targetIdEntity.Uid);
|
||||||
var targetAccessComponent = targetIdEntity.GetComponent<AccessComponent>();
|
var targetAccessComponent = IoCManager.Resolve<IEntityManager>().GetComponent<AccessComponent>(targetIdEntity.Uid);
|
||||||
newState = new IdCardConsoleBoundUserInterfaceState(
|
newState = new IdCardConsoleBoundUserInterfaceState(
|
||||||
PrivilegedIdSlot.HasItem,
|
PrivilegedIdSlot.HasItem,
|
||||||
PrivilegedIdIsAuthorized(),
|
PrivilegedIdIsAuthorized(),
|
||||||
|
|||||||
@@ -108,7 +108,13 @@ namespace Content.Server.Access.Systems
|
|||||||
|
|
||||||
if (EntityManager.TryGetComponent(uid, out PDAComponent? pda))
|
if (EntityManager.TryGetComponent(uid, out PDAComponent? pda))
|
||||||
{
|
{
|
||||||
tags = pda?.ContainedID?.Owner?.GetComponent<AccessComponent>()?.Tags;
|
IEntity tempQualifier = pda?.ContainedID?.Owner;
|
||||||
|
if (tempQualifier != null)
|
||||||
|
{
|
||||||
|
IoCManager.Resolve<IEntityManager>().GetComponent<AccessComponent>(tempQualifier.Uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = RETURNED_VALUE?.Tags;
|
||||||
return tags != null;
|
return tags != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
mind.TransferTo(ghost.Uid);
|
mind.TransferTo(ghost.Uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
var comp = ghost.GetComponent<GhostComponent>();
|
var comp = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(ghost.Uid);
|
||||||
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(comp, canReturn);
|
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(comp, canReturn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
pdaComponent.ContainedID.FullName = target.Name;
|
pdaComponent.ContainedID.FullName = target.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
inventoryComponent.Equip(slot, equipmentEntity.GetComponent<ItemComponent>(), false);
|
inventoryComponent.Equip(slot, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(equipmentEntity.Uid), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,7 +205,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
if (container.ContainedEntities.Count > 0)
|
if (container.ContainedEntities.Count > 0)
|
||||||
{
|
{
|
||||||
var gasTank = container.ContainedEntities[0].GetComponent<GasTankComponent>();
|
IEntity tempQualifier = container.ContainedEntities[0];
|
||||||
|
var gasTank = IoCManager.Resolve<IEntityManager>().GetComponent<GasTankComponent>(tempQualifier.Uid);
|
||||||
_atmosphereSystem.ReleaseGasTo(canister.Air, gasTank.Air, canister.ReleasePressure);
|
_atmosphereSystem.ReleaseGasTo(canister.Air, gasTank.Air, canister.ReleasePressure);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -141,8 +141,8 @@ namespace Content.Server.Body.Components
|
|||||||
|
|
||||||
if (_optionsCache.Count > 0)
|
if (_optionsCache.Count > 0)
|
||||||
{
|
{
|
||||||
OpenSurgeryUI(eventArgs.User.GetComponent<ActorComponent>().PlayerSession);
|
OpenSurgeryUI(IoCManager.Resolve<IEntityManager>().GetComponent<ActorComponent>(eventArgs.User.Uid).PlayerSession);
|
||||||
BodyPartSlotRequest(eventArgs.User.GetComponent<ActorComponent>().PlayerSession,
|
BodyPartSlotRequest(IoCManager.Resolve<IEntityManager>().GetComponent<ActorComponent>(eventArgs.User.Uid).PlayerSession,
|
||||||
toSend);
|
toSend);
|
||||||
_surgeonCache = eventArgs.User;
|
_surgeonCache = eventArgs.User;
|
||||||
_owningBodyCache = body;
|
_owningBodyCache = body;
|
||||||
|
|||||||
@@ -129,8 +129,8 @@ namespace Content.Server.Body.Surgery.Components
|
|||||||
|
|
||||||
if (_optionsCache.Count > 0 && PerformerCache != null)
|
if (_optionsCache.Count > 0 && PerformerCache != null)
|
||||||
{
|
{
|
||||||
OpenSurgeryUI(PerformerCache.GetComponent<ActorComponent>().PlayerSession);
|
OpenSurgeryUI(IoCManager.Resolve<IEntityManager>().GetComponent<ActorComponent>(PerformerCache.Uid).PlayerSession);
|
||||||
UpdateSurgeryUIMechanismRequest(PerformerCache.GetComponent<ActorComponent>().PlayerSession,
|
UpdateSurgeryUIMechanismRequest(IoCManager.Resolve<IEntityManager>().GetComponent<ActorComponent>(PerformerCache.Uid).PlayerSession,
|
||||||
toSend);
|
toSend);
|
||||||
_callbackCache = callback;
|
_callbackCache = callback;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Content.Server.Buckle.Systems
|
|||||||
// Add unstrap verbs for every strapped entity.
|
// Add unstrap verbs for every strapped entity.
|
||||||
foreach (var entity in component.BuckledEntities)
|
foreach (var entity in component.BuckledEntities)
|
||||||
{
|
{
|
||||||
var buckledComp = entity.GetComponent<BuckleComponent>();
|
var buckledComp = IoCManager.Resolve<IEntityManager>().GetComponent<BuckleComponent>(entity.Uid);
|
||||||
|
|
||||||
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target, range: buckledComp.Range))
|
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target, range: buckledComp.Range))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace Content.Server.Chat.Commands
|
|||||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Suicide, $"{player.AttachedEntity} is committing suicide");
|
EntitySystem.Get<AdminLogSystem>().Add(LogType.Suicide, $"{player.AttachedEntity} is committing suicide");
|
||||||
|
|
||||||
// Held item suicide
|
// Held item suicide
|
||||||
var handsComponent = owner.GetComponent<HandsComponent>();
|
var handsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(owner.Uid);
|
||||||
var itemComponent = handsComponent.GetActiveHand;
|
var itemComponent = handsComponent.GetActiveHand;
|
||||||
if (itemComponent != null)
|
if (itemComponent != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using Content.Shared.Chemistry.Reagent;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Slippery;
|
using Content.Shared.Slippery;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
@@ -28,7 +30,7 @@ namespace Content.Server.Chemistry.TileReactions
|
|||||||
|
|
||||||
if (puddle != null)
|
if (puddle != null)
|
||||||
{
|
{
|
||||||
var slippery = puddle.Owner.GetComponent<SlipperyComponent>();
|
var slippery = IoCManager.Resolve<IEntityManager>().GetComponent<SlipperyComponent>(puddle.Owner.Uid);
|
||||||
slippery.LaunchForwardsMultiplier = _launchForwardsMultiplier;
|
slippery.LaunchForwardsMultiplier = _launchForwardsMultiplier;
|
||||||
slippery.RequiredSlipSpeed = _requiredSlipSpeed;
|
slippery.RequiredSlipSpeed = _requiredSlipSpeed;
|
||||||
slippery.ParalyzeTime = _paralyzeTime;
|
slippery.ParalyzeTime = _paralyzeTime;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.Interaction.Helpers;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
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.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -165,7 +166,7 @@ namespace Content.Server.Climbing.Components
|
|||||||
var direction = (Owner.Transform.WorldPosition - entityPos).Normalized;
|
var direction = (Owner.Transform.WorldPosition - entityPos).Normalized;
|
||||||
var endPoint = Owner.Transform.WorldPosition;
|
var endPoint = Owner.Transform.WorldPosition;
|
||||||
|
|
||||||
var climbMode = entityToMove.GetComponent<ClimbingComponent>();
|
var climbMode = IoCManager.Resolve<IEntityManager>().GetComponent<ClimbingComponent>(entityToMove.Uid);
|
||||||
climbMode.IsClimbing = true;
|
climbMode.IsClimbing = true;
|
||||||
|
|
||||||
if (MathF.Abs(direction.X) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line
|
if (MathF.Abs(direction.X) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line
|
||||||
@@ -213,7 +214,7 @@ namespace Content.Server.Climbing.Components
|
|||||||
var direction = (Owner.Transform.WorldPosition - userPos).Normalized;
|
var direction = (Owner.Transform.WorldPosition - userPos).Normalized;
|
||||||
var endPoint = Owner.Transform.WorldPosition;
|
var endPoint = Owner.Transform.WorldPosition;
|
||||||
|
|
||||||
var climbMode = user.GetComponent<ClimbingComponent>();
|
var climbMode = IoCManager.Resolve<IEntityManager>().GetComponent<ClimbingComponent>(user.Uid);
|
||||||
climbMode.IsClimbing = true;
|
climbMode.IsClimbing = true;
|
||||||
|
|
||||||
if (MathF.Abs(direction.X) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line
|
if (MathF.Abs(direction.X) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Sound;
|
using Content.Shared.Sound;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
@@ -79,14 +80,14 @@ namespace Content.Server.Clothing.Components
|
|||||||
{
|
{
|
||||||
hands.Drop(item.Owner);
|
hands.Drop(item.Owner);
|
||||||
inv.Equip(slot, item);
|
inv.Equip(slot, item);
|
||||||
hands.PutInHand(Owner.GetComponent<ItemComponent>());
|
hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(Owner.Uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hands.Drop(Owner);
|
hands.Drop(Owner);
|
||||||
if (!TryEquip(inv, slot, eventArgs.User))
|
if (!TryEquip(inv, slot, eventArgs.User))
|
||||||
hands.PutInHand(Owner.GetComponent<ItemComponent>());
|
hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(Owner.Uid));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Content.Server.Construction.Completions
|
|||||||
if (EntityPrototypeHelpers.HasComponent<StackComponent>(Prototype))
|
if (EntityPrototypeHelpers.HasComponent<StackComponent>(Prototype))
|
||||||
{
|
{
|
||||||
var stackEnt = entityManager.SpawnEntity(Prototype, coordinates);
|
var stackEnt = entityManager.SpawnEntity(Prototype, coordinates);
|
||||||
var stack = stackEnt.GetComponent<StackComponent>();
|
var stack = IoCManager.Resolve<IEntityManager>().GetComponent<StackComponent>(stackEnt.Uid);
|
||||||
entityManager.EntitySysManager.GetEntitySystem<StackSystem>().SetCount(stackEnt.Uid, Amount, stack);
|
entityManager.EntitySysManager.GetEntitySystem<StackSystem>().SetCount(stackEnt.Uid, Amount, stack);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ namespace Content.Server.Construction
|
|||||||
var newEntity = EntityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, user.Transform.Coordinates);
|
var newEntity = EntityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, user.Transform.Coordinates);
|
||||||
|
|
||||||
// Yes, this should throw if it's missing the component.
|
// Yes, this should throw if it's missing the component.
|
||||||
var construction = newEntity.GetComponent<ConstructionComponent>();
|
var construction = IoCManager.Resolve<IEntityManager>().GetComponent<ConstructionComponent>(newEntity.Uid);
|
||||||
|
|
||||||
// We attempt to set the pathfinding target.
|
// We attempt to set the pathfinding target.
|
||||||
SetPathfindingTarget(newEntity.Uid, targetNode.Name, construction);
|
SetPathfindingTarget(newEntity.Uid, targetNode.Name, construction);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Server.Stack;
|
|||||||
using Content.Shared.Prototypes;
|
using Content.Shared.Prototypes;
|
||||||
using Content.Shared.Random.Helpers;
|
using Content.Shared.Random.Helpers;
|
||||||
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.Destructible.Thresholds.Behaviors
|
namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||||
@@ -33,7 +34,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
|||||||
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId))
|
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId))
|
||||||
{
|
{
|
||||||
var spawned = system.EntityManager.SpawnEntity(entityId, position);
|
var spawned = system.EntityManager.SpawnEntity(entityId, position);
|
||||||
var stack = spawned.GetComponent<StackComponent>();
|
var stack = IoCManager.Resolve<IEntityManager>().GetComponent<StackComponent>(spawned.Uid);
|
||||||
EntitySystem.Get<StackSystem>().SetCount(spawned.Uid, count, stack);
|
EntitySystem.Get<StackSystem>().SetCount(spawned.Uid, count, stack);
|
||||||
spawned.RandomOffset(0.5f);
|
spawned.RandomOffset(0.5f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
public bool TryInsert(DisposalUnitComponent from)
|
public bool TryInsert(DisposalUnitComponent from)
|
||||||
{
|
{
|
||||||
var holder = IoCManager.Resolve<IEntityManager>().SpawnEntity(HolderPrototypeId, Owner.Transform.MapPosition);
|
var holder = IoCManager.Resolve<IEntityManager>().SpawnEntity(HolderPrototypeId, Owner.Transform.MapPosition);
|
||||||
var holderComponent = holder.GetComponent<DisposalHolderComponent>();
|
var holderComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DisposalHolderComponent>(holder.Uid);
|
||||||
|
|
||||||
foreach (var entity in from.ContainedEntities.ToArray())
|
foreach (var entity in from.ContainedEntities.ToArray())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -277,11 +277,10 @@ namespace Content.Server.Electrocution
|
|||||||
var electrocutionEntity = EntityManager.SpawnEntity(
|
var electrocutionEntity = EntityManager.SpawnEntity(
|
||||||
$"VirtualElectrocutionLoad{node.NodeGroupID}", sourceTransform.Coordinates);
|
$"VirtualElectrocutionLoad{node.NodeGroupID}", sourceTransform.Coordinates);
|
||||||
|
|
||||||
var electrocutionNode = electrocutionEntity
|
var electrocutionNode = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(electrocutionEntity.Uid)
|
||||||
.GetComponent<NodeContainerComponent>()
|
|
||||||
.GetNode<ElectrocutionNode>("electrocution");
|
.GetNode<ElectrocutionNode>("electrocution");
|
||||||
|
|
||||||
var electrocutionComponent = electrocutionEntity.GetComponent<ElectrocutionComponent>();
|
var electrocutionComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ElectrocutionComponent>(electrocutionEntity.Uid);
|
||||||
|
|
||||||
electrocutionNode.CableEntity = sourceUid;
|
electrocutionNode.CableEntity = sourceUid;
|
||||||
electrocutionNode.NodeName = node.Name;
|
electrocutionNode.NodeName = node.Name;
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
var puddleEnt = serverEntityManager.SpawnEntity(prototype, spillGridCoords);
|
var puddleEnt = serverEntityManager.SpawnEntity(prototype, spillGridCoords);
|
||||||
var newPuddleComponent = puddleEnt.GetComponent<PuddleComponent>();
|
var newPuddleComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PuddleComponent>(puddleEnt.Uid);
|
||||||
|
|
||||||
puddleSystem.TryAddSolution(newPuddleComponent.Owner.Uid, solution, sound);
|
puddleSystem.TryAddSolution(newPuddleComponent.Owner.Uid, solution, sound);
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the solution to the vapor and actually send the thing
|
// Add the solution to the vapor and actually send the thing
|
||||||
var vaporComponent = vapor.GetComponent<VaporComponent>();
|
var vaporComponent = IoCManager.Resolve<IEntityManager>().GetComponent<VaporComponent>(vapor.Uid);
|
||||||
var vaporSystem = EntitySystem.Get<VaporSystem>();
|
var vaporSystem = EntitySystem.Get<VaporSystem>();
|
||||||
vaporSystem.TryAddSolution(vaporComponent, solution);
|
vaporSystem.TryAddSolution(vaporComponent, solution);
|
||||||
|
|
||||||
|
|||||||
@@ -329,9 +329,10 @@ namespace Content.Server.Fluids.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
puddle ??= () =>
|
puddle ??= () =>
|
||||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddleComponent.Owner.Uid).EntityPrototype?.ID,
|
{
|
||||||
mapGrid.DirectionToGrid(coords, direction))
|
return IoCManager.Resolve<IEntityManager>().GetComponent<PuddleComponent>(IoCManager.Resolve<IEntityManager>().SpawnEntity(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddleComponent.Owner.Uid).EntityPrototype?.ID,
|
||||||
.GetComponent<PuddleComponent>();
|
mapGrid.DirectionToGrid(coords, direction)).Uid);
|
||||||
|
};
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ namespace Content.Server.GameTicking
|
|||||||
|
|
||||||
var mob = SpawnObserverMob();
|
var mob = SpawnObserverMob();
|
||||||
mob.Name = name;
|
mob.Name = name;
|
||||||
var ghost = mob.GetComponent<GhostComponent>();
|
var ghost = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(mob.Uid);
|
||||||
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghost, false);
|
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghost, false);
|
||||||
newMind.TransferTo(mob.Uid);
|
newMind.TransferTo(mob.Uid);
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ namespace Content.Server.GameTicking
|
|||||||
if (!string.IsNullOrEmpty(equipmentStr))
|
if (!string.IsNullOrEmpty(equipmentStr))
|
||||||
{
|
{
|
||||||
var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, entity.Transform.Coordinates);
|
var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, entity.Transform.Coordinates);
|
||||||
inventory.Equip(slot, equipmentEntity.GetComponent<ItemComponent>());
|
inventory.Equip(slot, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(equipmentEntity.Uid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ namespace Content.Server.GameTicking
|
|||||||
_cardSystem.TryChangeFullName(card.Owner.Uid, characterName, card);
|
_cardSystem.TryChangeFullName(card.Owner.Uid, characterName, card);
|
||||||
_cardSystem.TryChangeJobTitle(card.Owner.Uid, jobPrototype.Name, card);
|
_cardSystem.TryChangeJobTitle(card.Owner.Uid, jobPrototype.Name, card);
|
||||||
|
|
||||||
var access = card.Owner.GetComponent<AccessComponent>();
|
var access = IoCManager.Resolve<IEntityManager>().GetComponent<AccessComponent>(card.Owner.Uid);
|
||||||
var accessTags = access.Tags;
|
var accessTags = access.Tags;
|
||||||
accessTags.UnionWith(jobPrototype.Access);
|
accessTags.UnionWith(jobPrototype.Access);
|
||||||
EntityManager.EntitySysManager.GetEntitySystem<PDASystem>()
|
EntityManager.EntitySysManager.GetEntitySystem<PDASystem>()
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
|
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
|
||||||
ghost.Name = mind.Session.Name;
|
ghost.Name = mind.Session.Name;
|
||||||
|
|
||||||
var ghostComponent = ghost.GetComponent<GhostComponent>();
|
var ghostComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(ghost.Uid);
|
||||||
|
|
||||||
if (mind.TimeOfDeath.HasValue)
|
if (mind.TimeOfDeath.HasValue)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,15 +93,15 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
|
|
||||||
// pda
|
// pda
|
||||||
var newPDA = _entityManager.SpawnEntity(PDAPrototypeName, mind.OwnedEntity.Transform.Coordinates);
|
var newPDA = _entityManager.SpawnEntity(PDAPrototypeName, mind.OwnedEntity.Transform.Coordinates);
|
||||||
inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, newPDA.GetComponent<ItemComponent>());
|
inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(newPDA.Uid));
|
||||||
|
|
||||||
// belt
|
// belt
|
||||||
var newTmp = _entityManager.SpawnEntity(BeltPrototypeName, mind.OwnedEntity.Transform.Coordinates);
|
var newTmp = _entityManager.SpawnEntity(BeltPrototypeName, mind.OwnedEntity.Transform.Coordinates);
|
||||||
inventory.Equip(EquipmentSlotDefines.Slots.BELT, newTmp.GetComponent<ItemComponent>());
|
inventory.Equip(EquipmentSlotDefines.Slots.BELT, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(newTmp.Uid));
|
||||||
|
|
||||||
// backpack
|
// backpack
|
||||||
newTmp = _entityManager.SpawnEntity(BackpackPrototypeName, mind.OwnedEntity.Transform.Coordinates);
|
newTmp = _entityManager.SpawnEntity(BackpackPrototypeName, mind.OwnedEntity.Transform.Coordinates);
|
||||||
inventory.Equip(EquipmentSlotDefines.Slots.BACKPACK, newTmp.GetComponent<ItemComponent>());
|
inventory.Equip(EquipmentSlotDefines.Slots.BACKPACK, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(newTmp.Uid));
|
||||||
|
|
||||||
// Like normal traitors, they need access to a traitor account.
|
// Like normal traitors, they need access to a traitor account.
|
||||||
var uplinkAccount = new UplinkAccount(startingBalance, mind.OwnedEntity.Uid);
|
var uplinkAccount = new UplinkAccount(startingBalance, mind.OwnedEntity.Uid);
|
||||||
@@ -114,7 +114,7 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
_allOriginalNames[uplinkAccount] = mind.OwnedEntity.Name;
|
_allOriginalNames[uplinkAccount] = mind.OwnedEntity.Name;
|
||||||
|
|
||||||
// The PDA needs to be marked with the correct owner.
|
// The PDA needs to be marked with the correct owner.
|
||||||
var pda = newPDA.GetComponent<PDAComponent>();
|
var pda = IoCManager.Resolve<IEntityManager>().GetComponent<PDAComponent>(newPDA.Uid);
|
||||||
_entityManager.EntitySysManager.GetEntitySystem<PDASystem>()
|
_entityManager.EntitySysManager.GetEntitySystem<PDASystem>()
|
||||||
.SetOwner(pda, mind.OwnedEntity.Name);
|
.SetOwner(pda, mind.OwnedEntity.Name);
|
||||||
IoCManager.Resolve<IEntityManager>().AddComponent<TraitorDeathMatchReliableOwnerTagComponent>(newPDA).UserId = mind.UserId;
|
IoCManager.Resolve<IEntityManager>().AddComponent<TraitorDeathMatchReliableOwnerTagComponent>(newPDA).UserId = mind.UserId;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Content.Server.Gravity.EntitySystems
|
|||||||
if (_mapManager.TryGetGrid(status.Owner.Transform.GridID, out var grid))
|
if (_mapManager.TryGetGrid(status.Owner.Transform.GridID, out var grid))
|
||||||
{
|
{
|
||||||
var gridEntity = EntityManager.GetEntity(grid.GridEntityId);
|
var gridEntity = EntityManager.GetEntity(grid.GridEntityId);
|
||||||
if (gridEntity.GetComponent<GravityComponent>().Enabled)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(gridEntity.Uid).Enabled)
|
||||||
{
|
{
|
||||||
RemoveWeightless(status);
|
RemoveWeightless(status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Content.Server.Hands.Systems
|
|||||||
|
|
||||||
var pos = hands.Owner.Transform.Coordinates;
|
var pos = hands.Owner.Transform.Coordinates;
|
||||||
var virtualItem = EntityManager.SpawnEntity("HandVirtualItem", pos);
|
var virtualItem = EntityManager.SpawnEntity("HandVirtualItem", pos);
|
||||||
var virtualItemComp = virtualItem.GetComponent<HandVirtualItemComponent>();
|
var virtualItemComp = IoCManager.Resolve<IEntityManager>().GetComponent<HandVirtualItemComponent>(virtualItem.Uid);
|
||||||
virtualItemComp.BlockingEntity = blockingEnt;
|
virtualItemComp.BlockingEntity = blockingEnt;
|
||||||
hands.PutEntityIntoHand(hand, virtualItem);
|
hands.PutEntityIntoHand(hand, virtualItem);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Server.Items;
|
|||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
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 static Content.Shared.Inventory.EquipmentSlotDefines;
|
using static Content.Shared.Inventory.EquipmentSlotDefines;
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ namespace Content.Server.Inventory.Components
|
|||||||
|
|
||||||
if (slotMask == SlotFlags.POCKET)
|
if (slotMask == SlotFlags.POCKET)
|
||||||
{
|
{
|
||||||
var itemComponent = entity.GetComponent<ItemComponent>();
|
var itemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(entity.Uid);
|
||||||
|
|
||||||
// If this item is small enough then it always fits in pockets.
|
// If this item is small enough then it always fits in pockets.
|
||||||
if (itemComponent.Size <= (int) ReferenceSizes.Pocket)
|
if (itemComponent.Size <= (int) ReferenceSizes.Pocket)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user