]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Roller Skates fixes (#21542)
authorbrainfood1183 <113240905+brainfood1183@users.noreply.github.com>
Thu, 9 Nov 2023 01:43:27 +0000 (01:43 +0000)
committerGitHub <noreply@github.com>
Thu, 9 Nov 2023 01:43:27 +0000 (18:43 -0700)
Content.Server/Clothing/Systems/SkatesSystem.cs [deleted file]
Content.Shared/Clothing/Components/SkatesComponent.cs
Content.Shared/Clothing/EntitySystems/SkatesSystem.cs [new file with mode: 0644]
Content.Shared/Damage/Components/DamageOnHighSpeedImpactComponent.cs [moved from Content.Server/Damage/Components/DamageOnHighSpeedImpactComponent.cs with 92% similarity]
Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs [moved from Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs with 86% similarity]
Resources/Audio/Items/Toys/attributions.yml [new file with mode: 0644]
Resources/Audio/Items/Toys/licensing.txt [deleted file]
Resources/Prototypes/Entities/Clothing/Shoes/specific.yml

diff --git a/Content.Server/Clothing/Systems/SkatesSystem.cs b/Content.Server/Clothing/Systems/SkatesSystem.cs
deleted file mode 100644 (file)
index 18ae609..0000000
+++ /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<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 dcfe96647331e35a4f756d0814927c2cc3591f91..d6d937568419a2831032882f058d233b8448e164 100644 (file)
@@ -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;
 }
diff --git a/Content.Shared/Clothing/EntitySystems/SkatesSystem.cs b/Content.Shared/Clothing/EntitySystems/SkatesSystem.cs
new file mode 100644 (file)
index 0000000..7d748a6
--- /dev/null
@@ -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);
+        }
+    }
+}
similarity index 92%
rename from Content.Server/Damage/Components/DamageOnHighSpeedImpactComponent.cs
rename to Content.Shared/Damage/Components/DamageOnHighSpeedImpactComponent.cs
index 243cc70c1ada5eb19a96fc6cb3257ac01389aa44..3eef1d70a4b46569feac77193e5a0a72550492f3 100644 (file)
@@ -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?
similarity index 86%
rename from Content.Server/Damage/Systems/DamageOnHighSpeedImpactSystem.cs
rename to Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs
index c3fd00b325e77a421aa4a5b94c47c129c1d006e3..f099a337598ac19b474a6e9e942c83188721e413 100644 (file)
@@ -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);
     }
 }
diff --git a/Resources/Audio/Items/Toys/attributions.yml b/Resources/Audio/Items/Toys/attributions.yml
new file mode 100644 (file)
index 0000000..4f9b558
--- /dev/null
@@ -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 (file)
index 8e0965a..0000000
+++ /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).
index ea8e3b17f1c9bf1e63b32358ce7910e0d3d941fe..b6f0cc7a922aeb22f388884c6edf0eebf1ea8c9b 100644 (file)
   - 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: