]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Roller Skates (#20257)
authorbrainfood1183 <113240905+brainfood1183@users.noreply.github.com>
Mon, 6 Nov 2023 02:42:37 +0000 (02:42 +0000)
committerGitHub <noreply@github.com>
Mon, 6 Nov 2023 02:42:37 +0000 (19:42 -0700)
* 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

14 files changed:
Content.Server/Clothing/Systems/SkatesSystem.cs [new file with mode: 0644]
Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs
Content.Shared/Clothing/Components/SkatesComponent.cs [new file with mode: 0644]
Resources/Audio/Items/Toys/licensing.txt
Resources/Audio/Items/Toys/skates.ogg [new file with mode: 0644]
Resources/Prototypes/Catalog/Fills/Crates/fun.yml
Resources/Prototypes/Catalog/Fills/Lockers/misc.yml
Resources/Prototypes/Entities/Clothing/Shoes/specific.yml
Resources/Prototypes/SoundCollections/footsteps.yml
Resources/Textures/Clothing/Shoes/Specific/skates.rsi/equipped-FEET.png [new file with mode: 0644]
Resources/Textures/Clothing/Shoes/Specific/skates.rsi/icon.png [new file with mode: 0644]
Resources/Textures/Clothing/Shoes/Specific/skates.rsi/inhand-left.png [new file with mode: 0644]
Resources/Textures/Clothing/Shoes/Specific/skates.rsi/inhand-right.png [new file with mode: 0644]
Resources/Textures/Clothing/Shoes/Specific/skates.rsi/meta.json [new file with mode: 0644]

diff --git a/Content.Server/Clothing/Systems/SkatesSystem.cs b/Content.Server/Clothing/Systems/SkatesSystem.cs
new file mode 100644 (file)
index 0000000..18ae609
--- /dev/null
@@ -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);
+        }
+    }
+}
index bcd1e0423adab802dc1a33d3864b6e7fc5a5f59c..c3fd00b325e77a421aa4a5b94c47c129c1d006e3 100644 (file)
@@ -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<EntityUid>() { 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 (file)
index 0000000..dcfe966
--- /dev/null
@@ -0,0 +1,9 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Clothing;
+
+[RegisterComponent]
+[NetworkedComponent]
+public sealed partial class SkatesComponent : Component
+{
+}
index 8b68bfa553e5df4493462fd95f3e0e818b7b16cd..8e0965a91ac184836789586196a9a975209c0f57 100644 (file)
@@ -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 (file)
index 0000000..9ae1274
Binary files /dev/null and b/Resources/Audio/Items/Toys/skates.ogg differ
index 862423864eebd2b6cb9bd7d9b4430f6d0dacde70..4ca5f39c5c58c7a3b3a6cab7d52c73566e065b83 100644 (file)
       - id: ClothingShoesClownLarge
       - id: ClothingHeadHatMagician
       - id: BeachBall
+      - id: ClothingShoesSkates
 
 - type: entity
   id: CrateFunBikeHornImplants
index 64b173355d9bb3c8370be857966c798d295b3101..4e4d4f10672cbb04fa355758daacc118cbd80dc2 100644 (file)
           prob: 0.2
         - id: PlushieSnake
           prob: 0.2
+        - id: ClothingShoesSkates
+          prob: 0.1
         - id: ClothingHandsGlovesColorYellow
           prob: 0.05
         - id: ClothingHandsGlovesFingerlessInsulated
index eae044f8dda4fe4e953a638fb8fb65fb56c4d388..5223ab926b105dd627c2155906048b59ee4af70f 100644 (file)
   - 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
index 47dc433d8bd6f98b76e892a8dd12664c9d530f22..d67d46009873c0636750ae885f43e59a96f30871 100644 (file)
   - /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 (file)
index 0000000..09c92cf
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 (file)
index 0000000..0d9b9dc
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 (file)
index 0000000..1ba8eb4
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 (file)
index 0000000..7886baa
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 (file)
index 0000000..3c60636
--- /dev/null
@@ -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
+    }
+  ]
+}