Pulling fasto (#17696)
* faster pulling + pulling gravity tweaks * merciful
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Gravity;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Physics.Pull;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -22,7 +20,6 @@ namespace Content.Shared.Pulling
|
||||
public abstract partial class SharedPullingSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedPullingStateManagementSystem _pullSm = default!;
|
||||
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
||||
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
|
||||
[Dependency] private readonly SharedJointSystem _joints = default!;
|
||||
|
||||
@@ -102,18 +99,22 @@ namespace Content.Shared.Pulling
|
||||
//TODO VERB ICONS add pulling icon
|
||||
if (component.Puller == args.User)
|
||||
{
|
||||
Verb verb = new();
|
||||
verb.Text = Loc.GetString("pulling-verb-get-data-text-stop-pulling");
|
||||
verb.Act = () => TryStopPull(component, args.User);
|
||||
verb.DoContactInteraction = false; // pulling handle its own contact interaction.
|
||||
Verb verb = new()
|
||||
{
|
||||
Text = Loc.GetString("pulling-verb-get-data-text-stop-pulling"),
|
||||
Act = () => TryStopPull(component, args.User),
|
||||
DoContactInteraction = false // pulling handle its own contact interaction.
|
||||
};
|
||||
args.Verbs.Add(verb);
|
||||
}
|
||||
else if (CanPull(args.User, args.Target))
|
||||
{
|
||||
Verb verb = new();
|
||||
verb.Text = Loc.GetString("pulling-verb-get-data-text");
|
||||
verb.Act = () => TryStartPull(args.User, args.Target);
|
||||
verb.DoContactInteraction = false; // pulling handle its own contact interaction.
|
||||
Verb verb = new()
|
||||
{
|
||||
Text = Loc.GetString("pulling-verb-get-data-text"),
|
||||
Act = () => TryStartPull(args.User, args.Target),
|
||||
DoContactInteraction = false // pulling handle its own contact interaction.
|
||||
};
|
||||
args.Verbs.Add(verb);
|
||||
}
|
||||
}
|
||||
@@ -124,7 +125,7 @@ namespace Content.Shared.Pulling
|
||||
if (args.Pulled.Owner != uid)
|
||||
return;
|
||||
|
||||
_alertsSystem.ShowAlert(component.Owner, AlertType.Pulled);
|
||||
_alertsSystem.ShowAlert(uid, AlertType.Pulled);
|
||||
}
|
||||
|
||||
private void PullableHandlePullStopped(EntityUid uid, SharedPullableComponent component, PullStoppedMessage args)
|
||||
@@ -132,7 +133,7 @@ namespace Content.Shared.Pulling
|
||||
if (args.Pulled.Owner != uid)
|
||||
return;
|
||||
|
||||
_alertsSystem.ClearAlert(component.Owner, AlertType.Pulled);
|
||||
_alertsSystem.ClearAlert(uid, AlertType.Pulled);
|
||||
}
|
||||
|
||||
public bool IsPulled(EntityUid uid, SharedPullableComponent? component = null)
|
||||
@@ -178,19 +179,17 @@ namespace Content.Shared.Pulling
|
||||
// TODO: When Joint networking is less shitcodey fix this to use a dedicated joints message.
|
||||
private void HandleContainerInsert(EntInsertedIntoContainerMessage message)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(message.Entity, out SharedPullableComponent? pullable))
|
||||
if (TryComp(message.Entity, out SharedPullableComponent? pullable))
|
||||
{
|
||||
TryStopPull(pullable);
|
||||
}
|
||||
|
||||
if (EntityManager.TryGetComponent(message.Entity, out SharedPullerComponent? puller))
|
||||
if (TryComp(message.Entity, out SharedPullerComponent? puller))
|
||||
{
|
||||
if (puller.Pulling == null) return;
|
||||
|
||||
if (!EntityManager.TryGetComponent(puller.Pulling.Value, out SharedPullableComponent? pulling))
|
||||
{
|
||||
if (!TryComp(puller.Pulling.Value, out SharedPullableComponent? pulling))
|
||||
return;
|
||||
}
|
||||
|
||||
TryStopPull(pulling);
|
||||
}
|
||||
@@ -203,17 +202,12 @@ namespace Content.Shared.Pulling
|
||||
return false;
|
||||
|
||||
if (!TryGetPulled(player, out var pulled))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EntityManager.TryGetComponent(pulled.Value, out SharedPullableComponent? pullable))
|
||||
{
|
||||
if (!TryComp(pulled.Value, out SharedPullableComponent? pullable))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_containerSystem.IsEntityInContainer(player) ||
|
||||
_gravity.IsWeightless(player))
|
||||
if (_containerSystem.IsEntityInContainer(player))
|
||||
return false;
|
||||
|
||||
TryMoveTo(pullable, coords);
|
||||
|
||||
Reference in New Issue
Block a user