From: brainfood1183 <113240905+brainfood1183@users.noreply.github.com> Date: Thu, 9 Nov 2023 01:43:27 +0000 (+0000) Subject: Roller Skates fixes (#21542) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=8be97a20c5cc12151eb899947ddedc3316fdfbc9;p=space-station-14.git Roller Skates fixes (#21542) --- diff --git a/Content.Server/Clothing/Systems/SkatesSystem.cs b/Content.Server/Clothing/Systems/SkatesSystem.cs deleted file mode 100644 index 18ae609ee0..0000000000 --- a/Content.Server/Clothing/Systems/SkatesSystem.cs +++ /dev/null @@ -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(OnGotEquipped); - SubscribeLocalEvent(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); - } - } -} diff --git a/Content.Shared/Clothing/Components/SkatesComponent.cs b/Content.Shared/Clothing/Components/SkatesComponent.cs index dcfe966473..d6d9375684 100644 --- a/Content.Shared/Clothing/Components/SkatesComponent.cs +++ b/Content.Shared/Clothing/Components/SkatesComponent.cs @@ -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 { + /// + /// the levels of friction the wearer is subected to, higher the number the more friction. + /// + [ViewVariables(VVAccess.ReadWrite)] + public float Friction = 5; + + /// + /// Determines the turning ability of the wearer, Higher the number the less control of their turning ability. + /// + [ViewVariables(VVAccess.ReadWrite)] + public float? FrictionNoInput = 5f; + + /// + /// Sets the speed in which the wearer accelerates to full speed, higher the number the quicker the acceleration. + /// + [ViewVariables(VVAccess.ReadWrite)] + public float Acceleration = 10f; + + /// + /// The minimum speed the wearer needs to be traveling to take damage from collision. + /// + [ViewVariables(VVAccess.ReadWrite)] + public float MinimumSpeed = 4f; + + /// + /// The length of time the wearer is stunned for on collision. + /// + [ViewVariables(VVAccess.ReadWrite)] + public float StunSeconds = 1f; + + /// + /// The time duration before another collision can take place. + /// + [ViewVariables(VVAccess.ReadWrite)] + public float DamageCooldown = 2f; + + /// + /// The damage per increment of speed on collision. + /// + [ViewVariables(VVAccess.ReadWrite)] + public float SpeedDamage = 0.5f; + + /// + /// Defaults for MinimumSpeed, StunSeconds, DamageCooldown and SpeedDamage. + /// + [ViewVariables] + public float DefaultMinimumSpeed = 20f; + + [ViewVariables] + public float DefaultStunSeconds = 1f; + + [ViewVariables] + public float DefaultDamageCooldown = 2f; + + [ViewVariables] + public float DefaultSpeedDamage = 0.5f; } diff --git a/Content.Shared/Clothing/EntitySystems/SkatesSystem.cs b/Content.Shared/Clothing/EntitySystems/SkatesSystem.cs new file mode 100644 index 0000000000..7d748a67a4 --- /dev/null +++ b/Content.Shared/Clothing/EntitySystems/SkatesSystem.cs @@ -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; + +/// +/// Changes the friction and acceleration of the wearer and also the damage on impact variables of thew wearer when hitting a static object. +/// +public sealed class SkatesSystem : EntitySystem +{ + [Dependency] private readonly MovementSpeedModifierSystem _move = default!; + [Dependency] private readonly DamageOnHighSpeedImpactSystem _impact = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnGotEquipped); + SubscribeLocalEvent(OnGotUnequipped); + } + + /// + /// When item is unequipped from the shoe slot, friction, aceleration and collide on impact return to default settings. + /// + 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); + } + } + + /// + /// When item is equipped into the shoe slot, friction, acceleration and collide on impact are adjusted. + /// + 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); + } + } +} diff --git a/Content.Server/Damage/Components/DamageOnHighSpeedImpactComponent.cs b/Content.Shared/Damage/Components/DamageOnHighSpeedImpactComponent.cs similarity index 92% rename from Content.Server/Damage/Components/DamageOnHighSpeedImpactComponent.cs rename to Content.Shared/Damage/Components/DamageOnHighSpeedImpactComponent.cs index 243cc70c1a..3eef1d70a4 100644 --- a/Content.Server/Damage/Components/DamageOnHighSpeedImpactComponent.cs +++ b/Content.Shared/Damage/Components/DamageOnHighSpeedImpactComponent.cs @@ -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; /// /// Should the entity take damage / be stunned if colliding at a speed above MinimumSpeed? diff --git a/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs b/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs similarity index 86% rename from Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs rename to Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs index c3fd00b325..f099a33759 100644 --- a/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs +++ b/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs @@ -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() { 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); } } diff --git a/Resources/Audio/Items/Toys/attributions.yml b/Resources/Audio/Items/Toys/attributions.yml new file mode 100644 index 0000000000..4f9b558614 --- /dev/null +++ b/Resources/Audio/Items/Toys/attributions.yml @@ -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" diff --git a/Resources/Audio/Items/Toys/licensing.txt b/Resources/Audio/Items/Toys/licensing.txt deleted file mode 100644 index 8e0965a91a..0000000000 --- a/Resources/Audio/Items/Toys/licensing.txt +++ /dev/null @@ -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). diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml index ea8e3b17f1..b6f0cc7a92 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml @@ -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: