Roller Skates fixes (#21542)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,67 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Content.Shared.Clothing.EntitySystems;
|
||||
|
||||
namespace Content.Shared.Clothing;
|
||||
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
[Access(typeof(SkatesSystem))]
|
||||
public sealed partial class SkatesComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// the levels of friction the wearer is subected to, higher the number the more friction.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float Friction = 5;
|
||||
|
||||
/// <summary>
|
||||
/// Determines the turning ability of the wearer, Higher the number the less control of their turning ability.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float? FrictionNoInput = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the speed in which the wearer accelerates to full speed, higher the number the quicker the acceleration.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float Acceleration = 10f;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum speed the wearer needs to be traveling to take damage from collision.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float MinimumSpeed = 4f;
|
||||
|
||||
/// <summary>
|
||||
/// The length of time the wearer is stunned for on collision.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float StunSeconds = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// The time duration before another collision can take place.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float DamageCooldown = 2f;
|
||||
|
||||
/// <summary>
|
||||
/// The damage per increment of speed on collision.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float SpeedDamage = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// Defaults for MinimumSpeed, StunSeconds, DamageCooldown and SpeedDamage.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public float DefaultMinimumSpeed = 20f;
|
||||
|
||||
[ViewVariables]
|
||||
public float DefaultStunSeconds = 1f;
|
||||
|
||||
[ViewVariables]
|
||||
public float DefaultDamageCooldown = 2f;
|
||||
|
||||
[ViewVariables]
|
||||
public float DefaultSpeedDamage = 0.5f;
|
||||
}
|
||||
|
||||
50
Content.Shared/Clothing/EntitySystems/SkatesSystem.cs
Normal file
50
Content.Shared/Clothing/EntitySystems/SkatesSystem.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Damage.Systems;
|
||||
using Content.Shared.Movement.Components;
|
||||
|
||||
namespace Content.Shared.Clothing;
|
||||
|
||||
/// <summary>
|
||||
/// Changes the friction and acceleration of the wearer and also the damage on impact variables of thew wearer when hitting a static object.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When item is unequipped from the shoe slot, friction, aceleration and collide on impact return to default settings.
|
||||
/// </summary>
|
||||
public void OnGotUnequipped(EntityUid uid, SkatesComponent component, GotUnequippedEvent args)
|
||||
{
|
||||
if (!TryComp(args.Equipee, out MovementSpeedModifierComponent? speedModifier))
|
||||
return;
|
||||
|
||||
if (args.Slot == "shoes")
|
||||
{
|
||||
_move.ChangeFriction(args.Equipee, MovementSpeedModifierComponent.DefaultFriction, MovementSpeedModifierComponent.DefaultFrictionNoInput, MovementSpeedModifierComponent.DefaultAcceleration, speedModifier);
|
||||
_impact.ChangeCollide(args.Equipee, component.DefaultMinimumSpeed, component.DefaultStunSeconds, component.DefaultDamageCooldown, component.DefaultSpeedDamage);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When item is equipped into the shoe slot, friction, acceleration and collide on impact are adjusted.
|
||||
/// </summary>
|
||||
private void OnGotEquipped(EntityUid uid, SkatesComponent component, GotEquippedEvent args)
|
||||
{
|
||||
if (args.Slot == "shoes")
|
||||
{
|
||||
_move.ChangeFriction(args.Equipee, component.Friction, component.FrictionNoInput, component.Acceleration);
|
||||
_impact.ChangeCollide(args.Equipee, component.MinimumSpeed, component.StunSeconds, component.DamageCooldown, component.SpeedDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using Content.Server.Damage.Systems;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Systems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Server.Damage.Components;
|
||||
namespace Content.Shared.Damage.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Should the entity take damage / be stunned if colliding at a speed above MinimumSpeed?
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Server.Damage.Components;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Effects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Physics.Events;
|
||||
@@ -8,7 +7,7 @@ using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.Damage.Systems;
|
||||
namespace Content.Shared.Damage.Systems;
|
||||
|
||||
public sealed class DamageOnHighSpeedImpactSystem : EntitySystem
|
||||
{
|
||||
@@ -17,7 +16,7 @@ public sealed class DamageOnHighSpeedImpactSystem : EntitySystem
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedColorFlashEffectSystem _color = default!;
|
||||
[Dependency] private readonly StunSystem _stun = default!;
|
||||
[Dependency] private readonly SharedStunSystem _stun = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -54,7 +53,7 @@ public sealed class DamageOnHighSpeedImpactSystem : EntitySystem
|
||||
_color.RaiseEffect(Color.Red, new List<EntityUid>() { uid }, Filter.Pvs(uid, entityManager: EntityManager));
|
||||
}
|
||||
|
||||
public void ChangeCollide(EntityUid uid, float minimumSpeed, float stunSeconds, float damageCooldown, DamageOnHighSpeedImpactComponent? collide = null)
|
||||
public void ChangeCollide(EntityUid uid, float minimumSpeed, float stunSeconds, float damageCooldown, float speedDamage, DamageOnHighSpeedImpactComponent? collide = null)
|
||||
{
|
||||
if (!Resolve(uid, ref collide, false))
|
||||
return;
|
||||
@@ -62,6 +61,7 @@ public sealed class DamageOnHighSpeedImpactSystem : EntitySystem
|
||||
collide.MinimumSpeed = minimumSpeed;
|
||||
collide.StunSeconds = stunSeconds;
|
||||
collide.DamageCooldown = damageCooldown;
|
||||
collide.SpeedDamageFactor = speedDamage;
|
||||
Dirty(uid, collide);
|
||||
}
|
||||
}
|
||||
69
Resources/Audio/Items/Toys/attributions.yml
Normal file
69
Resources/Audio/Items/Toys/attributions.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
- files: ["beep.ogg"]
|
||||
license: "CC0-1.0"
|
||||
copyright: "Created by Pól, converted to OGG and Mono by EmoGarbage"
|
||||
source: "https://freesound.org/people/P%C3%B3l/sounds/385927/"
|
||||
|
||||
- files: ["locator_beep.ogg"]
|
||||
license: "CC0-1.0"
|
||||
copyright: "Created by MATRIXXX_, converted to OGG, shortened, sped up, and pitched up by EmoGarbage404 (github)"
|
||||
source: "https://freesound.org/people/MATRIXXX_/sounds/657947/"
|
||||
|
||||
- files: ["trayhit1.ogg"]
|
||||
license: "CC-BY-SA-3.0"
|
||||
copyright: "Time immemorial"
|
||||
source: "https://github.com/tgstation/tgstation/blob/172b533d0257fcc1f8a05406f1c9fad514c14d88/sound/items/trayhit1.ogg"
|
||||
|
||||
- files: ["trayhit2.ogg"]
|
||||
license: "CC-BY-SA-3.0"
|
||||
copyright: "Time immemorial"
|
||||
source: "https://github.com/tgstation/tgstation/blob/172b533d0257fcc1f8a05406f1c9fad514c14d88/sound/items/trayhit2.ogg"
|
||||
|
||||
- files: ["rped.ogg"]
|
||||
license: "CC-BY-SA-3.0"
|
||||
copyright: "Created by Cuboos"
|
||||
source: "https://github.com/tgstation/tgstation/blob/172b533d0257fcc1f8a05406f1c9fad514c14d88/sound/items/rped.ogg"
|
||||
|
||||
- files: ["scary_horn.ogg"]
|
||||
license: "CC-BY-SA-3.0"
|
||||
copyright: "Made by theOperand (github) for tgstation, modified by brainfood1183 (github) for ss14"
|
||||
source: "https://github.com/tgstation/tgstation/blob/9a378933d2cfcb2c6692f5c60fbce979ac4e47c5/sound/spookoween/scary_horn.ogg"
|
||||
|
||||
- files: ["airhorn.ogg"]
|
||||
license: "CC-BY-SA-3.0"
|
||||
copyright: "Taken from tgstation, modified by brainfood1183 (github) for ss14"
|
||||
source: "https://github.com/tgstation/tgstation/blob/529d97cb1c105bcd548e95a9c9070bbf5253dd81/sound/items/AirHorn.ogg"
|
||||
|
||||
- files: ["desk_bell_ring.ogg"]
|
||||
license: "CC-BY-SA-3.0"
|
||||
copyright: "Created by SamKolber, shortened and converted to OGG and mono"
|
||||
source: "https://freesound.org/people/SamKolber/sounds/210022/"
|
||||
|
||||
- files: ["sitcom_laugh.ogg"]
|
||||
license: "CC0-1.0"
|
||||
copyright: "Created by Kinoton, clipped by github Henri215, turned into mono by github lapatison"
|
||||
source: "https://freesound.org/people/Kinoton/sounds/371562/"
|
||||
|
||||
- files: ["sitcom_laugh2.ogg"]
|
||||
license: "CC0-1.0"
|
||||
copyright: "Created by mrrap4food. clipped by Henri215"
|
||||
source: "https://freesound.org/people/mrrap4food/sounds/618972/"
|
||||
|
||||
- files: ["skates"]
|
||||
license: "CC-BY-4.0"
|
||||
copyright: "Created by PeteBarry, shortened by brainfood1183 (github)"
|
||||
source: "https://freesound.org/people/PeteBarry/sounds/464857/"
|
||||
|
||||
- files: ["weh.ogg", "muffled_weh.ogg"]
|
||||
license: "CC0-1.0"
|
||||
copyright: "Created by BlackMajor (github) for ss14, muffled_weh.ogg modified from weh.ogg by Slorkito (ss14 discord)"
|
||||
source: "https://github.com/space-wizards/space-station-14/blob/master/Resources/Audio/Items/Toys/weh.ogg"
|
||||
|
||||
- files: ["skub.ogg", "skub3.ogg"]
|
||||
license: "CC0-1.0"
|
||||
copyright: "Created by BlackMajor (github) for ss14"
|
||||
source: "https://github.com/space-wizards/space-station-14/blob/master/Resources/Audio/Items/Toys/skub.ogg"
|
||||
|
||||
- files: ["skub2.ogg"]
|
||||
license: "CC0-1.0"
|
||||
copyright: "Created by unusualcrow for ss14"
|
||||
source: "https://github.com/space-wizards/space-station-14/blob/master/Resources/Audio/Items/Toys/skub2.ogg"
|
||||
@@ -1,5 +0,0 @@
|
||||
"weh" and "muffled_weh" are licensed under CC0.
|
||||
"skub" is licensed under CC0.
|
||||
"sitcom_laugh" taken from Kinoton at https://freesound.org/people/Kinoton/sounds/371562/ under CC0 1.0, clipped by github Henri215, turned into mono by github lapatison
|
||||
"sitcom_laugh2" taken from mrrap4food at https://freesound.org/people/mrrap4food/sounds/618972/ under CC0 1.0, clipped by Henri215
|
||||
"skates" taken from PeteBarry at https://freesound.org/people/PeteBarry/sounds/464857/ under CC BY 4.0, shortened by Brainfood1183 (github).
|
||||
@@ -204,8 +204,8 @@
|
||||
- type: Item
|
||||
sprite: Clothing/Shoes/Specific/skates.rsi
|
||||
- type: ClothingSpeedModifier
|
||||
walkModifier: 1.3
|
||||
sprintModifier: 1.3
|
||||
walkModifier: 1.2
|
||||
sprintModifier: 1.2
|
||||
- type: Skates
|
||||
- type: FootstepModifier
|
||||
footstepSoundCollection:
|
||||
|
||||
Reference in New Issue
Block a user