Roller Skates fixes (#21542)

This commit is contained in:
brainfood1183
2023-11-09 01:43:27 +00:00
committed by GitHub
parent be8e5b7a8d
commit 8be97a20c5
8 changed files with 187 additions and 54 deletions

View File

@@ -1,38 +0,0 @@
using Content.Shared.Clothing;
using Content.Shared.Inventory.Events;
using Content.Shared.Movement.Systems;
using Content.Server.Damage.Systems;
namespace Content.Server.Clothing;
public sealed class SkatesSystem : EntitySystem
{
[Dependency] private readonly MovementSpeedModifierSystem _move = default!;
[Dependency] private readonly DamageOnHighSpeedImpactSystem _impact = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SkatesComponent, GotEquippedEvent>(OnGotEquipped);
SubscribeLocalEvent<SkatesComponent, GotUnequippedEvent>(OnGotUnequipped);
}
public void OnGotUnequipped(EntityUid uid, SkatesComponent component, GotUnequippedEvent args)
{
if (args.Slot == "shoes")
{
_move.ChangeFriction(args.Equipee, 20f, null, 20f);
_impact.ChangeCollide(args.Equipee, 20f, 1f, 2f);
}
}
private void OnGotEquipped(EntityUid uid, SkatesComponent component, GotEquippedEvent args)
{
if (args.Slot == "shoes")
{
_move.ChangeFriction(args.Equipee, 5f, 5f, 20f);
_impact.ChangeCollide(args.Equipee, 4f, 1f, 2f);
}
}
}