Bunch more resolves removed.
This commit is contained in:
@@ -9,13 +9,14 @@ namespace Content.Server.Containers
|
|||||||
{
|
{
|
||||||
public static int CountPrototypeOccurencesRecursive(this ContainerManagerComponent mgr, string prototypeId)
|
public static int CountPrototypeOccurencesRecursive(this ContainerManagerComponent mgr, string prototypeId)
|
||||||
{
|
{
|
||||||
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
int total = 0;
|
int total = 0;
|
||||||
foreach (var container in mgr.GetAllContainers())
|
foreach (var container in mgr.GetAllContainers())
|
||||||
{
|
{
|
||||||
foreach (var entity in container.ContainedEntities)
|
foreach (var entity in container.ContainedEntities)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityPrototype?.ID == prototypeId) total++;
|
if (entMan.GetComponent<MetaDataComponent>(entity).EntityPrototype?.ID == prototypeId) total++;
|
||||||
if(!IoCManager.Resolve<IEntityManager>().TryGetComponent<ContainerManagerComponent?>(entity, out var component)) continue;
|
if(!entMan.TryGetComponent<ContainerManagerComponent?>(entity, out var component)) continue;
|
||||||
total += component.CountPrototypeOccurencesRecursive(prototypeId);
|
total += component.CountPrototypeOccurencesRecursive(prototypeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,17 +7,18 @@ namespace Content.Server.Coordinates.Helpers
|
|||||||
{
|
{
|
||||||
public static class SnapgridHelper
|
public static class SnapgridHelper
|
||||||
{
|
{
|
||||||
public static void SnapToGrid(this EntityUid entity, IEntityManager? entityManager = null, IMapManager? mapManager = null)
|
public static void SnapToGrid(this EntityUid entity, IEntityManager? entMan = null, IMapManager? mapManager = null)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates.SnapToGrid(entityManager, mapManager);
|
IoCManager.Resolve(ref entMan, ref mapManager);
|
||||||
|
var transform = entMan.GetComponent<TransformComponent>(entity);
|
||||||
|
transform.Coordinates = transform.Coordinates.SnapToGrid(entMan, mapManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entityManager = null, IMapManager? mapManager = null)
|
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entMan = null, IMapManager? mapManager = null)
|
||||||
{
|
{
|
||||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
IoCManager.Resolve(ref entMan, ref mapManager);
|
||||||
mapManager ??= IoCManager.Resolve<IMapManager>();
|
|
||||||
|
|
||||||
var gridId = coordinates.GetGridId(entityManager);
|
var gridId = coordinates.GetGridId(entMan);
|
||||||
|
|
||||||
var tileSize = 1f;
|
var tileSize = 1f;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace Content.Server.Crayon
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class CrayonComponent : SharedCrayonComponent, IAfterInteract, IUse, IDropped, ISerializationHooks
|
public class CrayonComponent : SharedCrayonComponent, IAfterInteract, IUse, IDropped, ISerializationHooks
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
|
||||||
[DataField("useSound")]
|
[DataField("useSound")]
|
||||||
@@ -91,7 +92,7 @@ namespace Content.Server.Crayon
|
|||||||
// Opens the selection window
|
// Opens the selection window
|
||||||
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
|
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
if (_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||||
{
|
{
|
||||||
UserInterface?.Toggle(actor.PlayerSession);
|
UserInterface?.Toggle(actor.PlayerSession);
|
||||||
if (UserInterface?.SessionHasOpen(actor.PlayerSession) == true)
|
if (UserInterface?.SessionHasOpen(actor.PlayerSession) == true)
|
||||||
@@ -119,7 +120,7 @@ namespace Content.Server.Crayon
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eventArgs.ClickLocation.IsValid(IoCManager.Resolve<IEntityManager>()))
|
if (!eventArgs.ClickLocation.IsValid(_entMan))
|
||||||
{
|
{
|
||||||
eventArgs.User.PopupMessage(Loc.GetString("crayon-interact-invalid-location"));
|
eventArgs.User.PopupMessage(Loc.GetString("crayon-interact-invalid-location"));
|
||||||
return true;
|
return true;
|
||||||
@@ -140,7 +141,7 @@ namespace Content.Server.Crayon
|
|||||||
|
|
||||||
void IDropped.Dropped(DroppedEventArgs eventArgs)
|
void IDropped.Dropped(DroppedEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
if (_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||||
UserInterface?.Close(actor.PlayerSession);
|
UserInterface?.Close(actor.PlayerSession);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ namespace Content.Server.Cuffs.Components
|
|||||||
[ComponentReference(typeof(SharedCuffableComponent))]
|
[ComponentReference(typeof(SharedCuffableComponent))]
|
||||||
public class CuffableComponent : SharedCuffableComponent
|
public class CuffableComponent : SharedCuffableComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many of this entity's hands are currently cuffed.
|
/// How many of this entity's hands are currently cuffed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -64,7 +66,7 @@ namespace Content.Server.Cuffs.Components
|
|||||||
|
|
||||||
if (CuffedHandCount > 0)
|
if (CuffedHandCount > 0)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<HandcuffComponent?>(LastAddedCuffs, out var cuffs))
|
if (_entMan.TryGetComponent<HandcuffComponent?>(LastAddedCuffs, out var cuffs))
|
||||||
{
|
{
|
||||||
return new CuffableComponentState(CuffedHandCount,
|
return new CuffableComponentState(CuffedHandCount,
|
||||||
CanStillInteract,
|
CanStillInteract,
|
||||||
@@ -89,7 +91,7 @@ namespace Content.Server.Cuffs.Components
|
|||||||
/// <param name="prototype"></param>
|
/// <param name="prototype"></param>
|
||||||
public bool TryAddNewCuffs(EntityUid user, EntityUid handcuff)
|
public bool TryAddNewCuffs(EntityUid user, EntityUid handcuff)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandcuffComponent>(handcuff))
|
if (!_entMan.HasComponent<HandcuffComponent>(handcuff))
|
||||||
{
|
{
|
||||||
Logger.Warning($"Handcuffs being applied to player are missing a {nameof(HandcuffComponent)}!");
|
Logger.Warning($"Handcuffs being applied to player are missing a {nameof(HandcuffComponent)}!");
|
||||||
return false;
|
return false;
|
||||||
@@ -102,14 +104,14 @@ namespace Content.Server.Cuffs.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Success!
|
// Success!
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? handsComponent) && handsComponent.IsHolding(handcuff))
|
if (_entMan.TryGetComponent(user, out HandsComponent? handsComponent) && handsComponent.IsHolding(handcuff))
|
||||||
{
|
{
|
||||||
// Good lord handscomponent is scuffed, I hope some smug person will fix it someday
|
// Good lord handscomponent is scuffed, I hope some smug person will fix it someday
|
||||||
handsComponent.Drop(handcuff);
|
handsComponent.Drop(handcuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
Container.Insert(handcuff);
|
Container.Insert(handcuff);
|
||||||
CanStillInteract = IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out HandsComponent? ownerHands) && ownerHands.HandNames.Count() > CuffedHandCount;
|
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? ownerHands) && ownerHands.HandNames.Count() > CuffedHandCount;
|
||||||
|
|
||||||
OnCuffedStateChanged?.Invoke();
|
OnCuffedStateChanged?.Invoke();
|
||||||
UpdateAlert();
|
UpdateAlert();
|
||||||
@@ -129,7 +131,7 @@ namespace Content.Server.Cuffs.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateHeldItems()
|
public void UpdateHeldItems()
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out HandsComponent? handsComponent)) return;
|
if (!_entMan.TryGetComponent(Owner, out HandsComponent? handsComponent)) return;
|
||||||
|
|
||||||
var itemCount = handsComponent.GetAllHeldItems().Count();
|
var itemCount = handsComponent.GetAllHeldItems().Count();
|
||||||
var freeHandCount = handsComponent.HandNames.Count() - CuffedHandCount;
|
var freeHandCount = handsComponent.HandNames.Count() - CuffedHandCount;
|
||||||
@@ -156,7 +158,7 @@ namespace Content.Server.Cuffs.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void UpdateAlert()
|
private void UpdateAlert()
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ServerAlertsComponent? status))
|
if (_entMan.TryGetComponent(Owner, out ServerAlertsComponent? status))
|
||||||
{
|
{
|
||||||
if (CanStillInteract)
|
if (CanStillInteract)
|
||||||
{
|
{
|
||||||
@@ -198,14 +200,14 @@ namespace Content.Server.Cuffs.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<HandcuffComponent?>(cuffsToRemove, out var cuff))
|
if (!_entMan.TryGetComponent<HandcuffComponent?>(cuffsToRemove, out var cuff))
|
||||||
{
|
{
|
||||||
Logger.Warning($"A user is trying to remove handcuffs without a {nameof(HandcuffComponent)}. This should never happen!");
|
Logger.Warning($"A user is trying to remove handcuffs without a {nameof(HandcuffComponent)}. This should never happen!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var attempt = new UncuffAttemptEvent(user, Owner);
|
var attempt = new UncuffAttemptEvent(user, Owner);
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(user, attempt);
|
_entMan.EventBus.RaiseLocalEvent(user, attempt);
|
||||||
|
|
||||||
if (attempt.Cancelled)
|
if (attempt.Cancelled)
|
||||||
{
|
{
|
||||||
@@ -257,23 +259,23 @@ namespace Content.Server.Cuffs.Components
|
|||||||
SoundSystem.Play(Filter.Pvs(Owner), cuff.EndUncuffSound.GetSound(), Owner);
|
SoundSystem.Play(Filter.Pvs(Owner), cuff.EndUncuffSound.GetSound(), Owner);
|
||||||
|
|
||||||
Container.ForceRemove(cuffsToRemove);
|
Container.ForceRemove(cuffsToRemove);
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(cuffsToRemove).AttachToGridOrMap();
|
_entMan.GetComponent<TransformComponent>(cuffsToRemove).AttachToGridOrMap();
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(cuffsToRemove).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).WorldPosition;
|
_entMan.GetComponent<TransformComponent>(cuffsToRemove).WorldPosition = _entMan.GetComponent<TransformComponent>(Owner).WorldPosition;
|
||||||
|
|
||||||
if (cuff.BreakOnRemove)
|
if (cuff.BreakOnRemove)
|
||||||
{
|
{
|
||||||
cuff.Broken = true;
|
cuff.Broken = true;
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(cuffsToRemove).EntityName = cuff.BrokenName;
|
_entMan.GetComponent<MetaDataComponent>(cuffsToRemove).EntityName = cuff.BrokenName;
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(cuffsToRemove).EntityDescription = cuff.BrokenDesc;
|
_entMan.GetComponent<MetaDataComponent>(cuffsToRemove).EntityDescription = cuff.BrokenDesc;
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SpriteComponent?>(cuffsToRemove, out var sprite) && cuff.BrokenState != null)
|
if (_entMan.TryGetComponent<SpriteComponent?>(cuffsToRemove, out var sprite) && cuff.BrokenState != null)
|
||||||
{
|
{
|
||||||
sprite.LayerSetState(0, cuff.BrokenState); // TODO: safety check to see if RSI contains the state?
|
sprite.LayerSetState(0, cuff.BrokenState); // TODO: safety check to see if RSI contains the state?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CanStillInteract = IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.HandNames.Count() > CuffedHandCount;
|
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.HandNames.Count() > CuffedHandCount;
|
||||||
OnCuffedStateChanged?.Invoke();
|
OnCuffedStateChanged?.Invoke();
|
||||||
UpdateAlert();
|
UpdateAlert();
|
||||||
Dirty();
|
Dirty();
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace Content.Server.Damage.Commands
|
|||||||
string[] args,
|
string[] args,
|
||||||
[NotNullWhen(true)] out Damage? func)
|
[NotNullWhen(true)] out Damage? func)
|
||||||
{
|
{
|
||||||
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
if (!int.TryParse(args[1], out var amount))
|
if (!int.TryParse(args[1], out var amount))
|
||||||
{
|
{
|
||||||
@@ -99,7 +99,7 @@ namespace Content.Server.Damage.Commands
|
|||||||
var damage = new DamageSpecifier(damageGroup, amount);
|
var damage = new DamageSpecifier(damageGroup, amount);
|
||||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
|
EntitySystem.Get<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
|
||||||
|
|
||||||
shell.WriteLine($"Damaged entity {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} for {amount} {damageGroup} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
shell.WriteLine($"Damaged entity {entMan.GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} for {amount} {damageGroup} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||||
};
|
};
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -112,7 +112,7 @@ namespace Content.Server.Damage.Commands
|
|||||||
var damage = new DamageSpecifier(damageType, amount);
|
var damage = new DamageSpecifier(damageType, amount);
|
||||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
|
EntitySystem.Get<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
|
||||||
|
|
||||||
shell.WriteLine($"Damaged entity {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
shell.WriteLine($"Damaged entity {entMan.GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||||
|
|
||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
@@ -137,6 +137,8 @@ namespace Content.Server.Damage.Commands
|
|||||||
EntityUid entity;
|
EntityUid entity;
|
||||||
Damage? damageFunc;
|
Damage? damageFunc;
|
||||||
|
|
||||||
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
switch (args.Length)
|
switch (args.Length)
|
||||||
{
|
{
|
||||||
// Check if we have enough for the dmg types to show
|
// Check if we have enough for the dmg types to show
|
||||||
@@ -190,9 +192,9 @@ namespace Content.Server.Damage.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out DamageableComponent? damageable))
|
if (!entMan.TryGetComponent(entity, out DamageableComponent? damageable))
|
||||||
{
|
{
|
||||||
shell.WriteLine($"Entity {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} does not have a {nameof(DamageableComponent)}.");
|
shell.WriteLine($"Entity {entMan.GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} does not have a {nameof(DamageableComponent)}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,16 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||||
public class DisposalEntryComponent : DisposalTubeComponent
|
public class DisposalEntryComponent : DisposalTubeComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
private const string HolderPrototypeId = "DisposalHolder";
|
private const string HolderPrototypeId = "DisposalHolder";
|
||||||
|
|
||||||
public override string Name => "DisposalEntry";
|
public override string Name => "DisposalEntry";
|
||||||
|
|
||||||
public bool TryInsert(DisposalUnitComponent from)
|
public bool TryInsert(DisposalUnitComponent from)
|
||||||
{
|
{
|
||||||
var holder = IoCManager.Resolve<IEntityManager>().SpawnEntity(HolderPrototypeId, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapPosition);
|
var holder = _entMan.SpawnEntity(HolderPrototypeId, _entMan.GetComponent<TransformComponent>(Owner).MapPosition);
|
||||||
var holderComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DisposalHolderComponent>(holder);
|
var holderComponent = _entMan.GetComponent<DisposalHolderComponent>(holder);
|
||||||
|
|
||||||
foreach (var entity in from.ContainedEntities.ToArray())
|
foreach (var entity in from.ContainedEntities.ToArray())
|
||||||
{
|
{
|
||||||
@@ -37,7 +39,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
|
|
||||||
protected override Direction[] ConnectableDirections()
|
protected override Direction[] ConnectableDirections()
|
||||||
{
|
{
|
||||||
return new[] {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetDir()};
|
return new[] {_entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir()};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||||
public class DisposalJunctionComponent : DisposalTubeComponent
|
public class DisposalJunctionComponent : DisposalTubeComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -27,14 +28,14 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
|
|
||||||
protected override Direction[] ConnectableDirections()
|
protected override Direction[] ConnectableDirections()
|
||||||
{
|
{
|
||||||
var direction = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation;
|
var direction = _entMan.GetComponent<TransformComponent>(Owner).LocalRotation;
|
||||||
|
|
||||||
return _degrees.Select(degree => new Angle(degree.Theta + direction.Theta).GetDir()).ToArray();
|
return _degrees.Select(degree => new Angle(degree.Theta + direction.Theta).GetDir()).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Direction NextDirection(DisposalHolderComponent holder)
|
public override Direction NextDirection(DisposalHolderComponent holder)
|
||||||
{
|
{
|
||||||
var next = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
var next = _entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||||
var directions = ConnectableDirections().Skip(1).ToArray();
|
var directions = ConnectableDirections().Skip(1).ToArray();
|
||||||
|
|
||||||
if (holder.PreviousDirectionFrom == Direction.Invalid ||
|
if (holder.PreviousDirectionFrom == Direction.Invalid ||
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||||
public class DisposalRouterComponent : DisposalJunctionComponent, IActivate
|
public class DisposalRouterComponent : DisposalJunctionComponent, IActivate
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "DisposalRouter";
|
public override string Name => "DisposalRouter";
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
@@ -36,7 +38,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool Anchored =>
|
public bool Anchored =>
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out IPhysBody? physics) ||
|
!_entMan.TryGetComponent(Owner, out IPhysBody? physics) ||
|
||||||
physics.BodyType == BodyType.Static;
|
physics.BodyType == BodyType.Static;
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key);
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key);
|
||||||
@@ -52,7 +54,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
return directions[1];
|
return directions[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
return _entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
@@ -160,12 +162,12 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
||||||
void IActivate.Activate(ActivateEventArgs args)
|
void IActivate.Activate(ActivateEventArgs args)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
|
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out HandsComponent? hands))
|
if (!_entMan.TryGetComponent(args.User, out HandsComponent? hands))
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(args.User, Loc.GetString("disposal-router-window-tag-input-activate-no-hands"));
|
Owner.PopupMessage(args.User, Loc.GetString("disposal-router-window-tag-input-activate-no-hands"));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||||
public class DisposalTaggerComponent : DisposalTransitComponent, IActivate
|
public class DisposalTaggerComponent : DisposalTransitComponent, IActivate
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "DisposalTagger";
|
public override string Name => "DisposalTagger";
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
@@ -33,7 +35,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool Anchored =>
|
public bool Anchored =>
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||||
physics.BodyType == BodyType.Static;
|
physics.BodyType == BodyType.Static;
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);
|
||||||
@@ -126,12 +128,12 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
||||||
void IActivate.Activate(ActivateEventArgs args)
|
void IActivate.Activate(ActivateEventArgs args)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
|
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out HandsComponent? hands))
|
if (!_entMan.TryGetComponent(args.User, out HandsComponent? hands))
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(args.User, Loc.GetString("disposal-tagger-window-activate-no-hands"));
|
Owner.PopupMessage(args.User, Loc.GetString("disposal-tagger-window-activate-no-hands"));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
{
|
{
|
||||||
public abstract class DisposalTubeComponent : Component, IDisposalTubeComponent, IBreakAct
|
public abstract class DisposalTubeComponent : Component, IDisposalTubeComponent, IBreakAct
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public static readonly TimeSpan ClangDelay = TimeSpan.FromSeconds(0.5);
|
public static readonly TimeSpan ClangDelay = TimeSpan.FromSeconds(0.5);
|
||||||
public TimeSpan LastClang;
|
public TimeSpan LastClang;
|
||||||
|
|
||||||
@@ -35,7 +37,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private bool Anchored =>
|
private bool Anchored =>
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||||
physics.BodyType == BodyType.Static;
|
physics.BodyType == BodyType.Static;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -88,7 +90,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
|
|
||||||
foreach (var entity in Contents.ContainedEntities.ToArray())
|
foreach (var entity in Contents.ContainedEntities.ToArray())
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out DisposalHolderComponent? holder))
|
if (!_entMan.TryGetComponent(entity, out DisposalHolderComponent? holder))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -106,7 +108,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
|
|
||||||
private void UpdateVisualState()
|
private void UpdateVisualState()
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (!_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -122,7 +124,7 @@ namespace Content.Server.Disposal.Tube.Components
|
|||||||
|
|
||||||
public void AnchoredChanged()
|
public void AnchoredChanged()
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physics))
|
if (!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ namespace Content.Server.Disposal.Unit.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class DisposalHolderComponent : Component, IGasMixtureHolder
|
public class DisposalHolderComponent : Component, IGasMixtureHolder
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "DisposalHolder";
|
public override string Name => "DisposalHolder";
|
||||||
|
|
||||||
public Container Container = null!;
|
public Container Container = null!;
|
||||||
@@ -79,8 +81,8 @@ namespace Content.Server.Disposal.Unit.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(entity) ||
|
return _entMan.HasComponent<ItemComponent>(entity) ||
|
||||||
IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity);
|
_entMan.HasComponent<SharedBodyComponent>(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryInsert(EntityUid entity)
|
public bool TryInsert(EntityUid entity)
|
||||||
@@ -90,7 +92,7 @@ namespace Content.Server.Disposal.Unit.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IPhysBody? physics))
|
if (_entMan.TryGetComponent(entity, out IPhysBody? physics))
|
||||||
{
|
{
|
||||||
physics.CanCollide = false;
|
physics.CanCollide = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ namespace Content.Server.Doors.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class FirelockComponent : Component
|
public class FirelockComponent : Component
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "Firelock";
|
public override string Name => "Firelock";
|
||||||
|
|
||||||
[ComponentDependency]
|
[ComponentDependency]
|
||||||
@@ -31,7 +33,7 @@ namespace Content.Server.Doors.Components
|
|||||||
if (DoorComponent != null && DoorComponent.State == SharedDoorComponent.DoorState.Open && DoorComponent.CanCloseGeneric())
|
if (DoorComponent != null && DoorComponent.State == SharedDoorComponent.DoorState.Open && DoorComponent.CanCloseGeneric())
|
||||||
{
|
{
|
||||||
DoorComponent.Close();
|
DoorComponent.Close();
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AirtightComponent? airtight))
|
if (_entMan.TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||||
{
|
{
|
||||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
||||||
}
|
}
|
||||||
@@ -47,7 +49,7 @@ namespace Content.Server.Doors.Components
|
|||||||
var minMoles = float.MaxValue;
|
var minMoles = float.MaxValue;
|
||||||
var maxMoles = 0f;
|
var maxMoles = 0f;
|
||||||
|
|
||||||
foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates))
|
foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(_entMan.GetComponent<TransformComponent>(Owner).Coordinates))
|
||||||
{
|
{
|
||||||
var moles = adjacent.TotalMoles;
|
var moles = adjacent.TotalMoles;
|
||||||
if (moles < minMoles)
|
if (moles < minMoles)
|
||||||
@@ -63,7 +65,7 @@ namespace Content.Server.Doors.Components
|
|||||||
{
|
{
|
||||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
|
|
||||||
if (!atmosphereSystem.TryGetGridAndTile(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, out var tuple))
|
if (!atmosphereSystem.TryGetGridAndTile(_entMan.GetComponent<TransformComponent>(Owner).Coordinates, out var tuple))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (atmosphereSystem.GetTileMixture(tuple.Value.Grid, tuple.Value.Tile) == null)
|
if (atmosphereSystem.GetTileMixture(tuple.Value.Grid, tuple.Value.Tile) == null)
|
||||||
@@ -72,7 +74,7 @@ namespace Content.Server.Doors.Components
|
|||||||
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, tuple.Value.Tile))
|
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, tuple.Value.Tile))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates))
|
foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(_entMan.GetComponent<TransformComponent>(Owner).Coordinates))
|
||||||
{
|
{
|
||||||
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, adjacent))
|
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, adjacent))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ namespace Content.Server.Doors.Components
|
|||||||
[ComponentReference(typeof(SharedDoorComponent))]
|
[ComponentReference(typeof(SharedDoorComponent))]
|
||||||
public class ServerDoorComponent : SharedDoorComponent, IActivate, IInteractUsing, IMapInit
|
public class ServerDoorComponent : SharedDoorComponent, IActivate, IInteractUsing, IMapInit
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
[DataField("board", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
[DataField("board", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||||
private string? _boardPrototype;
|
private string? _boardPrototype;
|
||||||
@@ -77,7 +79,7 @@ namespace Content.Server.Doors.Components
|
|||||||
_ => throw new ArgumentOutOfRangeException(),
|
_ => throw new ArgumentOutOfRangeException(),
|
||||||
};
|
};
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new DoorStateChangedEvent(State), false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, new DoorStateChangedEvent(State), false);
|
||||||
_autoCloseCancelTokenSource?.Cancel();
|
_autoCloseCancelTokenSource?.Cancel();
|
||||||
|
|
||||||
Dirty();
|
Dirty();
|
||||||
@@ -219,7 +221,7 @@ namespace Content.Server.Doors.Components
|
|||||||
{
|
{
|
||||||
if (!CanWeldShut)
|
if (!CanWeldShut)
|
||||||
{
|
{
|
||||||
Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' is true, but door cannot be welded.", IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' is true, but door cannot be welded.", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetAppearance(DoorVisualState.Welded);
|
SetAppearance(DoorVisualState.Welded);
|
||||||
@@ -242,7 +244,7 @@ namespace Content.Server.Doors.Components
|
|||||||
{
|
{
|
||||||
if (IsWeldedShut)
|
if (IsWeldedShut)
|
||||||
{
|
{
|
||||||
Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' and 'startOpen' are both true.", IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' and 'startOpen' are both true.", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QuickOpen(false);
|
QuickOpen(false);
|
||||||
@@ -257,7 +259,7 @@ namespace Content.Server.Doors.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var ev = new DoorClickShouldActivateEvent(eventArgs);
|
var ev = new DoorClickShouldActivateEvent(eventArgs);
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||||
if (ev.Handled)
|
if (ev.Handled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -276,7 +278,7 @@ namespace Content.Server.Doors.Components
|
|||||||
public void TryOpen(EntityUid user = default)
|
public void TryOpen(EntityUid user = default)
|
||||||
{
|
{
|
||||||
var msg = new DoorOpenAttemptEvent();
|
var msg = new DoorOpenAttemptEvent();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, msg);
|
_entMan.EventBus.RaiseLocalEvent(Owner, msg);
|
||||||
|
|
||||||
if (msg.Cancelled) return;
|
if (msg.Cancelled) return;
|
||||||
|
|
||||||
@@ -289,7 +291,7 @@ namespace Content.Server.Doors.Components
|
|||||||
{
|
{
|
||||||
Open();
|
Open();
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? hands) && hands.Count == 0)
|
if (_entMan.TryGetComponent(user, out HandsComponent? hands) && hands.Count == 0)
|
||||||
{
|
{
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), _tryOpenDoorSound.GetSound(), Owner,
|
SoundSystem.Play(Filter.Pvs(Owner), _tryOpenDoorSound.GetSound(), Owner,
|
||||||
AudioParams.Default.WithVolume(-2));
|
AudioParams.Default.WithVolume(-2));
|
||||||
@@ -308,7 +310,7 @@ namespace Content.Server.Doors.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AccessReader? access))
|
if (!_entMan.TryGetComponent(Owner, out AccessReader? access))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -332,7 +334,7 @@ namespace Content.Server.Doors.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool HasAccessType(string accessType)
|
private bool HasAccessType(string accessType)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AccessReader? access))
|
if (_entMan.TryGetComponent(Owner, out AccessReader? access))
|
||||||
{
|
{
|
||||||
return access.AccessLists.Any(list => list.Contains(accessType));
|
return access.AccessLists.Any(list => list.Contains(accessType));
|
||||||
}
|
}
|
||||||
@@ -353,7 +355,7 @@ namespace Content.Server.Doors.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ev = new BeforeDoorOpenedEvent();
|
var ev = new BeforeDoorOpenedEvent();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||||
return !ev.Cancelled;
|
return !ev.Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,12 +365,12 @@ namespace Content.Server.Doors.Components
|
|||||||
public void Open()
|
public void Open()
|
||||||
{
|
{
|
||||||
State = DoorState.Opening;
|
State = DoorState.Opening;
|
||||||
if (Occludes && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out OccluderComponent? occluder))
|
if (Occludes && _entMan.TryGetComponent(Owner, out OccluderComponent? occluder))
|
||||||
{
|
{
|
||||||
occluder.Enabled = false;
|
occluder.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ChangeAirtight && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AirtightComponent? airtight))
|
if (ChangeAirtight && _entMan.TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||||
{
|
{
|
||||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
||||||
}
|
}
|
||||||
@@ -396,17 +398,17 @@ namespace Content.Server.Doors.Components
|
|||||||
{
|
{
|
||||||
base.OnPartialOpen();
|
base.OnPartialOpen();
|
||||||
|
|
||||||
if (ChangeAirtight && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AirtightComponent? airtight))
|
if (ChangeAirtight && _entMan.TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||||
{
|
{
|
||||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false));
|
_entMan.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QuickOpen(bool refresh)
|
private void QuickOpen(bool refresh)
|
||||||
{
|
{
|
||||||
if (Occludes && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out OccluderComponent? occluder))
|
if (Occludes && _entMan.TryGetComponent(Owner, out OccluderComponent? occluder))
|
||||||
{
|
{
|
||||||
occluder.Enabled = false;
|
occluder.Enabled = false;
|
||||||
}
|
}
|
||||||
@@ -423,7 +425,7 @@ namespace Content.Server.Doors.Components
|
|||||||
public void TryClose(EntityUid user = default)
|
public void TryClose(EntityUid user = default)
|
||||||
{
|
{
|
||||||
var msg = new DoorCloseAttemptEvent();
|
var msg = new DoorCloseAttemptEvent();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, msg);
|
_entMan.EventBus.RaiseLocalEvent(Owner, msg);
|
||||||
|
|
||||||
if (msg.Cancelled) return;
|
if (msg.Cancelled) return;
|
||||||
|
|
||||||
@@ -443,7 +445,7 @@ namespace Content.Server.Doors.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AccessReader? access))
|
if (!_entMan.TryGetComponent(Owner, out AccessReader? access))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -459,7 +461,7 @@ namespace Content.Server.Doors.Components
|
|||||||
public bool CanCloseGeneric()
|
public bool CanCloseGeneric()
|
||||||
{
|
{
|
||||||
var ev = new BeforeDoorClosedEvent();
|
var ev = new BeforeDoorClosedEvent();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||||
if (ev.Cancelled)
|
if (ev.Cancelled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -469,7 +471,7 @@ namespace Content.Server.Doors.Components
|
|||||||
private bool SafetyCheck()
|
private bool SafetyCheck()
|
||||||
{
|
{
|
||||||
var ev = new DoorSafetyEnabledEvent();
|
var ev = new DoorSafetyEnabledEvent();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||||
return ev.Safety || _inhibitCrush;
|
return ev.Safety || _inhibitCrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,7 +483,7 @@ namespace Content.Server.Doors.Components
|
|||||||
{
|
{
|
||||||
var safety = SafetyCheck();
|
var safety = SafetyCheck();
|
||||||
|
|
||||||
if (safety && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physicsComponent))
|
if (safety && _entMan.TryGetComponent(Owner, out PhysicsComponent? physicsComponent))
|
||||||
{
|
{
|
||||||
var broadPhaseSystem = EntitySystem.Get<SharedPhysicsSystem>();
|
var broadPhaseSystem = EntitySystem.Get<SharedPhysicsSystem>();
|
||||||
|
|
||||||
@@ -525,7 +527,7 @@ namespace Content.Server.Doors.Components
|
|||||||
OnPartialClose();
|
OnPartialClose();
|
||||||
await Timer.Delay(CloseTimeTwo, _stateChangeCancelTokenSource.Token);
|
await Timer.Delay(CloseTimeTwo, _stateChangeCancelTokenSource.Token);
|
||||||
|
|
||||||
if (Occludes && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out OccluderComponent? occluder))
|
if (Occludes && _entMan.TryGetComponent(Owner, out OccluderComponent? occluder))
|
||||||
{
|
{
|
||||||
occluder.Enabled = true;
|
occluder.Enabled = true;
|
||||||
}
|
}
|
||||||
@@ -541,12 +543,12 @@ namespace Content.Server.Doors.Components
|
|||||||
// if safety is off, crushes people inside of the door, temporarily turning off collisions with them while doing so.
|
// if safety is off, crushes people inside of the door, temporarily turning off collisions with them while doing so.
|
||||||
var becomeairtight = ChangeAirtight && (SafetyCheck() || !TryCrush());
|
var becomeairtight = ChangeAirtight && (SafetyCheck() || !TryCrush());
|
||||||
|
|
||||||
if (becomeairtight && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AirtightComponent? airtight))
|
if (becomeairtight && _entMan.TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||||
{
|
{
|
||||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true));
|
_entMan.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -581,7 +583,7 @@ namespace Content.Server.Doors.Components
|
|||||||
hitsomebody = true;
|
hitsomebody = true;
|
||||||
CurrentlyCrushing.Add(e.Owner);
|
CurrentlyCrushing.Add(e.Owner);
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<DamageableComponent>(e.Owner))
|
if (_entMan.HasComponent<DamageableComponent>(e.Owner))
|
||||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(e.Owner, CrushDamage);
|
EntitySystem.Get<DamageableSystem>().TryChangeDamage(e.Owner, CrushDamage);
|
||||||
|
|
||||||
EntitySystem.Get<StunSystem>().TryParalyze(e.Owner, TimeSpan.FromSeconds(DoorStunTime), true);
|
EntitySystem.Get<StunSystem>().TryParalyze(e.Owner, TimeSpan.FromSeconds(DoorStunTime), true);
|
||||||
@@ -602,7 +604,7 @@ namespace Content.Server.Doors.Components
|
|||||||
public void Deny()
|
public void Deny()
|
||||||
{
|
{
|
||||||
var ev = new BeforeDoorDeniedEvent();
|
var ev = new BeforeDoorDeniedEvent();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||||
if (ev.Cancelled)
|
if (ev.Cancelled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -649,14 +651,14 @@ namespace Content.Server.Doors.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var autoev = new BeforeDoorAutoCloseEvent();
|
var autoev = new BeforeDoorAutoCloseEvent();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, autoev, false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, autoev, false);
|
||||||
if (autoev.Cancelled)
|
if (autoev.Cancelled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_autoCloseCancelTokenSource = new();
|
_autoCloseCancelTokenSource = new();
|
||||||
|
|
||||||
var ev = new DoorGetCloseTimeModifierEvent();
|
var ev = new DoorGetCloseTimeModifierEvent();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||||
var realCloseTime = AutoCloseDelay * ev.CloseTimeModifier;
|
var realCloseTime = AutoCloseDelay * ev.CloseTimeModifier;
|
||||||
|
|
||||||
Owner.SpawnRepeatingTimer(realCloseTime, async () =>
|
Owner.SpawnRepeatingTimer(realCloseTime, async () =>
|
||||||
@@ -671,7 +673,7 @@ namespace Content.Server.Doors.Components
|
|||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if(!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out ToolComponent? tool))
|
if(!_entMan.TryGetComponent(eventArgs.Using, out ToolComponent? tool))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -682,10 +684,10 @@ namespace Content.Server.Doors.Components
|
|||||||
if (tool.Qualities.Contains(_pryingQuality) && !IsWeldedShut)
|
if (tool.Qualities.Contains(_pryingQuality) && !IsWeldedShut)
|
||||||
{
|
{
|
||||||
var ev = new DoorGetPryTimeModifierEvent();
|
var ev = new DoorGetPryTimeModifierEvent();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||||
|
|
||||||
var canEv = new BeforeDoorPryEvent(eventArgs);
|
var canEv = new BeforeDoorPryEvent(eventArgs);
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, canEv, false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, canEv, false);
|
||||||
|
|
||||||
if (canEv.Cancelled) return false;
|
if (canEv.Cancelled) return false;
|
||||||
|
|
||||||
@@ -694,7 +696,7 @@ namespace Content.Server.Doors.Components
|
|||||||
|
|
||||||
if (successfulPry && !IsWeldedShut)
|
if (successfulPry && !IsWeldedShut)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new OnDoorPryEvent(eventArgs), false);
|
_entMan.EventBus.RaiseLocalEvent(Owner, new OnDoorPryEvent(eventArgs), false);
|
||||||
if (State == DoorState.Closed)
|
if (State == DoorState.Closed)
|
||||||
{
|
{
|
||||||
Open();
|
Open();
|
||||||
@@ -708,7 +710,7 @@ namespace Content.Server.Doors.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for welding doors
|
// for welding doors
|
||||||
if (CanWeldShut && IoCManager.Resolve<IEntityManager>().TryGetComponent(tool.Owner, out WelderComponent? welder) && welder.Lit)
|
if (CanWeldShut && _entMan.TryGetComponent(tool.Owner, out WelderComponent? welder) && welder.Lit)
|
||||||
{
|
{
|
||||||
if(!_beingWelded)
|
if(!_beingWelded)
|
||||||
{
|
{
|
||||||
@@ -743,7 +745,7 @@ namespace Content.Server.Doors.Components
|
|||||||
private void CreateDoorElectronicsBoard()
|
private void CreateDoorElectronicsBoard()
|
||||||
{
|
{
|
||||||
// Ensure that the construction component is aware of the board container.
|
// Ensure that the construction component is aware of the board container.
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ConstructionComponent? construction))
|
if (_entMan.TryGetComponent(Owner, out ConstructionComponent? construction))
|
||||||
EntitySystem.Get<ConstructionSystem>().AddContainer(Owner, "board", construction);
|
EntitySystem.Get<ConstructionSystem>().AddContainer(Owner, "board", construction);
|
||||||
|
|
||||||
// We don't do anything if this is null or empty.
|
// We don't do anything if this is null or empty.
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ namespace Content.Server.Explosion.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed class ClusterFlashComponent : Component, IInteractUsing, IUse
|
public sealed class ClusterFlashComponent : Component, IInteractUsing, IUse
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "ClusterFlash";
|
public override string Name => "ClusterFlash";
|
||||||
|
|
||||||
private Container _grenadesContainer = default!;
|
private Container _grenadesContainer = default!;
|
||||||
@@ -59,7 +61,7 @@ namespace Content.Server.Explosion.Components
|
|||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
|
||||||
{
|
{
|
||||||
if (_grenadesContainer.ContainedEntities.Count >= _maxGrenades ||
|
if (_grenadesContainer.ContainedEntities.Count >= _maxGrenades ||
|
||||||
!IoCManager.Resolve<IEntityManager>().HasComponent<FlashOnTriggerComponent>(args.Using))
|
!_entMan.HasComponent<FlashOnTriggerComponent>(args.Using))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_grenadesContainer.Insert(args.Using);
|
_grenadesContainer.Insert(args.Using);
|
||||||
@@ -92,7 +94,7 @@ namespace Content.Server.Explosion.Components
|
|||||||
return false;
|
return false;
|
||||||
Owner.SpawnTimer((int) (_delay * 1000), () =>
|
Owner.SpawnTimer((int) (_delay * 1000), () =>
|
||||||
{
|
{
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if ((!_entMan.EntityExists(Owner) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
return;
|
return;
|
||||||
_countDown = true;
|
_countDown = true;
|
||||||
var random = IoCManager.Resolve<IRobustRandom>();
|
var random = IoCManager.Resolve<IRobustRandom>();
|
||||||
@@ -115,14 +117,14 @@ namespace Content.Server.Explosion.Components
|
|||||||
|
|
||||||
grenade.SpawnTimer(delay, () =>
|
grenade.SpawnTimer(delay, () =>
|
||||||
{
|
{
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(grenade) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(grenade).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if ((!_entMan.EntityExists(grenade) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(grenade).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EntitySystem.Get<TriggerSystem>().Trigger(grenade, eventArgs.User);
|
EntitySystem.Get<TriggerSystem>().Trigger(grenade, eventArgs.User);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
_entMan.DeleteEntity(Owner);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -134,7 +136,7 @@ namespace Content.Server.Explosion.Components
|
|||||||
if (_unspawnedCount > 0)
|
if (_unspawnedCount > 0)
|
||||||
{
|
{
|
||||||
_unspawnedCount--;
|
_unspawnedCount--;
|
||||||
grenade = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapPosition);
|
grenade = _entMan.SpawnEntity(_fillPrototype, _entMan.GetComponent<TransformComponent>(Owner).MapPosition);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +156,7 @@ namespace Content.Server.Explosion.Components
|
|||||||
|
|
||||||
private void UpdateAppearance()
|
private void UpdateAppearance()
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance)) return;
|
if (!_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance)) return;
|
||||||
|
|
||||||
appearance.SetData(ClusterFlashVisuals.GrenadesCounter, _grenadesContainer.ContainedEntities.Count + _unspawnedCount);
|
appearance.SetData(ClusterFlashVisuals.GrenadesCounter, _grenadesContainer.ContainedEntities.Count + _unspawnedCount);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,19 +9,21 @@ namespace Content.Server.Explosion.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class ExplosionLaunchedComponent : Component, IExAct
|
public class ExplosionLaunchedComponent : Component, IExAct
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "ExplosionLaunched";
|
public override string Name => "ExplosionLaunched";
|
||||||
|
|
||||||
void IExAct.OnExplosion(ExplosionEventArgs eventArgs)
|
void IExAct.OnExplosion(ExplosionEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if (_entMan.Deleted(Owner))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var sourceLocation = eventArgs.Source;
|
var sourceLocation = eventArgs.Source;
|
||||||
var targetLocation = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.Target).Coordinates;
|
var targetLocation = _entMan.GetComponent<TransformComponent>(eventArgs.Target).Coordinates;
|
||||||
|
|
||||||
if (sourceLocation.Equals(targetLocation)) return;
|
if (sourceLocation.Equals(targetLocation)) return;
|
||||||
|
|
||||||
var offset = (targetLocation.ToMapPos(IoCManager.Resolve<IEntityManager>()) - sourceLocation.ToMapPos(IoCManager.Resolve<IEntityManager>()));
|
var offset = (targetLocation.ToMapPos(_entMan) - sourceLocation.ToMapPos(_entMan));
|
||||||
|
|
||||||
//Don't throw if the direction is center (0,0)
|
//Don't throw if the direction is center (0,0)
|
||||||
if (offset == Vector2.Zero) return;
|
if (offset == Vector2.Zero) return;
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ namespace Content.Server.Extinguisher
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class FireExtinguisherComponent : SharedFireExtinguisherComponent, IAfterInteract, IUse, IActivate, IDropped
|
public class FireExtinguisherComponent : SharedFireExtinguisherComponent, IAfterInteract, IUse, IActivate, IDropped
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "FireExtinguisher";
|
public override string Name => "FireExtinguisher";
|
||||||
|
|
||||||
[DataField("refillSound")]
|
[DataField("refillSound")]
|
||||||
@@ -58,7 +60,7 @@ namespace Content.Server.Extinguisher
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (eventArgs.Target is not {Valid: true} target ||
|
if (eventArgs.Target is not {Valid: true} target ||
|
||||||
!IoCManager.Resolve<IEntityManager>().HasComponent<ReagentTankComponent>(target) ||
|
!_entMan.HasComponent<ReagentTankComponent>(target) ||
|
||||||
!solutionContainerSystem.TryGetDrainableSolution(target, out var targetSolution) ||
|
!solutionContainerSystem.TryGetDrainableSolution(target, out var targetSolution) ||
|
||||||
!solutionContainerSystem.TryGetDrainableSolution(Owner, out var container))
|
!solutionContainerSystem.TryGetDrainableSolution(Owner, out var container))
|
||||||
{
|
{
|
||||||
@@ -103,13 +105,13 @@ namespace Content.Server.Extinguisher
|
|||||||
|
|
||||||
_safety = state;
|
_safety = state;
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
appearance.SetData(FireExtinguisherVisuals.Safety, _safety);
|
appearance.SetData(FireExtinguisherVisuals.Safety, _safety);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDropped.Dropped(DroppedEventArgs eventArgs)
|
void IDropped.Dropped(DroppedEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (_hasSafety && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (_hasSafety && _entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
appearance.SetData(FireExtinguisherVisuals.Safety, _safety);
|
appearance.SetData(FireExtinguisherVisuals.Safety, _safety);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ namespace Content.Server.Fluids.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class BucketComponent : Component, IInteractUsing
|
public class BucketComponent : Component, IInteractUsing
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "Bucket";
|
public override string Name => "Bucket";
|
||||||
public const string SolutionName = "bucket";
|
public const string SolutionName = "bucket";
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
var solutionsSys = EntitySystem.Get<SolutionContainerSystem>();
|
var solutionsSys = EntitySystem.Get<SolutionContainerSystem>();
|
||||||
if (!solutionsSys.TryGetSolution(Owner, SolutionName, out var contents) ||
|
if (!solutionsSys.TryGetSolution(Owner, SolutionName, out var contents) ||
|
||||||
_currentlyUsing.Contains(eventArgs.Using) ||
|
_currentlyUsing.Contains(eventArgs.Using) ||
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out MopComponent? mopComponent) ||
|
!_entMan.TryGetComponent(eventArgs.Using, out MopComponent? mopComponent) ||
|
||||||
mopComponent.Mopping)
|
mopComponent.Mopping)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -87,7 +89,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
_currentlyUsing.Remove(eventArgs.Using);
|
_currentlyUsing.Remove(eventArgs.Using);
|
||||||
|
|
||||||
if (result == DoAfterStatus.Cancelled ||
|
if (result == DoAfterStatus.Cancelled ||
|
||||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
(!_entMan.EntityExists(Owner) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||||
mopComponent.Deleted ||
|
mopComponent.Deleted ||
|
||||||
CurrentVolume <= 0 ||
|
CurrentVolume <= 0 ||
|
||||||
!Owner.InRangeUnobstructed(mopComponent.Owner))
|
!Owner.InRangeUnobstructed(mopComponent.Owner))
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
Mopping = false;
|
Mopping = false;
|
||||||
|
|
||||||
if (result == DoAfterStatus.Cancelled ||
|
if (result == DoAfterStatus.Cancelled ||
|
||||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
(!_entities.EntityExists(Owner) ? EntityLifeStage.Deleted : _entities.GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||||
puddleComponent.Deleted)
|
puddleComponent.Deleted)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
// is the puddle cleaned?
|
// is the puddle cleaned?
|
||||||
if (puddleSolution.TotalVolume - transferAmount <= 0)
|
if (puddleSolution.TotalVolume - transferAmount <= 0)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(puddleComponent.Owner);
|
_entities.DeleteEntity(puddleComponent.Owner);
|
||||||
|
|
||||||
// After cleaning the puddle, make a new puddle with solution from the mop as a "wet floor". Then evaporate it slowly.
|
// After cleaning the puddle, make a new puddle with solution from the mop as a "wet floor". Then evaporate it slowly.
|
||||||
// we do this WITHOUT adding to the existing puddle. Otherwise we have might have water puddles with the vomit sprite.
|
// we do this WITHOUT adding to the existing puddle. Otherwise we have might have water puddles with the vomit sprite.
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
public const float SprayDistance = 3f;
|
public const float SprayDistance = 3f;
|
||||||
public const string SolutionName = "spray";
|
public const string SolutionName = "spray";
|
||||||
|
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
[DataField("transferAmount")]
|
[DataField("transferAmount")]
|
||||||
@@ -99,8 +100,8 @@ namespace Content.Server.Fluids.Components
|
|||||||
if(curTime < _cooldownEnd)
|
if(curTime < _cooldownEnd)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var playerPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User).Coordinates;
|
var playerPos = _entMan.GetComponent<TransformComponent>(eventArgs.User).Coordinates;
|
||||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
var entManager = _entMan;
|
||||||
|
|
||||||
if (eventArgs.ClickLocation.GetGridId(entManager) != playerPos.GetGridId(entManager))
|
if (eventArgs.ClickLocation.GetGridId(entManager) != playerPos.GetGridId(entManager))
|
||||||
return true;
|
return true;
|
||||||
@@ -124,10 +125,10 @@ namespace Content.Server.Fluids.Components
|
|||||||
var diffNorm = diffPos.Normalized;
|
var diffNorm = diffPos.Normalized;
|
||||||
var diffLength = diffPos.Length;
|
var diffLength = diffPos.Length;
|
||||||
|
|
||||||
var target = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter);
|
var target = _entMan.GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter);
|
||||||
|
|
||||||
if (target.TryDistance(IoCManager.Resolve<IEntityManager>(), playerPos, out var distance) && distance > SprayDistance)
|
if (target.TryDistance(_entMan, playerPos, out var distance) && distance > SprayDistance)
|
||||||
target = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset(diffNorm * SprayDistance);
|
target = _entMan.GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset(diffNorm * SprayDistance);
|
||||||
|
|
||||||
var solution = EntitySystem.Get<SolutionContainerSystem>().SplitSolution(Owner, contents, _transferAmount);
|
var solution = EntitySystem.Get<SolutionContainerSystem>().SplitSolution(Owner, contents, _transferAmount);
|
||||||
|
|
||||||
@@ -135,24 +136,24 @@ namespace Content.Server.Fluids.Components
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
var vapor = entManager.SpawnEntity(_vaporPrototype, playerPos.Offset(distance < 1 ? quarter : threeQuarters));
|
var vapor = entManager.SpawnEntity(_vaporPrototype, playerPos.Offset(distance < 1 ? quarter : threeQuarters));
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(vapor).LocalRotation = rotation;
|
_entMan.GetComponent<TransformComponent>(vapor).LocalRotation = rotation;
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(vapor, out AppearanceComponent? appearance))
|
if (_entMan.TryGetComponent(vapor, out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
appearance.SetData(VaporVisuals.Color, contents.Color.WithAlpha(1f));
|
appearance.SetData(VaporVisuals.Color, contents.Color.WithAlpha(1f));
|
||||||
appearance.SetData(VaporVisuals.State, true);
|
appearance.SetData(VaporVisuals.State, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the solution to the vapor and actually send the thing
|
// Add the solution to the vapor and actually send the thing
|
||||||
var vaporComponent = IoCManager.Resolve<IEntityManager>().GetComponent<VaporComponent>(vapor);
|
var vaporComponent = _entMan.GetComponent<VaporComponent>(vapor);
|
||||||
var vaporSystem = EntitySystem.Get<VaporSystem>();
|
var vaporSystem = EntitySystem.Get<VaporSystem>();
|
||||||
vaporSystem.TryAddSolution(vaporComponent, solution);
|
vaporSystem.TryAddSolution(vaporComponent, solution);
|
||||||
|
|
||||||
// impulse direction is defined in world-coordinates, not local coordinates
|
// impulse direction is defined in world-coordinates, not local coordinates
|
||||||
var impulseDirection = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(vapor).WorldRotation.ToVec();
|
var impulseDirection = _entMan.GetComponent<TransformComponent>(vapor).WorldRotation.ToVec();
|
||||||
vaporSystem.Start(vaporComponent, impulseDirection, _sprayVelocity, target, _sprayAliveTime);
|
vaporSystem.Start(vaporComponent, impulseDirection, _sprayVelocity, target, _sprayAliveTime);
|
||||||
|
|
||||||
if (_impulse > 0f && IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out IPhysBody? body))
|
if (_impulse > 0f && _entMan.TryGetComponent(eventArgs.User, out IPhysBody? body))
|
||||||
{
|
{
|
||||||
body.ApplyLinearImpulse(-impulseDirection * _impulse);
|
body.ApplyLinearImpulse(-impulseDirection * _impulse);
|
||||||
}
|
}
|
||||||
@@ -163,7 +164,7 @@ namespace Content.Server.Fluids.Components
|
|||||||
_lastUseTime = curTime;
|
_lastUseTime = curTime;
|
||||||
_cooldownEnd = _lastUseTime + TimeSpan.FromSeconds(_cooldownTime);
|
_cooldownEnd = _lastUseTime + TimeSpan.FromSeconds(_cooldownTime);
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ItemCooldownComponent? cooldown))
|
if (_entMan.TryGetComponent(Owner, out ItemCooldownComponent? cooldown))
|
||||||
{
|
{
|
||||||
cooldown.CooldownStart = _lastUseTime;
|
cooldown.CooldownStart = _lastUseTime;
|
||||||
cooldown.CooldownEnd = _cooldownEnd;
|
cooldown.CooldownEnd = _cooldownEnd;
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ namespace Content.Server.GameTicking
|
|||||||
if (mind.CharacterName != null)
|
if (mind.CharacterName != null)
|
||||||
playerIcName = mind.CharacterName;
|
playerIcName = mind.CharacterName;
|
||||||
else if (mind.CurrentEntity != null)
|
else if (mind.CurrentEntity != null)
|
||||||
playerIcName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mind.CurrentEntity.Value).EntityName;
|
playerIcName = EntityManager.GetComponent<MetaDataComponent>(mind.CurrentEntity.Value).EntityName;
|
||||||
|
|
||||||
var playerEndRoundInfo = new RoundEndMessageEvent.RoundEndPlayerInfo()
|
var playerEndRoundInfo = new RoundEndMessageEvent.RoundEndPlayerInfo()
|
||||||
{
|
{
|
||||||
@@ -369,7 +369,7 @@ namespace Content.Server.GameTicking
|
|||||||
{
|
{
|
||||||
// TODO: Maybe something less naive here?
|
// TODO: Maybe something less naive here?
|
||||||
// FIXME: Actually, definitely.
|
// FIXME: Actually, definitely.
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(entity);
|
EntityManager.DeleteEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
_mapManager.Restart();
|
_mapManager.Restart();
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var ghost = entities.SpawnEntity("MobObserver", position.ToMap(entities));
|
||||||
var ghost = entityManager.SpawnEntity("MobObserver", position.ToMap(entityManager));
|
|
||||||
|
|
||||||
// Try setting the ghost entity name to either the character name or the player name.
|
// Try setting the ghost entity name to either the character name or the player name.
|
||||||
// If all else fails, it'll default to the default entity prototype name, "observer".
|
// If all else fails, it'll default to the default entity prototype name, "observer".
|
||||||
@@ -87,7 +86,7 @@ namespace Content.Server.GameTicking.Presets
|
|||||||
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
|
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
|
||||||
entities.GetComponent<MetaDataComponent>(ghost).EntityName = mind.Session.Name;
|
entities.GetComponent<MetaDataComponent>(ghost).EntityName = mind.Session.Name;
|
||||||
|
|
||||||
var ghostComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(ghost);
|
var ghostComponent = entities.GetComponent<GhostComponent>(ghost);
|
||||||
|
|
||||||
if (mind.TimeOfDeath.HasValue)
|
if (mind.TimeOfDeath.HasValue)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace Content.Server.Ghost.Components
|
|||||||
public class GhostRadioComponent : Component, IRadio
|
public class GhostRadioComponent : Component, IRadio
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IServerNetManager _netManager = default!;
|
[Dependency] private readonly IServerNetManager _netManager = default!;
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "GhostRadio";
|
public override string Name => "GhostRadio";
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ namespace Content.Server.Ghost.Components
|
|||||||
|
|
||||||
public void Receive(string message, int channel, EntityUid speaker)
|
public void Receive(string message, int channel, EntityUid speaker)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ActorComponent? actor))
|
if (!_entMan.TryGetComponent(Owner, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var playerChannel = actor.PlayerSession.ConnectedClient;
|
var playerChannel = actor.PlayerSession.ConnectedClient;
|
||||||
@@ -35,7 +36,7 @@ namespace Content.Server.Ghost.Components
|
|||||||
msg.Channel = ChatChannel.Radio;
|
msg.Channel = ChatChannel.Radio;
|
||||||
msg.Message = message;
|
msg.Message = message;
|
||||||
//Square brackets are added here to avoid issues with escaping
|
//Square brackets are added here to avoid issues with escaping
|
||||||
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(speaker).EntityName));
|
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: _entMan.GetComponent<MetaDataComponent>(speaker).EntityName));
|
||||||
_netManager.ServerSendMessage(msg, playerChannel);
|
_netManager.ServerSendMessage(msg, playerChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
[RegisterComponent, ComponentReference(typeof(GhostRoleComponent))]
|
[RegisterComponent, ComponentReference(typeof(GhostRoleComponent))]
|
||||||
public class GhostRoleMobSpawnerComponent : GhostRoleComponent
|
public class GhostRoleMobSpawnerComponent : GhostRoleComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "GhostRoleMobSpawner";
|
public override string Name => "GhostRoleMobSpawner";
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("deleteOnSpawn")]
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("deleteOnSpawn")]
|
||||||
@@ -40,10 +42,10 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
if (string.IsNullOrEmpty(Prototype))
|
if (string.IsNullOrEmpty(Prototype))
|
||||||
throw new NullReferenceException("Prototype string cannot be null or empty!");
|
throw new NullReferenceException("Prototype string cannot be null or empty!");
|
||||||
|
|
||||||
var mob = IoCManager.Resolve<IEntityManager>().SpawnEntity(Prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
var mob = _entMan.SpawnEntity(Prototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||||
|
|
||||||
if (MakeSentient)
|
if (MakeSentient)
|
||||||
MakeSentientCommand.MakeSentient(mob, IoCManager.Resolve<IEntityManager>());
|
MakeSentientCommand.MakeSentient(mob, _entMan);
|
||||||
|
|
||||||
mob.EnsureComponent<MindComponent>();
|
mob.EnsureComponent<MindComponent>();
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
Taken = true;
|
Taken = true;
|
||||||
|
|
||||||
if (_deleteOnSpawn)
|
if (_deleteOnSpawn)
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
_entMan.DeleteEntity(Owner);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace Content.Server.Headset
|
|||||||
public class HeadsetComponent : Component, IListen, IRadio, IExamine
|
public class HeadsetComponent : Component, IListen, IRadio, IExamine
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IServerNetManager _netManager = default!;
|
[Dependency] private readonly IServerNetManager _netManager = default!;
|
||||||
|
|
||||||
public override string Name => "Headset";
|
public override string Name => "Headset";
|
||||||
@@ -59,7 +60,7 @@ namespace Content.Server.Headset
|
|||||||
{
|
{
|
||||||
if (Owner.TryGetContainer(out var container))
|
if (Owner.TryGetContainer(out var container))
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(container.Owner, out ActorComponent? actor))
|
if (!_entMan.TryGetComponent(container.Owner, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var playerChannel = actor.PlayerSession.ConnectedClient;
|
var playerChannel = actor.PlayerSession.ConnectedClient;
|
||||||
@@ -69,7 +70,7 @@ namespace Content.Server.Headset
|
|||||||
msg.Channel = ChatChannel.Radio;
|
msg.Channel = ChatChannel.Radio;
|
||||||
msg.Message = message;
|
msg.Message = message;
|
||||||
//Square brackets are added here to avoid issues with escaping
|
//Square brackets are added here to avoid issues with escaping
|
||||||
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(source).EntityName));
|
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: _entMan.GetComponent<MetaDataComponent>(source).EntityName));
|
||||||
_netManager.ServerSendMessage(msg, playerChannel);
|
_netManager.ServerSendMessage(msg, playerChannel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ namespace Content.Server.Instruments;
|
|||||||
[RegisterComponent, ComponentReference(typeof(SharedInstrumentComponent))]
|
[RegisterComponent, ComponentReference(typeof(SharedInstrumentComponent))]
|
||||||
public sealed class InstrumentComponent : SharedInstrumentComponent
|
public sealed class InstrumentComponent : SharedInstrumentComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public float Timer = 0f;
|
public float Timer = 0f;
|
||||||
|
|
||||||
@@ -23,9 +25,10 @@ public sealed class InstrumentComponent : SharedInstrumentComponent
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public int MidiEventCount = 0;
|
public int MidiEventCount = 0;
|
||||||
|
|
||||||
|
// TODO Instruments: Make this ECS
|
||||||
public IPlayerSession? InstrumentPlayer =>
|
public IPlayerSession? InstrumentPlayer =>
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActivatableUIComponent>(Owner)?.CurrentSingleUser
|
_entMan.GetComponentOrNull<ActivatableUIComponent>(Owner)?.CurrentSingleUser
|
||||||
?? IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActorComponent>(Owner)?.PlayerSession;
|
?? _entMan.GetComponentOrNull<ActorComponent>(Owner)?.PlayerSession;
|
||||||
|
|
||||||
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
|
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,26 +13,28 @@ namespace Content.Server.Inventory.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class DebugEquipComponent : Component, IEquipped, IEquippedHand, IUnequipped, IUnequippedHand
|
public class DebugEquipComponent : Component, IEquipped, IEquippedHand, IUnequipped, IUnequippedHand
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "DebugEquip";
|
public override string Name => "DebugEquip";
|
||||||
|
|
||||||
void IEquipped.Equipped(EquippedEventArgs eventArgs)
|
void IEquipped.Equipped(EquippedEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
eventArgs.User.PopupMessage("equipped " + IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
eventArgs.User.PopupMessage("equipped " + _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IEquippedHand.EquippedHand(EquippedHandEventArgs eventArgs)
|
void IEquippedHand.EquippedHand(EquippedHandEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
eventArgs.User.PopupMessage("equipped hand " + IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
eventArgs.User.PopupMessage("equipped hand " + _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IUnequipped.Unequipped(UnequippedEventArgs eventArgs)
|
void IUnequipped.Unequipped(UnequippedEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
eventArgs.User.PopupMessage("unequipped " + IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
eventArgs.User.PopupMessage("unequipped " + _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IUnequippedHand.UnequippedHand(UnequippedHandEventArgs eventArgs)
|
void IUnequippedHand.UnequippedHand(UnequippedHandEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
eventArgs.User.PopupMessage("unequipped hand" + IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
eventArgs.User.PopupMessage("unequipped hand" + _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Content.Server.Inventory
|
|||||||
var user = inventory.Owner;
|
var user = inventory.Owner;
|
||||||
|
|
||||||
// Let's do nothing if the owner of the inventory has been deleted.
|
// Let's do nothing if the owner of the inventory has been deleted.
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(user) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(user).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if ((!entityManager.EntityExists(user) ? EntityLifeStage.Deleted : entityManager.GetComponent<MetaDataComponent>(user).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If we don't have that slot or there's already an item there, we do nothing.
|
// If we don't have that slot or there's already an item there, we do nothing.
|
||||||
@@ -28,17 +28,17 @@ namespace Content.Server.Inventory
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Let's spawn this first...
|
// Let's spawn this first...
|
||||||
var item = entityManager.SpawnEntity(prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).MapPosition);
|
var item = entityManager.SpawnEntity(prototype, entityManager.GetComponent<TransformComponent>(user).MapPosition);
|
||||||
|
|
||||||
// Helper method that deletes the item and returns false.
|
// Helper method that deletes the item and returns false.
|
||||||
bool DeleteItem()
|
bool DeleteItem()
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(item);
|
entityManager.DeleteEntity(item);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this doesn't have an item component, then we can't do anything with it.
|
// If this doesn't have an item component, then we can't do anything with it.
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(item, out ItemComponent? itemComp))
|
if (!entityManager.TryGetComponent(item, out ItemComponent? itemComp))
|
||||||
return DeleteItem();
|
return DeleteItem();
|
||||||
|
|
||||||
// We finally try to equip the item, otherwise we delete it.
|
// We finally try to equip the item, otherwise we delete it.
|
||||||
|
|||||||
@@ -29,9 +29,11 @@ namespace Content.Server.Jobs
|
|||||||
if (!EntitySystem.Get<HolidaySystem>().IsCurrentlyHoliday(Holiday))
|
if (!EntitySystem.Get<HolidaySystem>().IsCurrentlyHoliday(Holiday))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(Prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mob).Coordinates);
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out ItemComponent? item) || !IoCManager.Resolve<IEntityManager>().TryGetComponent(mob, out HandsComponent? hands))
|
var entity = entMan.SpawnEntity(Prototype, entMan.GetComponent<TransformComponent>(mob).Coordinates);
|
||||||
|
|
||||||
|
if (!entMan.TryGetComponent(entity, out ItemComponent? item) || !entMan.TryGetComponent(mob, out HandsComponent? hands))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hands.PutInHand(item, false);
|
hands.PutInHand(item, false);
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace Content.Server.Kitchen.Components
|
|||||||
[ComponentReference(typeof(IActivate))]
|
[ComponentReference(typeof(IActivate))]
|
||||||
public class KitchenSpikeComponent : SharedKitchenSpikeComponent, IActivate, ISuicideAct
|
public class KitchenSpikeComponent : SharedKitchenSpikeComponent, IActivate, ISuicideAct
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
private int _meatParts;
|
private int _meatParts;
|
||||||
private string? _meatPrototype;
|
private string? _meatPrototype;
|
||||||
private string _meatSource1p = "?";
|
private string _meatSource1p = "?";
|
||||||
@@ -40,8 +42,8 @@ namespace Content.Server.Kitchen.Components
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(_meatPrototype))
|
if (!string.IsNullOrEmpty(_meatPrototype))
|
||||||
{
|
{
|
||||||
var meat = IoCManager.Resolve<IEntityManager>().SpawnEntity(_meatPrototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
var meat = _entMan.SpawnEntity(_meatPrototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(meat).EntityName = _meatName;
|
_entMan.GetComponent<MetaDataComponent>(meat).EntityName = _meatName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_meatParts != 0)
|
if (_meatParts != 0)
|
||||||
@@ -67,7 +69,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
|
|
||||||
private void UpdateAppearance()
|
private void UpdateAppearance()
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
appearance.SetData(KitchenSpikeVisuals.Status, (_meatParts > 0) ? KitchenSpikeStatus.Bloody : KitchenSpikeStatus.Empty);
|
appearance.SetData(KitchenSpikeVisuals.Status, (_meatParts > 0) ? KitchenSpikeStatus.Bloody : KitchenSpikeStatus.Empty);
|
||||||
}
|
}
|
||||||
@@ -83,7 +85,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(victim, out butcherable))
|
if (!_entMan.TryGetComponent(victim, out butcherable))
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", victim), ("this", Owner)));
|
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", victim), ("this", Owner)));
|
||||||
return false;
|
return false;
|
||||||
@@ -106,7 +108,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented
|
// Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<MobStateComponent?>(victim, out var state) &&
|
if (_entMan.TryGetComponent<MobStateComponent?>(victim, out var state) &&
|
||||||
!state.IsDead())
|
!state.IsDead())
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim)));
|
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim)));
|
||||||
@@ -154,7 +156,7 @@ namespace Content.Server.Kitchen.Components
|
|||||||
|
|
||||||
Owner.PopupMessageEveryone(Loc.GetString("comp-kitchen-spike-kill", ("user", user), ("victim", victim)));
|
Owner.PopupMessageEveryone(Loc.GetString("comp-kitchen-spike-kill", ("user", user), ("victim", victim)));
|
||||||
// TODO: Need to be able to leave them on the spike to do DoT, see ss13.
|
// TODO: Need to be able to leave them on the spike to do DoT, see ss13.
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) victim);
|
_entMan.DeleteEntity((EntityUid) victim);
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), SpikeSound.GetSound(), Owner);
|
SoundSystem.Play(Filter.Pvs(Owner), SpikeSound.GetSound(), Owner);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ namespace Content.Server.Lathe.Components
|
|||||||
[ComponentReference(typeof(IActivate))]
|
[ComponentReference(typeof(IActivate))]
|
||||||
public class LatheComponent : SharedLatheComponent, IInteractUsing, IActivate
|
public class LatheComponent : SharedLatheComponent, IInteractUsing, IActivate
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public const int VolumePerSheet = 100;
|
public const int VolumePerSheet = 100;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
@@ -42,7 +44,7 @@ namespace Content.Server.Lathe.Components
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private LatheRecipePrototype? _producingRecipe;
|
private LatheRecipePrototype? _producingRecipe;
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private bool Powered => !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
private bool Powered => !_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||||
|
|
||||||
private static readonly TimeSpan InsertionTime = TimeSpan.FromSeconds(0.9f);
|
private static readonly TimeSpan InsertionTime = TimeSpan.FromSeconds(0.9f);
|
||||||
|
|
||||||
@@ -75,20 +77,20 @@ namespace Content.Server.Lathe.Components
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LatheSyncRequestMessage _:
|
case LatheSyncRequestMessage _:
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<MaterialStorageComponent>(Owner)) return;
|
if (!_entMan.HasComponent<MaterialStorageComponent>(Owner)) return;
|
||||||
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
||||||
if (_producingRecipe != null)
|
if (_producingRecipe != null)
|
||||||
UserInterface?.SendMessage(new LatheProducingRecipeMessage(_producingRecipe.ID));
|
UserInterface?.SendMessage(new LatheProducingRecipeMessage(_producingRecipe.ID));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LatheServerSelectionMessage _:
|
case LatheServerSelectionMessage _:
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ResearchClientComponent? researchClient)) return;
|
if (!_entMan.TryGetComponent(Owner, out ResearchClientComponent? researchClient)) return;
|
||||||
researchClient.OpenUserInterface(message.Session);
|
researchClient.OpenUserInterface(message.Session);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LatheServerSyncMessage _:
|
case LatheServerSyncMessage _:
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out TechnologyDatabaseComponent? database)
|
if (!_entMan.TryGetComponent(Owner, out TechnologyDatabaseComponent? database)
|
||||||
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ProtolatheDatabaseComponent? protoDatabase)) return;
|
|| !_entMan.TryGetComponent(Owner, out ProtolatheDatabaseComponent? protoDatabase)) return;
|
||||||
|
|
||||||
if (database.SyncWithServer())
|
if (database.SyncWithServer())
|
||||||
protoDatabase.Sync();
|
protoDatabase.Sync();
|
||||||
@@ -101,7 +103,7 @@ namespace Content.Server.Lathe.Components
|
|||||||
|
|
||||||
internal bool Produce(LatheRecipePrototype recipe)
|
internal bool Produce(LatheRecipePrototype recipe)
|
||||||
{
|
{
|
||||||
if (Producing || !Powered || !CanProduce(recipe) || !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MaterialStorageComponent? storage)) return false;
|
if (Producing || !Powered || !CanProduce(recipe) || !_entMan.TryGetComponent(Owner, out MaterialStorageComponent? storage)) return false;
|
||||||
|
|
||||||
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
||||||
|
|
||||||
@@ -123,7 +125,7 @@ namespace Content.Server.Lathe.Components
|
|||||||
{
|
{
|
||||||
Producing = false;
|
Producing = false;
|
||||||
_producingRecipe = null;
|
_producingRecipe = null;
|
||||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(recipe.Result, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
_entMan.SpawnEntity(recipe.Result, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||||
UserInterface?.SendMessage(new LatheStoppedProducingRecipeMessage());
|
UserInterface?.SendMessage(new LatheStoppedProducingRecipeMessage());
|
||||||
State = LatheState.Base;
|
State = LatheState.Base;
|
||||||
SetAppearance(LatheVisualState.Idle);
|
SetAppearance(LatheVisualState.Idle);
|
||||||
@@ -139,7 +141,7 @@ namespace Content.Server.Lathe.Components
|
|||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||||
return;
|
return;
|
||||||
if (!Powered)
|
if (!Powered)
|
||||||
{
|
{
|
||||||
@@ -151,12 +153,12 @@ namespace Content.Server.Lathe.Components
|
|||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MaterialStorageComponent? storage)
|
if (!_entMan.TryGetComponent(Owner, out MaterialStorageComponent? storage)
|
||||||
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out MaterialComponent? material)) return false;
|
|| !_entMan.TryGetComponent(eventArgs.Using, out MaterialComponent? material)) return false;
|
||||||
|
|
||||||
var multiplier = 1;
|
var multiplier = 1;
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out StackComponent? stack)) multiplier = stack.Count;
|
if (_entMan.TryGetComponent(eventArgs.Using, out StackComponent? stack)) multiplier = stack.Count;
|
||||||
|
|
||||||
var totalAmount = 0;
|
var totalAmount = 0;
|
||||||
|
|
||||||
@@ -202,14 +204,14 @@ namespace Content.Server.Lathe.Components
|
|||||||
SetAppearance(LatheVisualState.Idle);
|
SetAppearance(LatheVisualState.Idle);
|
||||||
});
|
});
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(eventArgs.Using);
|
_entMan.DeleteEntity(eventArgs.Using);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAppearance(LatheVisualState state)
|
private void SetAppearance(LatheVisualState state)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
appearance.SetData(PowerDeviceVisuals.VisualState, state);
|
appearance.SetData(PowerDeviceVisuals.VisualState, state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ namespace Content.Server.Light.Components
|
|||||||
public class EmergencyLightComponent : SharedEmergencyLightComponent, IExamine
|
public class EmergencyLightComponent : SharedEmergencyLightComponent, IExamine
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private EmergencyLightState State
|
private EmergencyLightState State
|
||||||
{
|
{
|
||||||
@@ -31,7 +33,7 @@ namespace Content.Server.Light.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_state = value;
|
_state = value;
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new EmergencyLightMessage(this, _state));
|
_entMan.EventBus.RaiseEvent(EventSource.Local, new EmergencyLightMessage(this, _state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +62,7 @@ namespace Content.Server.Light.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateState()
|
public void UpdateState()
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
if (!_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -80,7 +82,7 @@ namespace Content.Server.Light.Components
|
|||||||
|
|
||||||
public void OnUpdate(float frameTime)
|
public void OnUpdate(float frameTime)
|
||||||
{
|
{
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) || !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out BatteryComponent? battery) || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityPaused))
|
if ((!_entMan.EntityExists(Owner) || !_entMan.TryGetComponent(Owner, out BatteryComponent? battery) || _entMan.GetComponent<MetaDataComponent>(Owner).EntityPaused))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -98,7 +100,7 @@ namespace Content.Server.Light.Components
|
|||||||
battery.CurrentCharge += _chargingWattage * frameTime * _chargingEfficiency;
|
battery.CurrentCharge += _chargingWattage * frameTime * _chargingEfficiency;
|
||||||
if (battery.IsFullyCharged)
|
if (battery.IsFullyCharged)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
if (_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||||
{
|
{
|
||||||
receiver.Load = 1;
|
receiver.Load = 1;
|
||||||
}
|
}
|
||||||
@@ -110,23 +112,23 @@ namespace Content.Server.Light.Components
|
|||||||
|
|
||||||
private void TurnOff()
|
private void TurnOff()
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PointLightComponent? light))
|
if (_entMan.TryGetComponent(Owner, out PointLightComponent? light))
|
||||||
{
|
{
|
||||||
light.Enabled = false;
|
light.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
appearance.SetData(EmergencyLightVisuals.On, false);
|
appearance.SetData(EmergencyLightVisuals.On, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TurnOn()
|
private void TurnOn()
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PointLightComponent? light))
|
if (_entMan.TryGetComponent(Owner, out PointLightComponent? light))
|
||||||
{
|
{
|
||||||
light.Enabled = true;
|
light.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
appearance.SetData(EmergencyLightVisuals.On, true);
|
appearance.SetData(EmergencyLightVisuals.On, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ namespace Content.Server.Light.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class ExpendableLightComponent : SharedExpendableLightComponent, IUse
|
public class ExpendableLightComponent : SharedExpendableLightComponent, IUse
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Status of light, whether or not it is emitting light.
|
/// Status of light, whether or not it is emitting light.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -36,14 +38,14 @@ namespace Content.Server.Light.Components
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(Owner, out var item))
|
if (_entMan.TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||||
{
|
{
|
||||||
item.EquippedPrefix = "unlit";
|
item.EquippedPrefix = "unlit";
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentState = ExpendableLightState.BrandNew;
|
CurrentState = ExpendableLightState.BrandNew;
|
||||||
Owner.EnsureComponent<PointLightComponent>();
|
Owner.EnsureComponent<PointLightComponent>();
|
||||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out _appearance);
|
_entMan.TryGetComponent(Owner, out _appearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -53,7 +55,7 @@ namespace Content.Server.Light.Components
|
|||||||
{
|
{
|
||||||
if (!Activated && CurrentState == ExpendableLightState.BrandNew)
|
if (!Activated && CurrentState == ExpendableLightState.BrandNew)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(Owner, out var item))
|
if (_entMan.TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||||
{
|
{
|
||||||
item.EquippedPrefix = "lit";
|
item.EquippedPrefix = "lit";
|
||||||
}
|
}
|
||||||
@@ -92,7 +94,7 @@ namespace Content.Server.Light.Components
|
|||||||
|
|
||||||
private void UpdateSpriteAndSounds(bool on)
|
private void UpdateSpriteAndSounds(bool on)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? sprite))
|
if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
switch (CurrentState)
|
switch (CurrentState)
|
||||||
{
|
{
|
||||||
@@ -126,7 +128,7 @@ namespace Content.Server.Light.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ClothingComponent? clothing))
|
if (_entMan.TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||||
{
|
{
|
||||||
clothing.ClothingEquippedPrefix = on ? "Activated" : string.Empty;
|
clothing.ClothingEquippedPrefix = on ? "Activated" : string.Empty;
|
||||||
}
|
}
|
||||||
@@ -155,13 +157,13 @@ namespace Content.Server.Light.Components
|
|||||||
case ExpendableLightState.Fading:
|
case ExpendableLightState.Fading:
|
||||||
|
|
||||||
CurrentState = ExpendableLightState.Dead;
|
CurrentState = ExpendableLightState.Dead;
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName = SpentName;
|
_entMan.GetComponent<MetaDataComponent>(Owner).EntityName = SpentName;
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityDescription = SpentDesc;
|
_entMan.GetComponent<MetaDataComponent>(Owner).EntityDescription = SpentDesc;
|
||||||
|
|
||||||
UpdateSpriteAndSounds(Activated);
|
UpdateSpriteAndSounds(Activated);
|
||||||
UpdateVisualizer();
|
UpdateVisualizer();
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(Owner, out var item))
|
if (_entMan.TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||||
{
|
{
|
||||||
item.EquippedPrefix = "unlit";
|
item.EquippedPrefix = "unlit";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ namespace Content.Server.Light.Components
|
|||||||
internal sealed class HandheldLightComponent : SharedHandheldLightComponent, IUse, IExamine, IInteractUsing
|
internal sealed class HandheldLightComponent : SharedHandheldLightComponent, IUse, IExamine, IInteractUsing
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("wattage")] public float Wattage { get; set; } = 3f;
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("wattage")] public float Wattage { get; set; } = 3f;
|
||||||
[ViewVariables] private PowerCellSlotComponent _cellSlot = default!;
|
[ViewVariables] private PowerCellSlotComponent _cellSlot = default!;
|
||||||
private PowerCellComponent? Cell => _cellSlot.Cell;
|
private PowerCellComponent? Cell => _cellSlot.Cell;
|
||||||
@@ -70,7 +72,7 @@ namespace Content.Server.Light.Components
|
|||||||
protected override void OnRemove()
|
protected override void OnRemove()
|
||||||
{
|
{
|
||||||
base.OnRemove();
|
base.OnRemove();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
_entMan.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
@@ -118,7 +120,7 @@ namespace Content.Server.Light.Components
|
|||||||
SetState(false);
|
SetState(false);
|
||||||
Activated = false;
|
Activated = false;
|
||||||
UpdateLightAction();
|
UpdateLightAction();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
_entMan.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||||
|
|
||||||
if (makeNoise)
|
if (makeNoise)
|
||||||
{
|
{
|
||||||
@@ -157,7 +159,7 @@ namespace Content.Server.Light.Components
|
|||||||
Activated = true;
|
Activated = true;
|
||||||
UpdateLightAction();
|
UpdateLightAction();
|
||||||
SetState(true);
|
SetState(true);
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this));
|
_entMan.EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this));
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), TurnOnSound.GetSound(), Owner);
|
SoundSystem.Play(Filter.Pvs(Owner), TurnOnSound.GetSound(), Owner);
|
||||||
return true;
|
return true;
|
||||||
@@ -165,22 +167,22 @@ namespace Content.Server.Light.Components
|
|||||||
|
|
||||||
private void SetState(bool on)
|
private void SetState(bool on)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? sprite))
|
if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
sprite.LayerSetVisible(1, on);
|
sprite.LayerSetVisible(1, on);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PointLightComponent? light))
|
if (_entMan.TryGetComponent(Owner, out PointLightComponent? light))
|
||||||
{
|
{
|
||||||
light.Enabled = on;
|
light.Enabled = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ClothingComponent? clothing))
|
if (_entMan.TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||||
{
|
{
|
||||||
clothing.ClothingEquippedPrefix = Loc.GetString(on ? "on" : "off");
|
clothing.ClothingEquippedPrefix = Loc.GetString(on ? "on" : "off");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ItemComponent? item))
|
if (_entMan.TryGetComponent(Owner, out ItemComponent? item))
|
||||||
{
|
{
|
||||||
item.EquippedPrefix = Loc.GetString(on ? "on" : "off");
|
item.EquippedPrefix = Loc.GetString(on ? "on" : "off");
|
||||||
}
|
}
|
||||||
@@ -199,7 +201,7 @@ namespace Content.Server.Light.Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var appearanceComponent = IoCManager.Resolve<IEntityManager>().GetComponent<AppearanceComponent>(Owner);
|
var appearanceComponent = _entMan.GetComponent<AppearanceComponent>(Owner);
|
||||||
|
|
||||||
if (Cell.MaxCharge - Cell.CurrentCharge < Cell.MaxCharge * 0.70)
|
if (Cell.MaxCharge - Cell.CurrentCharge < Cell.MaxCharge * 0.70)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace Content.Server.Medical.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class HealingComponent : Component, IAfterInteract
|
public class HealingComponent : Component, IAfterInteract
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "Healing";
|
public override string Name => "Healing";
|
||||||
|
|
||||||
[DataField("damage", required: true)]
|
[DataField("damage", required: true)]
|
||||||
@@ -40,7 +42,7 @@ namespace Content.Server.Medical.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Target.Value, out DamageableComponent? targetDamage))
|
if (!_entMan.TryGetComponent(eventArgs.Target.Value, out DamageableComponent? targetDamage))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -60,7 +62,7 @@ namespace Content.Server.Medical.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedStackComponent?>(Owner, out var stack) && !EntitySystem.Get<StackSystem>().Use(Owner, 1, stack))
|
if (_entMan.TryGetComponent<SharedStackComponent?>(Owner, out var stack) && !EntitySystem.Get<StackSystem>().Use(Owner, 1, stack))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Content.Server.Medical.Components
|
|||||||
[ComponentReference(typeof(SharedMedicalScannerComponent))]
|
[ComponentReference(typeof(SharedMedicalScannerComponent))]
|
||||||
public class MedicalScannerComponent : SharedMedicalScannerComponent, IActivate, IDestroyAct
|
public class MedicalScannerComponent : SharedMedicalScannerComponent, IActivate, IDestroyAct
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IServerPreferencesManager _prefsManager = null!;
|
[Dependency] private readonly IServerPreferencesManager _prefsManager = null!;
|
||||||
|
|
||||||
public static readonly TimeSpan InternalOpenAttemptDelay = TimeSpan.FromSeconds(0.5);
|
public static readonly TimeSpan InternalOpenAttemptDelay = TimeSpan.FromSeconds(0.5);
|
||||||
@@ -36,7 +37,7 @@ namespace Content.Server.Medical.Components
|
|||||||
private ContainerSlot _bodyContainer = default!;
|
private ContainerSlot _bodyContainer = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private bool Powered => !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
private bool Powered => !_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MedicalScannerUiKey.Key);
|
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MedicalScannerUiKey.Key);
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ namespace Content.Server.Medical.Components
|
|||||||
var body = _bodyContainer.ContainedEntity;
|
var body = _bodyContainer.ContainedEntity;
|
||||||
if (body == null)
|
if (body == null)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
appearance?.SetData(MedicalScannerVisuals.Status, MedicalScannerStatus.Open);
|
appearance?.SetData(MedicalScannerVisuals.Status, MedicalScannerStatus.Open);
|
||||||
}
|
}
|
||||||
@@ -79,7 +80,7 @@ namespace Content.Server.Medical.Components
|
|||||||
return EmptyUIState;
|
return EmptyUIState;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(body.Value, out DamageableComponent? damageable))
|
if (!_entMan.TryGetComponent(body.Value, out DamageableComponent? damageable))
|
||||||
{
|
{
|
||||||
return EmptyUIState;
|
return EmptyUIState;
|
||||||
}
|
}
|
||||||
@@ -90,7 +91,7 @@ namespace Content.Server.Medical.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cloningSystem = EntitySystem.Get<CloningSystem>();
|
var cloningSystem = EntitySystem.Get<CloningSystem>();
|
||||||
var scanned = IoCManager.Resolve<IEntityManager>().TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComponent) &&
|
var scanned = _entMan.TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComponent) &&
|
||||||
mindComponent.Mind != null &&
|
mindComponent.Mind != null &&
|
||||||
cloningSystem.HasDnaScan(mindComponent.Mind);
|
cloningSystem.HasDnaScan(mindComponent.Mind);
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ namespace Content.Server.Medical.Components
|
|||||||
if (body == null)
|
if (body == null)
|
||||||
return MedicalScannerStatus.Open;
|
return MedicalScannerStatus.Open;
|
||||||
|
|
||||||
var state = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<MobStateComponent>(body.Value);
|
var state = _entMan.GetComponentOrNull<MobStateComponent>(body.Value);
|
||||||
|
|
||||||
return state == null ? MedicalScannerStatus.Open : GetStatusFromDamageState(state);
|
return state == null ? MedicalScannerStatus.Open : GetStatusFromDamageState(state);
|
||||||
}
|
}
|
||||||
@@ -146,7 +147,7 @@ namespace Content.Server.Medical.Components
|
|||||||
|
|
||||||
private void UpdateAppearance()
|
private void UpdateAppearance()
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
appearance.SetData(MedicalScannerVisuals.Status, GetStatus());
|
appearance.SetData(MedicalScannerVisuals.Status, GetStatus());
|
||||||
}
|
}
|
||||||
@@ -154,7 +155,7 @@ namespace Content.Server.Medical.Components
|
|||||||
|
|
||||||
void IActivate.Activate(ActivateEventArgs args)
|
void IActivate.Activate(ActivateEventArgs args)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
|
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -198,7 +199,7 @@ namespace Content.Server.Medical.Components
|
|||||||
{
|
{
|
||||||
var cloningSystem = EntitySystem.Get<CloningSystem>();
|
var cloningSystem = EntitySystem.Get<CloningSystem>();
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComp) || mindComp.Mind == null)
|
if (!_entMan.TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComp) || mindComp.Mind == null)
|
||||||
{
|
{
|
||||||
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("medical-scanner-component-msg-no-soul"));
|
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("medical-scanner-component-msg-no-soul"));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace Content.Server.Mind.Components
|
|||||||
public class MindComponent : Component, IExamine
|
public class MindComponent : Component, IExamine
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Mind";
|
public override string Name => "Mind";
|
||||||
|
|
||||||
@@ -59,7 +61,7 @@ namespace Content.Server.Mind.Components
|
|||||||
public void InternalEjectMind()
|
public void InternalEjectMind()
|
||||||
{
|
{
|
||||||
if (!Deleted)
|
if (!Deleted)
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new MindRemovedMessage());
|
_entMan.EventBus.RaiseLocalEvent(Owner, new MindRemovedMessage());
|
||||||
Mind = null;
|
Mind = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +73,7 @@ namespace Content.Server.Mind.Components
|
|||||||
public void InternalAssignMind(Mind value)
|
public void InternalAssignMind(Mind value)
|
||||||
{
|
{
|
||||||
Mind = value;
|
Mind = value;
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new MindAddedMessage());
|
_entMan.EventBus.RaiseLocalEvent(Owner, new MindAddedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Shutdown()
|
protected override void Shutdown()
|
||||||
@@ -86,7 +88,7 @@ namespace Content.Server.Mind.Components
|
|||||||
{
|
{
|
||||||
if (Mind?.VisitingEntity is {Valid: true} visiting)
|
if (Mind?.VisitingEntity is {Valid: true} visiting)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(visiting, out GhostComponent? ghost))
|
if (_entMan.TryGetComponent(visiting, out GhostComponent? ghost))
|
||||||
{
|
{
|
||||||
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghost, false);
|
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghost, false);
|
||||||
}
|
}
|
||||||
@@ -95,27 +97,27 @@ namespace Content.Server.Mind.Components
|
|||||||
}
|
}
|
||||||
else if (GhostOnShutdown)
|
else if (GhostOnShutdown)
|
||||||
{
|
{
|
||||||
var spawnPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
var spawnPosition = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||||
// Use a regular timer here because the entity has probably been deleted.
|
// Use a regular timer here because the entity has probably been deleted.
|
||||||
Timer.Spawn(0, () =>
|
Timer.Spawn(0, () =>
|
||||||
{
|
{
|
||||||
// Async this so that we don't throw if the grid we're on is being deleted.
|
// Async this so that we don't throw if the grid we're on is being deleted.
|
||||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
var gridId = spawnPosition.GetGridId(IoCManager.Resolve<IEntityManager>());
|
var gridId = spawnPosition.GetGridId(_entMan);
|
||||||
if (gridId == GridId.Invalid || !mapMan.GridExists(gridId))
|
if (gridId == GridId.Invalid || !mapMan.GridExists(gridId))
|
||||||
{
|
{
|
||||||
spawnPosition = EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
spawnPosition = EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
var ghost = IoCManager.Resolve<IEntityManager>().SpawnEntity("MobObserver", spawnPosition);
|
var ghost = _entMan.SpawnEntity("MobObserver", spawnPosition);
|
||||||
var ghostComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(ghost);
|
var ghostComponent = _entMan.GetComponent<GhostComponent>(ghost);
|
||||||
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghostComponent, false);
|
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghostComponent, false);
|
||||||
|
|
||||||
if (Mind != null)
|
if (Mind != null)
|
||||||
{
|
{
|
||||||
string? val = Mind.CharacterName ?? string.Empty;
|
string? val = Mind.CharacterName ?? string.Empty;
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(ghost).EntityName = val;
|
_entMan.GetComponent<MetaDataComponent>(ghost).EntityName = val;
|
||||||
Mind.TransferTo(ghost);
|
Mind.TransferTo(ghost);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -131,7 +133,7 @@ namespace Content.Server.Mind.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dead =
|
var dead =
|
||||||
IoCManager.Resolve<IEntityManager>().TryGetComponent<MobStateComponent?>(Owner, out var state) &&
|
_entMan.TryGetComponent<MobStateComponent?>(Owner, out var state) &&
|
||||||
state.IsDead();
|
state.IsDead();
|
||||||
|
|
||||||
if (!HasMind)
|
if (!HasMind)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace Content.Server.Mining.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class AsteroidRockComponent : Component, IInteractUsing
|
public class AsteroidRockComponent : Component, IInteractUsing
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
public override string Name => "AsteroidRock";
|
public override string Name => "AsteroidRock";
|
||||||
@@ -25,7 +26,7 @@ namespace Content.Server.Mining.Components
|
|||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||||
{
|
{
|
||||||
appearance.SetData(AsteroidRockVisuals.State, _random.Pick(SpriteStates));
|
appearance.SetData(AsteroidRockVisuals.State, _random.Pick(SpriteStates));
|
||||||
}
|
}
|
||||||
@@ -34,12 +35,12 @@ namespace Content.Server.Mining.Components
|
|||||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
var item = eventArgs.Using;
|
var item = eventArgs.Using;
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(item, out MeleeWeaponComponent? meleeWeaponComponent))
|
if (!_entMan.TryGetComponent(item, out MeleeWeaponComponent? meleeWeaponComponent))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner, meleeWeaponComponent.Damage);
|
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner, meleeWeaponComponent.Damage);
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(item, out PickaxeComponent? pickaxeComponent))
|
if (!_entMan.TryGetComponent(item, out PickaxeComponent? pickaxeComponent))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
SoundSystem.Play(Filter.Pvs(Owner), pickaxeComponent.MiningSound.GetSound(), Owner, AudioParams.Default);
|
SoundSystem.Play(Filter.Pvs(Owner), pickaxeComponent.MiningSound.GetSound(), Owner, AudioParams.Default);
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ namespace Content.Server.Morgue.Components
|
|||||||
public class MorgueEntityStorageComponent : EntityStorageComponent, IExamine
|
public class MorgueEntityStorageComponent : EntityStorageComponent, IExamine
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||||
|
|
||||||
public override string Name => "MorgueEntityStorage";
|
public override string Name => "MorgueEntityStorage";
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
@@ -65,13 +67,13 @@ namespace Content.Server.Morgue.Components
|
|||||||
public override Vector2 ContentsDumpPosition()
|
public override Vector2 ContentsDumpPosition()
|
||||||
{
|
{
|
||||||
if (_tray != null)
|
if (_tray != null)
|
||||||
return IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_tray).WorldPosition;
|
return _entMan.GetComponent<TransformComponent>(_tray).WorldPosition;
|
||||||
return base.ContentsDumpPosition();
|
return base.ContentsDumpPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool AddToContents(EntityUid entity)
|
protected override bool AddToContents(EntityUid entity)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity) && !EntitySystem.Get<StandingStateSystem>().IsDown(entity))
|
if (_entMan.HasComponent<SharedBodyComponent>(entity) && !EntitySystem.Get<StandingStateSystem>().IsDown(entity))
|
||||||
return false;
|
return false;
|
||||||
return base.AddToContents(entity);
|
return base.AddToContents(entity);
|
||||||
}
|
}
|
||||||
@@ -79,7 +81,7 @@ namespace Content.Server.Morgue.Components
|
|||||||
public override bool CanOpen(EntityUid user, bool silent = false)
|
public override bool CanOpen(EntityUid user, bool silent = false)
|
||||||
{
|
{
|
||||||
if (!Owner.InRangeUnobstructed(
|
if (!Owner.InRangeUnobstructed(
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates.Offset(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetCardinalDir()),
|
_entMan.GetComponent<TransformComponent>(Owner).Coordinates.Offset(_entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetCardinalDir()),
|
||||||
collisionMask: CollisionGroup.Impassable | CollisionGroup.VaultImpassable
|
collisionMask: CollisionGroup.Impassable | CollisionGroup.VaultImpassable
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
@@ -100,7 +102,7 @@ namespace Content.Server.Morgue.Components
|
|||||||
|
|
||||||
if (_tray == null)
|
if (_tray == null)
|
||||||
{
|
{
|
||||||
_tray = IoCManager.Resolve<IEntityManager>().SpawnEntity(_trayPrototypeId, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
_tray = _entMan.SpawnEntity(_trayPrototypeId, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||||
var trayComp = _tray.EnsureComponent<MorgueTrayComponent>();
|
var trayComp = _tray.EnsureComponent<MorgueTrayComponent>();
|
||||||
trayComp.Morgue = Owner;
|
trayComp.Morgue = Owner;
|
||||||
}
|
}
|
||||||
@@ -109,7 +111,7 @@ namespace Content.Server.Morgue.Components
|
|||||||
TrayContainer?.Remove(_tray);
|
TrayContainer?.Remove(_tray);
|
||||||
}
|
}
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_tray).Coordinates = new EntityCoordinates(Owner, 0, -1);
|
_entMan.GetComponent<TransformComponent>(_tray).Coordinates = new EntityCoordinates(Owner, 0, -1);
|
||||||
|
|
||||||
base.OpenStorage();
|
base.OpenStorage();
|
||||||
}
|
}
|
||||||
@@ -122,9 +124,9 @@ namespace Content.Server.Morgue.Components
|
|||||||
foreach (var entity in Contents.ContainedEntities)
|
foreach (var entity in Contents.ContainedEntities)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
if (!hasMob && IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity))
|
if (!hasMob && _entMan.HasComponent<SharedBodyComponent>(entity))
|
||||||
hasMob = true;
|
hasMob = true;
|
||||||
if (!hasSoul && IoCManager.Resolve<IEntityManager>().TryGetComponent<ActorComponent?>(entity, out var actor) && actor.PlayerSession != null)
|
if (!hasSoul && _entMan.TryGetComponent<ActorComponent?>(entity, out var actor) && actor.PlayerSession != null)
|
||||||
hasSoul = true;
|
hasSoul = true;
|
||||||
}
|
}
|
||||||
Appearance?.SetData(MorgueVisuals.HasContents, count > 0);
|
Appearance?.SetData(MorgueVisuals.HasContents, count > 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user