Roller Skates (#20257)

* adds roller skates

* removed hascomp and changed addcomp to ensurecomp, modified to _random, _stun

* remove icon from type: sprite

* sorted dependencies

* skates no longer added skater component to user, movmeentspeedmodifier and damagehighspeedimpact had access removed.

* fixes

* fixes
This commit is contained in:
brainfood1183
2023-11-06 02:42:37 +00:00
committed by GitHub
parent 4cacb7b9e3
commit 40b36d1dc5
14 changed files with 118 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
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);
}
}
}