From: brainfood1183 <113240905+brainfood1183@users.noreply.github.com> Date: Mon, 6 Nov 2023 02:42:37 +0000 (+0000) Subject: Roller Skates (#20257) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=40b36d1dc52222629c7d089bbaf29d7fbac65241;p=space-station-14.git 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 --- diff --git a/Content.Server/Clothing/Systems/SkatesSystem.cs b/Content.Server/Clothing/Systems/SkatesSystem.cs new file mode 100644 index 0000000000..18ae609ee0 --- /dev/null +++ b/Content.Server/Clothing/Systems/SkatesSystem.cs @@ -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(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.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs b/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs index bcd1e0423a..c3fd00b325 100644 --- a/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs +++ b/Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs @@ -53,4 +53,15 @@ public sealed class DamageOnHighSpeedImpactSystem : EntitySystem _audio.PlayPvs(component.SoundHit, uid, AudioParams.Default.WithVariation(0.125f).WithVolume(-0.125f)); _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) + { + if (!Resolve(uid, ref collide, false)) + return; + + collide.MinimumSpeed = minimumSpeed; + collide.StunSeconds = stunSeconds; + collide.DamageCooldown = damageCooldown; + Dirty(uid, collide); + } } diff --git a/Content.Shared/Clothing/Components/SkatesComponent.cs b/Content.Shared/Clothing/Components/SkatesComponent.cs new file mode 100644 index 0000000000..dcfe966473 --- /dev/null +++ b/Content.Shared/Clothing/Components/SkatesComponent.cs @@ -0,0 +1,9 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Clothing; + +[RegisterComponent] +[NetworkedComponent] +public sealed partial class SkatesComponent : Component +{ +} diff --git a/Resources/Audio/Items/Toys/licensing.txt b/Resources/Audio/Items/Toys/licensing.txt index 8b68bfa553..8e0965a91a 100644 --- a/Resources/Audio/Items/Toys/licensing.txt +++ b/Resources/Audio/Items/Toys/licensing.txt @@ -2,3 +2,4 @@ "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/Audio/Items/Toys/skates.ogg b/Resources/Audio/Items/Toys/skates.ogg new file mode 100644 index 0000000000..9ae127404a Binary files /dev/null and b/Resources/Audio/Items/Toys/skates.ogg differ diff --git a/Resources/Prototypes/Catalog/Fills/Crates/fun.yml b/Resources/Prototypes/Catalog/Fills/Crates/fun.yml index 862423864e..4ca5f39c5c 100644 --- a/Resources/Prototypes/Catalog/Fills/Crates/fun.yml +++ b/Resources/Prototypes/Catalog/Fills/Crates/fun.yml @@ -270,6 +270,7 @@ - id: ClothingShoesClownLarge - id: ClothingHeadHatMagician - id: BeachBall + - id: ClothingShoesSkates - type: entity id: CrateFunBikeHornImplants diff --git a/Resources/Prototypes/Catalog/Fills/Lockers/misc.yml b/Resources/Prototypes/Catalog/Fills/Lockers/misc.yml index 64b173355d..4e4d4f1067 100644 --- a/Resources/Prototypes/Catalog/Fills/Lockers/misc.yml +++ b/Resources/Prototypes/Catalog/Fills/Lockers/misc.yml @@ -116,6 +116,8 @@ prob: 0.2 - id: PlushieSnake prob: 0.2 + - id: ClothingShoesSkates + prob: 0.1 - id: ClothingHandsGlovesColorYellow prob: 0.05 - id: ClothingHandsGlovesFingerlessInsulated diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml index eae044f8dd..5223ab926b 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml @@ -186,3 +186,28 @@ - type: ClothingSpeedModifier walkModifier: 0.85 sprintModifier: 0.8 + +- type: entity + parent: ClothingShoesBaseButcherable + id: ClothingShoesSkates + name: roller skates + description: "Get your skates on!" + components: + - type: Sprite + sprite: Clothing/Shoes/Specific/skates.rsi + - type: Clothing + sprite: Clothing/Shoes/Specific/skates.rsi + clothingVisuals: + shoes: + - state: equipped-FEET + offset: "0, -0.04" + - type: Item + size: 10 + sprite: Clothing/Shoes/Specific/skates.rsi + - type: ClothingSpeedModifier + walkModifier: 1.3 + sprintModifier: 1.3 + - type: Skates + - type: FootstepModifier + footstepSoundCollection: + collection: FootstepSkates diff --git a/Resources/Prototypes/SoundCollections/footsteps.yml b/Resources/Prototypes/SoundCollections/footsteps.yml index 47dc433d8b..d67d460098 100644 --- a/Resources/Prototypes/SoundCollections/footsteps.yml +++ b/Resources/Prototypes/SoundCollections/footsteps.yml @@ -72,6 +72,11 @@ - /Audio/Effects/Footsteps/jesterstep1.ogg - /Audio/Effects/Footsteps/jesterstep2.ogg +- type: soundCollection + id: FootstepSkates + files: + - /Audio/Items/Toys/skates.ogg + - type: soundCollection id: FootstepDuck files: diff --git a/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/equipped-FEET.png b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/equipped-FEET.png new file mode 100644 index 0000000000..09c92cfa5f Binary files /dev/null and b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/equipped-FEET.png differ diff --git a/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/icon.png b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/icon.png new file mode 100644 index 0000000000..0d9b9dcf32 Binary files /dev/null and b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/icon.png differ diff --git a/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/inhand-left.png b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/inhand-left.png new file mode 100644 index 0000000000..1ba8eb4173 Binary files /dev/null and b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/inhand-left.png differ diff --git a/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/inhand-right.png b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/inhand-right.png new file mode 100644 index 0000000000..7886baaeda Binary files /dev/null and b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/inhand-right.png differ diff --git a/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/meta.json b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/meta.json new file mode 100644 index 0000000000..3c606364d8 --- /dev/null +++ b/Resources/Textures/Clothing/Shoes/Specific/skates.rsi/meta.json @@ -0,0 +1,26 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Made by brainfood1183 (github)", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "equipped-FEET", + "directions": 4 + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +}