Reset speed when buckling (#19846)
This commit is contained in:
@@ -29,7 +29,7 @@ internal sealed class BuckleSystem : SharedBuckleSystem
|
|||||||
component.LastEntityBuckledTo = EnsureEntity<BuckleComponent>(state.LastEntityBuckledTo, uid);
|
component.LastEntityBuckledTo = EnsureEntity<BuckleComponent>(state.LastEntityBuckledTo, uid);
|
||||||
component.DontCollide = state.DontCollide;
|
component.DontCollide = state.DontCollide;
|
||||||
|
|
||||||
ActionBlockerSystem.UpdateCanMove(uid);
|
ActionBlocker.UpdateCanMove(uid);
|
||||||
|
|
||||||
if (!TryComp<SpriteComponent>(uid, out var ownerSprite))
|
if (!TryComp<SpriteComponent>(uid, out var ownerSprite))
|
||||||
return;
|
return;
|
||||||
@@ -65,8 +65,8 @@ internal sealed class BuckleSystem : SharedBuckleSystem
|
|||||||
if (!TryComp<RotationVisualsComponent>(uid, out var rotVisuals))
|
if (!TryComp<RotationVisualsComponent>(uid, out var rotVisuals))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!AppearanceSystem.TryGetData<int>(uid, StrapVisuals.RotationAngle, out var angle, args.Component) ||
|
if (!Appearance.TryGetData<int>(uid, StrapVisuals.RotationAngle, out var angle, args.Component) ||
|
||||||
!AppearanceSystem.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var buckled, args.Component) ||
|
!Appearance.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var buckled, args.Component) ||
|
||||||
!buckled ||
|
!buckled ||
|
||||||
args.Sprite == null)
|
args.Sprite == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using Content.Shared.Throwing;
|
|||||||
using Content.Shared.Vehicle.Components;
|
using Content.Shared.Vehicle.Components;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var strapPosition = Transform(strapUid).Coordinates;
|
var strapPosition = Transform(strapUid).Coordinates;
|
||||||
if (ev.NewPosition.InRange(EntityManager, _transformSystem, strapPosition, strapComp.MaxBuckleDistance))
|
if (ev.NewPosition.InRange(EntityManager, _transform, strapPosition, strapComp.MaxBuckleDistance))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TryUnbuckle(uid, uid, true, component);
|
TryUnbuckle(uid, uid, true, component);
|
||||||
@@ -181,18 +182,18 @@ public abstract partial class SharedBuckleSystem
|
|||||||
/// <param name="strapComp"> strap component of the thing we are strapping to </param>
|
/// <param name="strapComp"> strap component of the thing we are strapping to </param>
|
||||||
private void UpdateBuckleStatus(EntityUid uid, BuckleComponent buckleComp, StrapComponent? strapComp = null)
|
private void UpdateBuckleStatus(EntityUid uid, BuckleComponent buckleComp, StrapComponent? strapComp = null)
|
||||||
{
|
{
|
||||||
AppearanceSystem.SetData(uid, StrapVisuals.State, buckleComp.Buckled);
|
Appearance.SetData(uid, StrapVisuals.State, buckleComp.Buckled);
|
||||||
if (buckleComp.BuckledTo != null)
|
if (buckleComp.BuckledTo != null)
|
||||||
{
|
{
|
||||||
if (!Resolve(buckleComp.BuckledTo.Value, ref strapComp))
|
if (!Resolve(buckleComp.BuckledTo.Value, ref strapComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var alertType = strapComp.BuckledAlertType;
|
var alertType = strapComp.BuckledAlertType;
|
||||||
_alertsSystem.ShowAlert(uid, alertType);
|
_alerts.ShowAlert(uid, alertType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_alertsSystem.ClearAlertCategory(uid, AlertCategory.Buckled);
|
_alerts.ClearAlertCategory(uid, AlertCategory.Buckled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +217,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
buckleComp.BuckleTime = _gameTiming.CurTime;
|
buckleComp.BuckleTime = _gameTiming.CurTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionBlockerSystem.UpdateCanMove(buckleUid);
|
ActionBlocker.UpdateCanMove(buckleUid);
|
||||||
UpdateBuckleStatus(buckleUid, buckleComp, strapComp);
|
UpdateBuckleStatus(buckleUid, buckleComp, strapComp);
|
||||||
Dirty(buckleComp);
|
Dirty(buckleComp);
|
||||||
}
|
}
|
||||||
@@ -252,24 +253,24 @@ public abstract partial class SharedBuckleSystem
|
|||||||
!strapComp.AllowedEntities.IsValid(userUid, EntityManager))
|
!strapComp.AllowedEntities.IsValid(userUid, EntityManager))
|
||||||
{
|
{
|
||||||
if (_netManager.IsServer)
|
if (_netManager.IsServer)
|
||||||
_popupSystem.PopupEntity(Loc.GetString("buckle-component-cannot-fit-message"), userUid, buckleUid, PopupType.Medium);
|
_popup.PopupEntity(Loc.GetString("buckle-component-cannot-fit-message"), userUid, buckleUid, PopupType.Medium);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is it within range
|
// Is it within range
|
||||||
bool Ignored(EntityUid entity) => entity == buckleUid || entity == userUid || entity == strapUid;
|
bool Ignored(EntityUid entity) => entity == buckleUid || entity == userUid || entity == strapUid;
|
||||||
|
|
||||||
if (!_interactionSystem.InRangeUnobstructed(buckleUid, strapUid, buckleComp.Range, predicate: Ignored,
|
if (!_interaction.InRangeUnobstructed(buckleUid, strapUid, buckleComp.Range, predicate: Ignored,
|
||||||
popup: true))
|
popup: true))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If in a container
|
// If in a container
|
||||||
if (_containerSystem.TryGetContainingContainer(buckleUid, out var ownerContainer))
|
if (_container.TryGetContainingContainer(buckleUid, out var ownerContainer))
|
||||||
{
|
{
|
||||||
// And not in the same container as the strap
|
// And not in the same container as the strap
|
||||||
if (!_containerSystem.TryGetContainingContainer(strapUid, out var strapContainer) ||
|
if (!_container.TryGetContainingContainer(strapUid, out var strapContainer) ||
|
||||||
ownerContainer != strapContainer)
|
ownerContainer != strapContainer)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -280,7 +281,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
{
|
{
|
||||||
// PopupPredicted when
|
// PopupPredicted when
|
||||||
if (_netManager.IsServer)
|
if (_netManager.IsServer)
|
||||||
_popupSystem.PopupEntity(Loc.GetString("buckle-component-no-hands-message"), userUid, userUid);
|
_popup.PopupEntity(Loc.GetString("buckle-component-no-hands-message"), userUid, userUid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,7 +292,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
: "buckle-component-other-already-buckled-message",
|
: "buckle-component-other-already-buckled-message",
|
||||||
("owner", Identity.Entity(buckleUid, EntityManager)));
|
("owner", Identity.Entity(buckleUid, EntityManager)));
|
||||||
if (_netManager.IsServer)
|
if (_netManager.IsServer)
|
||||||
_popupSystem.PopupEntity(message, userUid, userUid);
|
_popup.PopupEntity(message, userUid, userUid);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -305,7 +306,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
? "buckle-component-cannot-buckle-message"
|
? "buckle-component-cannot-buckle-message"
|
||||||
: "buckle-component-other-cannot-buckle-message", ("owner", Identity.Entity(buckleUid, EntityManager)));
|
: "buckle-component-other-cannot-buckle-message", ("owner", Identity.Entity(buckleUid, EntityManager)));
|
||||||
if (_netManager.IsServer)
|
if (_netManager.IsServer)
|
||||||
_popupSystem.PopupEntity(message, userUid, userUid);
|
_popup.PopupEntity(message, userUid, userUid);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -319,7 +320,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
? "buckle-component-cannot-fit-message"
|
? "buckle-component-cannot-fit-message"
|
||||||
: "buckle-component-other-cannot-fit-message", ("owner", Identity.Entity(buckleUid, EntityManager)));
|
: "buckle-component-other-cannot-fit-message", ("owner", Identity.Entity(buckleUid, EntityManager)));
|
||||||
if (_netManager.IsServer)
|
if (_netManager.IsServer)
|
||||||
_popupSystem.PopupEntity(message, userUid, userUid);
|
_popup.PopupEntity(message, userUid, userUid);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -345,59 +346,64 @@ public abstract partial class SharedBuckleSystem
|
|||||||
/// <param name="strapUid"> Uid of the owner of strap component </param>
|
/// <param name="strapUid"> Uid of the owner of strap component </param>
|
||||||
public bool TryBuckle(EntityUid buckleUid, EntityUid userUid, EntityUid strapUid, BuckleComponent? buckleComp = null)
|
public bool TryBuckle(EntityUid buckleUid, EntityUid userUid, EntityUid strapUid, BuckleComponent? buckleComp = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(buckleUid, ref buckleComp, false))
|
if (!Resolve(buckleUid, ref buckleComp, false))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!CanBuckle(buckleUid, userUid, strapUid, out var strapComp, buckleComp))
|
if (!CanBuckle(buckleUid, userUid, strapUid, out var strapComp, buckleComp))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!StrapTryAdd(strapUid, buckleUid, buckleComp, false, strapComp))
|
if (!StrapTryAdd(strapUid, buckleUid, buckleComp, false, strapComp))
|
||||||
{
|
{
|
||||||
var message = Loc.GetString(buckleUid == userUid
|
var message = Loc.GetString(buckleUid == userUid
|
||||||
? "buckle-component-cannot-buckle-message"
|
? "buckle-component-cannot-buckle-message"
|
||||||
: "buckle-component-other-cannot-buckle-message", ("owner", Identity.Entity(buckleUid, EntityManager)));
|
: "buckle-component-other-cannot-buckle-message", ("owner", Identity.Entity(buckleUid, EntityManager)));
|
||||||
if (_netManager.IsServer)
|
if (_netManager.IsServer)
|
||||||
_popupSystem.PopupEntity(message, userUid, userUid);
|
_popup.PopupEntity(message, userUid, userUid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TryComp<AppearanceComponent>(buckleUid, out var appearance))
|
if (TryComp<AppearanceComponent>(buckleUid, out var appearance))
|
||||||
AppearanceSystem.SetData(buckleUid, BuckleVisuals.Buckled, true, appearance);
|
Appearance.SetData(buckleUid, BuckleVisuals.Buckled, true, appearance);
|
||||||
|
|
||||||
ReAttach(buckleUid, strapUid, buckleComp, strapComp);
|
ReAttach(buckleUid, strapUid, buckleComp, strapComp);
|
||||||
SetBuckledTo(buckleUid,strapUid, strapComp, buckleComp);
|
SetBuckledTo(buckleUid, strapUid, strapComp, buckleComp);
|
||||||
// TODO user is currently set to null because if it isn't the sound fails to play in some situations, fix that
|
// TODO user is currently set to null because if it isn't the sound fails to play in some situations, fix that
|
||||||
var audioSourceUid = userUid == buckleUid ? userUid : strapUid;
|
var audioSourceUid = userUid == buckleUid ? userUid : strapUid;
|
||||||
_audioSystem.PlayPredicted(strapComp.BuckleSound, strapUid, audioSourceUid);
|
_audio.PlayPredicted(strapComp.BuckleSound, strapUid, audioSourceUid);
|
||||||
|
|
||||||
var ev = new BuckleChangeEvent(strapUid, buckleUid, true);
|
var ev = new BuckleChangeEvent(strapUid, buckleUid, true);
|
||||||
RaiseLocalEvent(ev.BuckledEntity, ref ev);
|
RaiseLocalEvent(ev.BuckledEntity, ref ev);
|
||||||
RaiseLocalEvent(ev.StrapEntity, ref ev);
|
RaiseLocalEvent(ev.StrapEntity, ref ev);
|
||||||
|
|
||||||
if (TryComp<SharedPullableComponent>(buckleUid, out var ownerPullable))
|
if (TryComp<SharedPullableComponent>(buckleUid, out var ownerPullable))
|
||||||
{
|
{
|
||||||
if (ownerPullable.Puller != null)
|
if (ownerPullable.Puller != null)
|
||||||
{
|
{
|
||||||
_pullingSystem.TryStopPull(ownerPullable);
|
_pulling.TryStopPull(ownerPullable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buckleComp.PullStrap && TryComp<SharedPullableComponent>(strapUid, out var toPullable))
|
if (TryComp<PhysicsComponent>(buckleUid, out var physics))
|
||||||
{
|
{
|
||||||
if (toPullable.Puller == buckleUid)
|
_physics.ResetDynamics(physics);
|
||||||
{
|
}
|
||||||
// can't pull it and buckle to it at the same time
|
|
||||||
_pullingSystem.TryStopPull(toPullable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logging
|
if (!buckleComp.PullStrap && TryComp<SharedPullableComponent>(strapUid, out var toPullable))
|
||||||
if (userUid != buckleUid)
|
{
|
||||||
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(userUid):player} buckled {ToPrettyString(buckleUid)} to {ToPrettyString(strapUid)}");
|
if (toPullable.Puller == buckleUid)
|
||||||
else
|
{
|
||||||
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(userUid):player} buckled themselves to {ToPrettyString(strapUid)}");
|
// can't pull it and buckle to it at the same time
|
||||||
|
_pulling.TryStopPull(toPullable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
// Logging
|
||||||
|
if (userUid != buckleUid)
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(userUid):player} buckled {ToPrettyString(buckleUid)} to {ToPrettyString(strapUid)}");
|
||||||
|
else
|
||||||
|
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(userUid):player} buckled themselves to {ToPrettyString(strapUid)}");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -431,7 +437,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
if (_gameTiming.CurTime < buckleComp.BuckleTime + buckleComp.UnbuckleDelay)
|
if (_gameTiming.CurTime < buckleComp.BuckleTime + buckleComp.UnbuckleDelay)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!_interactionSystem.InRangeUnobstructed(userUid, strapUid, buckleComp.Range, popup: true))
|
if (!_interaction.InRangeUnobstructed(userUid, strapUid, buckleComp.Range, popup: true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (HasComp<SleepingComponent>(buckleUid) && buckleUid == userUid)
|
if (HasComp<SleepingComponent>(buckleUid) && buckleUid == userUid)
|
||||||
@@ -459,32 +465,32 @@ public abstract partial class SharedBuckleSystem
|
|||||||
|
|
||||||
if (buckleXform.ParentUid == strapUid && !Terminating(buckleXform.ParentUid))
|
if (buckleXform.ParentUid == strapUid && !Terminating(buckleXform.ParentUid))
|
||||||
{
|
{
|
||||||
_containerSystem.AttachParentToContainerOrGrid(buckleXform);
|
_container.AttachParentToContainerOrGrid(buckleXform);
|
||||||
|
|
||||||
var oldBuckledToWorldRot = _transformSystem.GetWorldRotation(strapUid);
|
var oldBuckledToWorldRot = _transform.GetWorldRotation(strapUid);
|
||||||
_transformSystem.SetWorldRotation(buckleXform, oldBuckledToWorldRot);
|
_transform.SetWorldRotation(buckleXform, oldBuckledToWorldRot);
|
||||||
|
|
||||||
if (strapComp.UnbuckleOffset != Vector2.Zero)
|
if (strapComp.UnbuckleOffset != Vector2.Zero)
|
||||||
buckleXform.Coordinates = oldBuckledXform.Coordinates.Offset(strapComp.UnbuckleOffset);
|
buckleXform.Coordinates = oldBuckledXform.Coordinates.Offset(strapComp.UnbuckleOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TryComp(buckleUid, out AppearanceComponent? appearance))
|
if (TryComp(buckleUid, out AppearanceComponent? appearance))
|
||||||
AppearanceSystem.SetData(buckleUid, BuckleVisuals.Buckled, false, appearance);
|
Appearance.SetData(buckleUid, BuckleVisuals.Buckled, false, appearance);
|
||||||
|
|
||||||
if (TryComp<MobStateComponent>(buckleUid, out var mobState)
|
if (TryComp<MobStateComponent>(buckleUid, out var mobState)
|
||||||
&& _mobStateSystem.IsIncapacitated(buckleUid, mobState)
|
&& _mobState.IsIncapacitated(buckleUid, mobState)
|
||||||
|| HasComp<KnockedDownComponent>(buckleUid))
|
|| HasComp<KnockedDownComponent>(buckleUid))
|
||||||
{
|
{
|
||||||
_standingSystem.Down(buckleUid);
|
_standing.Down(buckleUid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_standingSystem.Stand(buckleUid);
|
_standing.Stand(buckleUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_mobStateSystem.IsIncapacitated(buckleUid, mobState))
|
if (_mobState.IsIncapacitated(buckleUid, mobState))
|
||||||
{
|
{
|
||||||
_standingSystem.Down(buckleUid);
|
_standing.Down(buckleUid);
|
||||||
}
|
}
|
||||||
if (strapComp.BuckledEntities.Remove(buckleUid))
|
if (strapComp.BuckledEntities.Remove(buckleUid))
|
||||||
{
|
{
|
||||||
@@ -494,9 +500,9 @@ public abstract partial class SharedBuckleSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
_joints.RefreshRelay(buckleUid);
|
_joints.RefreshRelay(buckleUid);
|
||||||
AppearanceSystem.SetData(strapUid, StrapVisuals.State, strapComp.BuckledEntities.Count != 0);
|
Appearance.SetData(strapUid, StrapVisuals.State, strapComp.BuckledEntities.Count != 0);
|
||||||
var audioSourceUid = userUid != buckleUid ? userUid : strapUid;
|
var audioSourceUid = userUid != buckleUid ? userUid : strapUid;
|
||||||
_audioSystem.PlayPredicted(strapComp.UnbuckleSound, strapUid, audioSourceUid);
|
_audio.PlayPredicted(strapComp.UnbuckleSound, strapUid, audioSourceUid);
|
||||||
|
|
||||||
var ev = new BuckleChangeEvent(strapUid, buckleUid, false);
|
var ev = new BuckleChangeEvent(strapUid, buckleUid, false);
|
||||||
RaiseLocalEvent(buckleUid, ref ev);
|
RaiseLocalEvent(buckleUid, ref ev);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
|
|
||||||
private void OnStrapStartup(EntityUid uid, StrapComponent component, ComponentStartup args)
|
private void OnStrapStartup(EntityUid uid, StrapComponent component, ComponentStartup args)
|
||||||
{
|
{
|
||||||
AppearanceSystem.SetData(uid, StrapVisuals.State, component.BuckledEntities.Count != 0);
|
Appearance.SetData(uid, StrapVisuals.State, component.BuckledEntities.Count != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStrapShutdown(EntityUid uid, StrapComponent component, ComponentShutdown args)
|
private void OnStrapShutdown(EntityUid uid, StrapComponent component, ComponentShutdown args)
|
||||||
@@ -90,8 +90,8 @@ public abstract partial class SharedBuckleSystem
|
|||||||
!Resolve(strapUid, ref strapComp, false))
|
!Resolve(strapUid, ref strapComp, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var contained = _containerSystem.TryGetContainingContainer(buckleUid, out var ownContainer);
|
var contained = _container.TryGetContainingContainer(buckleUid, out var ownContainer);
|
||||||
var strapContained = _containerSystem.TryGetContainingContainer(strapUid, out var strapContainer);
|
var strapContained = _container.TryGetContainingContainer(strapUid, out var strapContainer);
|
||||||
|
|
||||||
if (contained != strapContained || ownContainer != strapContainer)
|
if (contained != strapContained || ownContainer != strapContainer)
|
||||||
{
|
{
|
||||||
@@ -133,7 +133,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
{
|
{
|
||||||
var buckledComp = Comp<BuckleComponent>(entity);
|
var buckledComp = Comp<BuckleComponent>(entity);
|
||||||
|
|
||||||
if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target, range: buckledComp.Range))
|
if (!_interaction.InRangeUnobstructed(args.User, args.Target, range: buckledComp.Range))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var verb = new InteractionVerb()
|
var verb = new InteractionVerb()
|
||||||
@@ -158,7 +158,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
buckle.BuckledTo != uid &&
|
buckle.BuckledTo != uid &&
|
||||||
args.User != uid &&
|
args.User != uid &&
|
||||||
StrapHasSpace(uid, buckle, component) &&
|
StrapHasSpace(uid, buckle, component) &&
|
||||||
_interactionSystem.InRangeUnobstructed(args.User, args.Target, range: buckle.Range))
|
_interaction.InRangeUnobstructed(args.User, args.Target, range: buckle.Range))
|
||||||
{
|
{
|
||||||
InteractionVerb verb = new()
|
InteractionVerb verb = new()
|
||||||
{
|
{
|
||||||
@@ -173,11 +173,11 @@ public abstract partial class SharedBuckleSystem
|
|||||||
if (args.Using is {Valid: true} @using &&
|
if (args.Using is {Valid: true} @using &&
|
||||||
TryComp<BuckleComponent>(@using, out var usingBuckle) &&
|
TryComp<BuckleComponent>(@using, out var usingBuckle) &&
|
||||||
StrapHasSpace(uid, usingBuckle, component) &&
|
StrapHasSpace(uid, usingBuckle, component) &&
|
||||||
_interactionSystem.InRangeUnobstructed(@using, args.Target, range: usingBuckle.Range))
|
_interaction.InRangeUnobstructed(@using, args.Target, range: usingBuckle.Range))
|
||||||
{
|
{
|
||||||
// Check that the entity is unobstructed from the target (ignoring the user).
|
// Check that the entity is unobstructed from the target (ignoring the user).
|
||||||
bool Ignored(EntityUid entity) => entity == args.User || entity == args.Target || entity == @using;
|
bool Ignored(EntityUid entity) => entity == args.User || entity == args.Target || entity == @using;
|
||||||
if (!_interactionSystem.InRangeUnobstructed(@using, args.Target, usingBuckle.Range, predicate: Ignored))
|
if (!_interaction.InRangeUnobstructed(@using, args.Target, usingBuckle.Range, predicate: Ignored))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var isPlayer = _playerManager.TryGetSessionByEntity(@using, out var _);
|
var isPlayer = _playerManager.TryGetSessionByEntity(@using, out var _);
|
||||||
@@ -269,7 +269,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
|
|
||||||
bool Ignored(EntityUid entity) => entity == userUid || entity == buckleUid || entity == targetUid;
|
bool Ignored(EntityUid entity) => entity == userUid || entity == buckleUid || entity == targetUid;
|
||||||
|
|
||||||
return _interactionSystem.InRangeUnobstructed(targetUid, buckleUid, buckleComp.Range, predicate: Ignored);
|
return _interaction.InRangeUnobstructed(targetUid, buckleUid, buckleComp.Range, predicate: Ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -312,9 +312,9 @@ public abstract partial class SharedBuckleSystem
|
|||||||
|
|
||||||
strapComp.OccupiedSize += buckleComp.Size;
|
strapComp.OccupiedSize += buckleComp.Size;
|
||||||
|
|
||||||
AppearanceSystem.SetData(buckleUid, StrapVisuals.RotationAngle, strapComp.Rotation);
|
Appearance.SetData(buckleUid, StrapVisuals.RotationAngle, strapComp.Rotation);
|
||||||
|
|
||||||
AppearanceSystem.SetData(strapUid, StrapVisuals.State, true);
|
Appearance.SetData(strapUid, StrapVisuals.State, true);
|
||||||
|
|
||||||
Dirty(strapUid, strapComp);
|
Dirty(strapUid, strapComp);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -23,18 +23,20 @@ public abstract partial class SharedBuckleSystem : EntitySystem
|
|||||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
|
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
|
||||||
|
|
||||||
[Dependency] protected readonly ActionBlockerSystem ActionBlockerSystem = default!;
|
[Dependency] protected readonly ActionBlockerSystem ActionBlocker = default!;
|
||||||
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
|
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
||||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
|
||||||
[Dependency] protected readonly SharedAppearanceSystem AppearanceSystem = default!;
|
[Dependency] private readonly AlertsSystem _alerts = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
[Dependency] private readonly SharedJointSystem _joints = default!;
|
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
[Dependency] private readonly SharedJointSystem _joints = default!;
|
||||||
[Dependency] private readonly SharedPullingSystem _pullingSystem = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
[Dependency] private readonly SharedPullingSystem _pulling = default!;
|
||||||
[Dependency] private readonly StandingStateSystem _standingSystem = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
|
[Dependency] private readonly StandingStateSystem _standing = default!;
|
||||||
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -63,16 +65,16 @@ public abstract partial class SharedBuckleSystem : EntitySystem
|
|||||||
|| !Resolve(buckleUid, ref buckleComp, false))
|
|| !Resolve(buckleUid, ref buckleComp, false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var buckleTransform = Transform(buckleUid);
|
_transform.SetCoordinates(buckleUid, new EntityCoordinates(strapUid, strapComp.BuckleOffset));
|
||||||
|
|
||||||
buckleTransform.Coordinates = new EntityCoordinates(strapUid, strapComp.BuckleOffset);
|
var buckleTransform = Transform(buckleUid);
|
||||||
|
|
||||||
// Buckle subscribes to move for <reasons> so this might fail.
|
// Buckle subscribes to move for <reasons> so this might fail.
|
||||||
// TODO: Make buckle not do that.
|
// TODO: Make buckle not do that.
|
||||||
if (buckleTransform.ParentUid != strapUid)
|
if (buckleTransform.ParentUid != strapUid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_transformSystem.SetLocalRotation(buckleUid, Angle.Zero, buckleTransform);
|
_transform.SetLocalRotation(buckleUid, Angle.Zero, buckleTransform);
|
||||||
_joints.RefreshRelay(buckleUid, strapUid);
|
_joints.RefreshRelay(buckleUid, strapUid);
|
||||||
|
|
||||||
switch (strapComp.Position)
|
switch (strapComp.Position)
|
||||||
@@ -80,10 +82,10 @@ public abstract partial class SharedBuckleSystem : EntitySystem
|
|||||||
case StrapPosition.None:
|
case StrapPosition.None:
|
||||||
break;
|
break;
|
||||||
case StrapPosition.Stand:
|
case StrapPosition.Stand:
|
||||||
_standingSystem.Stand(buckleUid);
|
_standing.Stand(buckleUid);
|
||||||
break;
|
break;
|
||||||
case StrapPosition.Down:
|
case StrapPosition.Down:
|
||||||
_standingSystem.Down(buckleUid, false, false);
|
_standing.Down(buckleUid, false, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user