Files
tbd-station-14/Content.Shared/Pulling/Components/SharedPullerComponent.cs
mirrorcult 62f6c8dd8e Wieldable/two-handed weapons (#4554)
* wielding kinda works

* rough out all the edges, wielding works nicely

* popups + loc

* increase damage & extra damage against whitelist

* small fixes

* forgot to actually do that

* reviews

* reviews + thing

* use resistances and not extradamageagainstwhitelist

* slashy

* make increasedamageonwield and melee hit events work with modifiersets

* Silly individual
2021-09-17 07:16:11 -07:00

51 lines
1.3 KiB
C#

using Content.Shared.Movement.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;
using Component = Robust.Shared.GameObjects.Component;
namespace Content.Shared.Pulling.Components
{
[RegisterComponent]
public class SharedPullerComponent : Component, IMoveSpeedModifier
{
public override string Name => "Puller";
private IEntity? _pulling;
public float WalkSpeedModifier => _pulling == null ? 1.0f : 0.75f;
public float SprintSpeedModifier => _pulling == null ? 1.0f : 0.75f;
[ViewVariables]
public IEntity? Pulling
{
get => _pulling;
set
{
if (_pulling == value)
{
return;
}
_pulling = value;
if (Owner.TryGetComponent(out MovementSpeedModifierComponent? speed))
{
speed.RefreshMovementSpeedModifiers();
}
}
}
protected override void OnRemove()
{
if (Pulling != null &&
Pulling.TryGetComponent(out SharedPullableComponent? pullable))
{
pullable.TryStopPull();
}
base.OnRemove();
}
}
}