Got rid of some IEntities
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using Content.Shared.Buckle.Components;
|
using Content.Shared.Buckle.Components;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -14,7 +14,7 @@ namespace Content.Client.Buckle
|
|||||||
|
|
||||||
public override bool Buckled => _buckled;
|
public override bool Buckled => _buckled;
|
||||||
|
|
||||||
public override bool TryBuckle(IEntity? user, IEntity to)
|
public override bool TryBuckle(EntityUid user, EntityUid to)
|
||||||
{
|
{
|
||||||
// TODO: Prediction
|
// TODO: Prediction
|
||||||
return false;
|
return false;
|
||||||
@@ -30,8 +30,7 @@ namespace Content.Client.Buckle
|
|||||||
_buckled = buckle.Buckled;
|
_buckled = buckle.Buckled;
|
||||||
LastEntityBuckledTo = buckle.LastEntityBuckledTo;
|
LastEntityBuckledTo = buckle.LastEntityBuckledTo;
|
||||||
DontCollide = buckle.DontCollide;
|
DontCollide = buckle.DontCollide;
|
||||||
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(OwnerUid, out SpriteComponent? ownerSprite))
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? ownerSprite))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Client.CharacterAppearance.Systems
|
|||||||
{
|
{
|
||||||
foreach (var (part, _) in body.Parts)
|
foreach (var (part, _) in body.Parts)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(part.Owner, out SpriteComponent? partSprite))
|
if (EntityManager.TryGetComponent(part.OwnerUid, out SpriteComponent? partSprite))
|
||||||
{
|
{
|
||||||
partSprite!.Color = component.Appearance.SkinColor;
|
partSprite!.Color = component.Appearance.SkinColor;
|
||||||
}
|
}
|
||||||
@@ -107,13 +107,13 @@ namespace Content.Client.CharacterAppearance.Systems
|
|||||||
// Scaffolding until Body is moved to ECS.
|
// Scaffolding until Body is moved to ECS.
|
||||||
private void BodyPartAdded(HumanoidAppearanceBodyPartAddedEvent args)
|
private void BodyPartAdded(HumanoidAppearanceBodyPartAddedEvent args)
|
||||||
{
|
{
|
||||||
if(!EntityManager.TryGetEntity(args.Uid, out var owner)) return;
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out SpriteComponent? sprite))
|
if (!entityManager.TryGetComponent(args.Uid, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SpriteComponent>(args.Args.Part.Owner))
|
if (!entityManager.HasComponent<SpriteComponent>(args.Args.Part.OwnerUid))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -131,13 +131,12 @@ namespace Content.Client.CharacterAppearance.Systems
|
|||||||
|
|
||||||
private void BodyPartRemoved(HumanoidAppearanceBodyPartRemovedEvent args)
|
private void BodyPartRemoved(HumanoidAppearanceBodyPartRemovedEvent args)
|
||||||
{
|
{
|
||||||
if(!EntityManager.TryGetEntity(args.Uid, out var owner)) return;
|
if (!EntityManager.TryGetComponent(args.Uid, out SpriteComponent? sprite))
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out SpriteComponent? sprite))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SpriteComponent>(args.Args.Part.Owner))
|
if (!EntityManager.HasComponent<SpriteComponent>(args.Args.Part.OwnerUid))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Client.Ghost.UI;
|
using Content.Client.Ghost.UI;
|
||||||
using Content.Client.HUD;
|
using Content.Client.HUD;
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
@@ -36,7 +36,7 @@ namespace Content.Client.Ghost
|
|||||||
|
|
||||||
foreach (var ghost in EntityManager.GetAllComponents(typeof(GhostComponent), true))
|
foreach (var ghost in EntityManager.GetAllComponents(typeof(GhostComponent), true))
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(ghost.Owner, out SpriteComponent? sprite))
|
if (EntityManager.TryGetComponent(ghost.OwnerUid, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
sprite.Visible = value;
|
sprite.Visible = value;
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ namespace Content.Client.Ghost
|
|||||||
|
|
||||||
private void OnGhostInit(EntityUid uid, GhostComponent component, ComponentInit args)
|
private void OnGhostInit(EntityUid uid, GhostComponent component, ComponentInit args)
|
||||||
{
|
{
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
if (EntityManager.TryGetComponent(component.OwnerUid, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
sprite.Visible = GhostVisibility;
|
sprite.Visible = GhostVisibility;
|
||||||
}
|
}
|
||||||
@@ -101,10 +101,10 @@ namespace Content.Client.Ghost
|
|||||||
|
|
||||||
private void OnGhostWarpsResponse(GhostWarpsResponseEvent msg)
|
private void OnGhostWarpsResponse(GhostWarpsResponseEvent msg)
|
||||||
{
|
{
|
||||||
var entity = _playerManager.LocalPlayer?.ControlledEntity;
|
var entity = _playerManager.LocalPlayer?.ControlledEntity?.Uid;
|
||||||
|
|
||||||
if (entity == null ||
|
if (entity == null ||
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out GhostComponent? ghost))
|
!EntityManager.TryGetComponent(entity.Value, out GhostComponent? ghost))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using Content.Server.Alert;
|
using Content.Server.Alert;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
using Content.Server.Pulling;
|
using Content.Server.Pulling;
|
||||||
using Content.Server.Stunnable.Components;
|
|
||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Buckle.Components;
|
using Content.Shared.Buckle.Components;
|
||||||
using Content.Shared.Interaction.Helpers;
|
using Content.Shared.Interaction.Helpers;
|
||||||
using Content.Shared.MobState.Components;
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Pulling;
|
|
||||||
using Content.Shared.Pulling.Components;
|
using Content.Shared.Pulling.Components;
|
||||||
using Content.Shared.Standing;
|
using Content.Shared.Standing;
|
||||||
using Content.Shared.Stunnable;
|
using Content.Shared.Stunnable;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -22,10 +17,11 @@ using Robust.Shared.IoC;
|
|||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Players;
|
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace Content.Server.Buckle.Components
|
namespace Content.Server.Buckle.Components
|
||||||
{
|
{
|
||||||
@@ -36,6 +32,7 @@ namespace Content.Server.Buckle.Components
|
|||||||
[ComponentReference(typeof(SharedBuckleComponent))]
|
[ComponentReference(typeof(SharedBuckleComponent))]
|
||||||
public class BuckleComponent : SharedBuckleComponent
|
public class BuckleComponent : SharedBuckleComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
[ComponentDependency] public readonly AppearanceComponent? Appearance = null;
|
[ComponentDependency] public readonly AppearanceComponent? Appearance = null;
|
||||||
@@ -118,8 +115,8 @@ namespace Content.Server.Buckle.Components
|
|||||||
/// <param name="strap">The strap to reattach to.</param>
|
/// <param name="strap">The strap to reattach to.</param>
|
||||||
public void ReAttach(StrapComponent strap)
|
public void ReAttach(StrapComponent strap)
|
||||||
{
|
{
|
||||||
var ownTransform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner);
|
var ownTransform = _entityManager.GetComponent<TransformComponent>(OwnerUid);
|
||||||
var strapTransform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(strap.Owner);
|
var strapTransform = _entityManager.GetComponent<TransformComponent>(strap.OwnerUid);
|
||||||
|
|
||||||
ownTransform.AttachParent(strapTransform);
|
ownTransform.AttachParent(strapTransform);
|
||||||
ownTransform.LocalRotation = Angle.Zero;
|
ownTransform.LocalRotation = Angle.Zero;
|
||||||
@@ -129,40 +126,41 @@ namespace Content.Server.Buckle.Components
|
|||||||
case StrapPosition.None:
|
case StrapPosition.None:
|
||||||
break;
|
break;
|
||||||
case StrapPosition.Stand:
|
case StrapPosition.Stand:
|
||||||
EntitySystem.Get<StandingStateSystem>().Stand((EntityUid) Owner);
|
EntitySystem.Get<StandingStateSystem>().Stand(OwnerUid);
|
||||||
break;
|
break;
|
||||||
case StrapPosition.Down:
|
case StrapPosition.Down:
|
||||||
EntitySystem.Get<StandingStateSystem>().Down((EntityUid) Owner, false, false);
|
EntitySystem.Get<StandingStateSystem>().Down(OwnerUid, false, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ownTransform.LocalPosition = Vector2.Zero + BuckleOffset;
|
ownTransform.LocalPosition = Vector2.Zero + BuckleOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBuckle(IEntity? user, IEntity to, [NotNullWhen(true)] out StrapComponent? strap)
|
public bool CanBuckle(EntityUid user, EntityUid to, [NotNullWhen(true)] out StrapComponent? strap)
|
||||||
{
|
{
|
||||||
|
var popupSystem = EntitySystem.Get<SharedPopupSystem>();
|
||||||
strap = null;
|
strap = null;
|
||||||
|
|
||||||
if (user == null || user == to)
|
if (user == to)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||||
{
|
{
|
||||||
user.PopupMessage(Loc.GetString("buckle-component-cannot-do-that-message"));
|
popupSystem.PopupEntity(Loc.GetString("buckle-component-cannot-do-that-message"), user, Filter.Entities(user));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(to, out strap))
|
if (!_entityManager.TryGetComponent(to, out strap))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var component = strap;
|
var strapUid = strap.OwnerUid;
|
||||||
bool Ignored(IEntity entity) => entity == Owner || entity == user || entity == component.Owner;
|
bool Ignored(EntityUid entity) => entity == OwnerUid || entity == user || entity == strapUid;
|
||||||
|
|
||||||
if (!Owner.InRangeUnobstructed(strap, Range, predicate: Ignored, popup: true))
|
if (!OwnerUid.InRangeUnobstructed(strapUid, Range, predicate: Ignored, popup: true))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -178,31 +176,31 @@ namespace Content.Server.Buckle.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandsComponent>(user))
|
if (!_entityManager.HasComponent<HandsComponent>(user))
|
||||||
{
|
{
|
||||||
user.PopupMessage(Loc.GetString("buckle-component-no-hands-message "));
|
popupSystem.PopupEntity(Loc.GetString("buckle-component-no-hands-message"), user, Filter.Entities(user));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Buckled)
|
if (Buckled)
|
||||||
{
|
{
|
||||||
var message = Loc.GetString(Owner == user
|
var message = Loc.GetString(OwnerUid == user
|
||||||
? "buckle-component-already-buckled-message"
|
? "buckle-component-already-buckled-message"
|
||||||
: "buckle-component-other-already-buckled-message", ("owner", Owner));
|
: "buckle-component-other-already-buckled-message", ("owner", Owner));
|
||||||
Owner.PopupMessage(user, message);
|
popupSystem.PopupEntity(message, user, Filter.Entities(user));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(to).Parent;
|
var parent = _entityManager.GetComponent<TransformComponent>(to).Parent;
|
||||||
while (parent != null)
|
while (parent != null)
|
||||||
{
|
{
|
||||||
if (parent == IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user))
|
if (parent == _entityManager.GetComponent<TransformComponent>(user))
|
||||||
{
|
{
|
||||||
var message = Loc.GetString(Owner == user
|
var message = Loc.GetString(OwnerUid == user
|
||||||
? "buckle-component-cannot-buckle-message"
|
? "buckle-component-cannot-buckle-message"
|
||||||
: "buckle-component-other-cannot-buckle-message", ("owner", Owner));
|
: "buckle-component-other-cannot-buckle-message", ("owner", Owner));
|
||||||
Owner.PopupMessage(user, message);
|
popupSystem.PopupEntity(message, user, Filter.Entities(user));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -212,10 +210,10 @@ namespace Content.Server.Buckle.Components
|
|||||||
|
|
||||||
if (!strap.HasSpace(this))
|
if (!strap.HasSpace(this))
|
||||||
{
|
{
|
||||||
var message = Loc.GetString(Owner == user
|
var message = Loc.GetString(OwnerUid == user
|
||||||
? "buckle-component-cannot-fit-message"
|
? "buckle-component-cannot-fit-message"
|
||||||
: "buckle-component-other-cannot-fit-message", ("owner", Owner));
|
: "buckle-component-other-cannot-fit-message", ("owner", Owner));
|
||||||
Owner.PopupMessage(user, message);
|
popupSystem.PopupEntity(message, user, Filter.Entities(user));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -223,9 +221,10 @@ namespace Content.Server.Buckle.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool TryBuckle(IEntity? user, IEntity to)
|
public override bool TryBuckle(EntityUid user, EntityUid to)
|
||||||
{
|
{
|
||||||
if (user == null || !CanBuckle(user, to, out var strap))
|
var popupSystem = EntitySystem.Get<SharedPopupSystem>();
|
||||||
|
if (!CanBuckle(user, to, out var strap))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -234,10 +233,10 @@ namespace Content.Server.Buckle.Components
|
|||||||
|
|
||||||
if (!strap.TryAdd(this))
|
if (!strap.TryAdd(this))
|
||||||
{
|
{
|
||||||
var message = Loc.GetString(Owner == user
|
var message = Loc.GetString(OwnerUid == user
|
||||||
? "buckle-component-cannot-buckle-message"
|
? "buckle-component-cannot-buckle-message"
|
||||||
: "buckle-component-other-cannot-buckle-message", ("owner", Owner));
|
: "buckle-component-other-cannot-buckle-message", ("owner", Owner));
|
||||||
Owner.PopupMessage(user, message);
|
popupSystem.PopupEntity(message, user, Filter.Entities(user));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,16 +245,16 @@ namespace Content.Server.Buckle.Components
|
|||||||
ReAttach(strap);
|
ReAttach(strap);
|
||||||
|
|
||||||
BuckledTo = strap;
|
BuckledTo = strap;
|
||||||
LastEntityBuckledTo = BuckledTo.Owner;
|
LastEntityBuckledTo = BuckledTo.OwnerUid;
|
||||||
DontCollide = true;
|
DontCollide = true;
|
||||||
|
|
||||||
UpdateBuckleStatus();
|
UpdateBuckleStatus();
|
||||||
|
|
||||||
#pragma warning disable 618
|
#pragma warning disable 618
|
||||||
SendMessage(new BuckleMessage(Owner, to));
|
SendMessage(new BuckleMessage(OwnerUid, to));
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SharedPullableComponent? ownerPullable))
|
if (_entityManager.TryGetComponent(OwnerUid, out SharedPullableComponent? ownerPullable))
|
||||||
{
|
{
|
||||||
if (ownerPullable.Puller != null)
|
if (ownerPullable.Puller != null)
|
||||||
{
|
{
|
||||||
@@ -287,7 +286,7 @@ namespace Content.Server.Buckle.Components
|
|||||||
/// true if the owner was unbuckled, otherwise false even if the owner
|
/// true if the owner was unbuckled, otherwise false even if the owner
|
||||||
/// was previously already unbuckled.
|
/// was previously already unbuckled.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public bool TryUnbuckle(IEntity user, bool force = false)
|
public bool TryUnbuckle(EntityUid user, bool force = false)
|
||||||
{
|
{
|
||||||
if (BuckledTo == null)
|
if (BuckledTo == null)
|
||||||
{
|
{
|
||||||
@@ -305,11 +304,12 @@ namespace Content.Server.Buckle.Components
|
|||||||
|
|
||||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||||
{
|
{
|
||||||
user.PopupMessage(Loc.GetString("buckle-component-cannot-do-that-message"));
|
var popupSystem = EntitySystem.Get<SharedPopupSystem>();
|
||||||
|
popupSystem.PopupEntity(Loc.GetString("buckle-component-cannot-do-that-message"), user, Filter.Entities(user));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user.InRangeUnobstructed(oldBuckledTo, Range, popup: true))
|
if (!user.InRangeUnobstructed(oldBuckledTo.OwnerUid, Range, popup: true))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -317,25 +317,25 @@ namespace Content.Server.Buckle.Components
|
|||||||
|
|
||||||
BuckledTo = null;
|
BuckledTo = null;
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Parent == IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(oldBuckledTo.Owner))
|
if (_entityManager.GetComponent<TransformComponent>(OwnerUid).Parent == _entityManager.GetComponent<TransformComponent>(oldBuckledTo.OwnerUid))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).AttachParentToContainerOrGrid();
|
_entityManager.GetComponent<TransformComponent>(OwnerUid).AttachParentToContainerOrGrid();
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).WorldRotation = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(oldBuckledTo.Owner).WorldRotation;
|
_entityManager.GetComponent<TransformComponent>(OwnerUid).WorldRotation = _entityManager.GetComponent<TransformComponent>(oldBuckledTo.OwnerUid).WorldRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
Appearance?.SetData(BuckleVisuals.Buckled, false);
|
Appearance?.SetData(BuckleVisuals.Buckled, false);
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<KnockedDownComponent>(Owner)
|
if (IoCManager.Resolve<IEntityManager>().HasComponent<KnockedDownComponent>(OwnerUid)
|
||||||
|| (_mobState?.IsIncapacitated() ?? false))
|
|| (_mobState?.IsIncapacitated() ?? false))
|
||||||
{
|
{
|
||||||
EntitySystem.Get<StandingStateSystem>().Down((EntityUid) Owner);
|
EntitySystem.Get<StandingStateSystem>().Down(OwnerUid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EntitySystem.Get<StandingStateSystem>().Stand((EntityUid) Owner);
|
EntitySystem.Get<StandingStateSystem>().Stand(OwnerUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
_mobState?.CurrentState?.EnterState(Owner, IoCManager.Resolve<IEntityManager>());
|
_mobState?.CurrentState?.EnterState(OwnerUid, IoCManager.Resolve<IEntityManager>());
|
||||||
|
|
||||||
UpdateBuckleStatus();
|
UpdateBuckleStatus();
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ namespace Content.Server.Buckle.Components
|
|||||||
SoundSystem.Play(Filter.Pvs(Owner), oldBuckledTo.UnbuckleSound.GetSound(), Owner);
|
SoundSystem.Play(Filter.Pvs(Owner), oldBuckledTo.UnbuckleSound.GetSound(), Owner);
|
||||||
|
|
||||||
#pragma warning disable 618
|
#pragma warning disable 618
|
||||||
SendMessage(new UnbuckleMessage(Owner, oldBuckledTo.Owner));
|
SendMessage(new UnbuckleMessage(OwnerUid, oldBuckledTo.OwnerUid));
|
||||||
#pragma warning restore 618
|
#pragma warning restore 618
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -363,9 +363,9 @@ namespace Content.Server.Buckle.Components
|
|||||||
/// unbuckled afterwards.
|
/// unbuckled afterwards.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>true if the buckling status was changed, false otherwise.</returns>
|
/// <returns>true if the buckling status was changed, false otherwise.</returns>
|
||||||
public bool ToggleBuckle(IEntity user, IEntity to, bool force = false)
|
public bool ToggleBuckle(EntityUid user, EntityUid to, bool force = false)
|
||||||
{
|
{
|
||||||
if (BuckledTo?.Owner == to)
|
if (BuckledTo?.OwnerUid == to)
|
||||||
{
|
{
|
||||||
return TryUnbuckle(user, force);
|
return TryUnbuckle(user, force);
|
||||||
}
|
}
|
||||||
@@ -382,7 +382,7 @@ namespace Content.Server.Buckle.Components
|
|||||||
protected override void Shutdown()
|
protected override void Shutdown()
|
||||||
{
|
{
|
||||||
BuckledTo?.Remove(this);
|
BuckledTo?.Remove(this);
|
||||||
TryUnbuckle(Owner, true);
|
TryUnbuckle(OwnerUid, true);
|
||||||
|
|
||||||
_buckleTime = default;
|
_buckleTime = default;
|
||||||
UpdateBuckleStatus();
|
UpdateBuckleStatus();
|
||||||
@@ -395,7 +395,7 @@ namespace Content.Server.Buckle.Components
|
|||||||
int? drawDepth = null;
|
int? drawDepth = null;
|
||||||
|
|
||||||
if (BuckledTo != null &&
|
if (BuckledTo != null &&
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(BuckledTo.Owner).LocalRotation.GetCardinalDir() == Direction.North &&
|
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(BuckledTo.OwnerUid).LocalRotation.GetCardinalDir() == Direction.North &&
|
||||||
BuckledTo.SpriteComponent != null)
|
BuckledTo.SpriteComponent != null)
|
||||||
{
|
{
|
||||||
drawDepth = BuckledTo.SpriteComponent.DrawDepth - 1;
|
drawDepth = BuckledTo.SpriteComponent.DrawDepth - 1;
|
||||||
@@ -414,7 +414,7 @@ namespace Content.Server.Buckle.Components
|
|||||||
if (!IsOnStrapEntityThisFrame && DontCollide)
|
if (!IsOnStrapEntityThisFrame && DontCollide)
|
||||||
{
|
{
|
||||||
DontCollide = false;
|
DontCollide = false;
|
||||||
TryUnbuckle(Owner);
|
TryUnbuckle(OwnerUid);
|
||||||
Dirty();
|
Dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Content.Shared.Buckle.Components
|
|||||||
|
|
||||||
public bool DontCollide { get; set; }
|
public bool DontCollide { get; set; }
|
||||||
|
|
||||||
public abstract bool TryBuckle(IEntity? user, IEntity to);
|
public abstract bool TryBuckle(EntityUid user, EntityUid to);
|
||||||
|
|
||||||
bool IDraggable.CanDrop(CanDropEvent args)
|
bool IDraggable.CanDrop(CanDropEvent args)
|
||||||
{
|
{
|
||||||
@@ -80,7 +80,7 @@ namespace Content.Shared.Buckle.Components
|
|||||||
/// <param name="entity">The entity that had its buckling status changed</param>
|
/// <param name="entity">The entity that had its buckling status changed</param>
|
||||||
/// <param name="strap">The strap that the entity was buckled to or unbuckled from</param>
|
/// <param name="strap">The strap that the entity was buckled to or unbuckled from</param>
|
||||||
/// <param name="buckled">True if the entity was buckled, false otherwise</param>
|
/// <param name="buckled">True if the entity was buckled, false otherwise</param>
|
||||||
protected BuckleChangeMessage(IEntity entity, IEntity strap, bool buckled)
|
protected BuckleChangeMessage(EntityUid entity, EntityUid strap, bool buckled)
|
||||||
{
|
{
|
||||||
Entity = entity;
|
Entity = entity;
|
||||||
Strap = strap;
|
Strap = strap;
|
||||||
@@ -90,12 +90,12 @@ namespace Content.Shared.Buckle.Components
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The entity that had its buckling status changed
|
/// The entity that had its buckling status changed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity Entity { get; }
|
public EntityUid Entity { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The strap that the entity was buckled to or unbuckled from
|
/// The strap that the entity was buckled to or unbuckled from
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity Strap { get; }
|
public EntityUid Strap { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True if the entity was buckled, false otherwise.
|
/// True if the entity was buckled, false otherwise.
|
||||||
@@ -111,7 +111,7 @@ namespace Content.Shared.Buckle.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entity">The entity that had its buckling status changed</param>
|
/// <param name="entity">The entity that had its buckling status changed</param>
|
||||||
/// <param name="strap">The strap that the entity was buckled to or unbuckled from</param>
|
/// <param name="strap">The strap that the entity was buckled to or unbuckled from</param>
|
||||||
public BuckleMessage(IEntity entity, IEntity strap) : base(entity, strap, true)
|
public BuckleMessage(EntityUid entity, EntityUid strap) : base(entity, strap, true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ namespace Content.Shared.Buckle.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entity">The entity that had its buckling status changed</param>
|
/// <param name="entity">The entity that had its buckling status changed</param>
|
||||||
/// <param name="strap">The strap that the entity was buckled to or unbuckled from</param>
|
/// <param name="strap">The strap that the entity was buckled to or unbuckled from</param>
|
||||||
public UnbuckleMessage(IEntity entity, IEntity strap) : base(entity, strap, false)
|
public UnbuckleMessage(EntityUid entity, EntityUid strap) : base(entity, strap, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,19 +61,19 @@ namespace Content.Shared.DragDrop
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entity doing the drag and drop.
|
/// Entity doing the drag and drop.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity User { get; }
|
public EntityUid User { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entity that is being dragged.
|
/// Entity that is being dragged.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity Dragged { get; }
|
public EntityUid Dragged { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of <see cref="StartDragDropEvent"/>.
|
/// Creates a new instance of <see cref="StartDragDropEvent"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The entity doing the drag and drop.</param>
|
/// <param name="user">The entity doing the drag and drop.</param>
|
||||||
/// <param name="dragged">The entity that is being dragged and dropped.</param>
|
/// <param name="dragged">The entity that is being dragged and dropped.</param>
|
||||||
public StartDragDropEvent(IEntity user, IEntity dragged)
|
public StartDragDropEvent(EntityUid user, EntityUid dragged)
|
||||||
{
|
{
|
||||||
User = user;
|
User = user;
|
||||||
Dragged = dragged;
|
Dragged = dragged;
|
||||||
@@ -83,10 +83,10 @@ namespace Content.Shared.DragDrop
|
|||||||
public class CanDropEvent : StartDragDropEvent
|
public class CanDropEvent : StartDragDropEvent
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The entity that <see cref="StartDragDropEvent.Dragged"/>
|
/// The entity uid that <see cref="StartDragDropEvent.Dragged"/>
|
||||||
/// is being dropped onto.
|
/// is being dropped onto.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity Target { get; }
|
public EntityUid Target { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of <see cref="CanDropEvent"/>.
|
/// Creates a new instance of <see cref="CanDropEvent"/>.
|
||||||
@@ -94,7 +94,7 @@ namespace Content.Shared.DragDrop
|
|||||||
/// <param name="user">The entity doing the drag and drop.</param>
|
/// <param name="user">The entity doing the drag and drop.</param>
|
||||||
/// <param name="dragged">The entity that is being dragged and dropped.</param>
|
/// <param name="dragged">The entity that is being dragged and dropped.</param>
|
||||||
/// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param>
|
/// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param>
|
||||||
public CanDropEvent(IEntity user, IEntity dragged, IEntity target) : base(user, dragged)
|
public CanDropEvent(EntityUid user, EntityUid dragged, EntityUid target) : base(user, dragged)
|
||||||
{
|
{
|
||||||
Target = target;
|
Target = target;
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ namespace Content.Shared.DragDrop
|
|||||||
/// <param name="dropLocation">The location where <see cref="dropped"/> is being dropped.</param>
|
/// <param name="dropLocation">The location where <see cref="dropped"/> is being dropped.</param>
|
||||||
/// <param name="dragged">The entity that is being dragged and dropped.</param>
|
/// <param name="dragged">The entity that is being dragged and dropped.</param>
|
||||||
/// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param>
|
/// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param>
|
||||||
public DragDropEvent(IEntity user, EntityCoordinates dropLocation, IEntity dragged, IEntity target) : base(user, dragged, target)
|
public DragDropEvent(EntityUid user, EntityCoordinates dropLocation, EntityUid dragged, EntityUid target) : base(user, dragged, target)
|
||||||
{
|
{
|
||||||
DropLocation = dropLocation;
|
DropLocation = dropLocation;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Content.Shared.Interaction
|
|||||||
public const float InteractionRange = 2;
|
public const float InteractionRange = 2;
|
||||||
public const float InteractionRangeSquared = InteractionRange * InteractionRange;
|
public const float InteractionRangeSquared = InteractionRange * InteractionRange;
|
||||||
|
|
||||||
public delegate bool Ignored(IEntity entity);
|
public delegate bool Ignored(EntityUid entity);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Traces a ray from coords to otherCoords and returns the length
|
/// Traces a ray from coords to otherCoords and returns the length
|
||||||
@@ -94,7 +94,7 @@ namespace Content.Shared.Interaction
|
|||||||
{
|
{
|
||||||
var predicate = ignoredEnt == null
|
var predicate = ignoredEnt == null
|
||||||
? null
|
? null
|
||||||
: (Ignored) (e => e == ignoredEnt);
|
: (Ignored) (e => e == ignoredEnt?.Uid);
|
||||||
|
|
||||||
return UnobstructedDistance(origin, other, collisionMask, predicate);
|
return UnobstructedDistance(origin, other, collisionMask, predicate);
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ namespace Content.Shared.Interaction
|
|||||||
bool ignoreInsideBlocker = false,
|
bool ignoreInsideBlocker = false,
|
||||||
bool popup = false)
|
bool popup = false)
|
||||||
{
|
{
|
||||||
predicate ??= e => e == origin || e == other;
|
predicate ??= e => e == origin.Uid || e == other.Uid;
|
||||||
return InRangeUnobstructed(origin, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
return InRangeUnobstructed(origin, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ namespace Content.Shared.Interaction
|
|||||||
bool popup = false)
|
bool popup = false)
|
||||||
{
|
{
|
||||||
var originPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).MapPosition;
|
var originPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).MapPosition;
|
||||||
predicate ??= e => e == origin;
|
predicate ??= e => e == origin.Uid;
|
||||||
|
|
||||||
var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, predicate, ignoreInsideBlocker);
|
var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, predicate, ignoreInsideBlocker);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user