]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
JumpBoots Attempt №2 (#36862)
authorГолубь <124601871+Golubgik@users.noreply.github.com>
Mon, 7 Jul 2025 19:19:28 +0000 (02:19 +0700)
committerGitHub <noreply@github.com>
Mon, 7 Jul 2025 19:19:28 +0000 (21:19 +0200)
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: unknown <wainzor1337@gmail.com>
Co-authored-by: ScarKy0 <scarky0@onet.eu>
19 files changed:
Content.Shared/Actions/ActionGrantSystem.cs
Content.Shared/Actions/ItemActionGrantComponent.cs
Content.Shared/Movement/Components/JumpAbilityComponent.cs [new file with mode: 0644]
Content.Shared/Movement/Systems/SharedJumpAbilitySystem.cs [new file with mode: 0644]
Resources/Audio/Effects/attributions.yml
Resources/Audio/Effects/stealthoff.ogg [new file with mode: 0644]
Resources/Prototypes/Actions/types.yml
Resources/Prototypes/Entities/Clothing/Shoes/misc.yml
Resources/Prototypes/Recipes/Lathes/Packs/science.yml
Resources/Prototypes/Recipes/Lathes/misc.yml
Resources/Prototypes/Research/industrial.yml
Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/equipped-FEET-vox.png [new file with mode: 0644]
Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/equipped-FEET.png [new file with mode: 0644]
Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/icon.png [new file with mode: 0644]
Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/inhand-left.png [new file with mode: 0644]
Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/inhand-right.png [new file with mode: 0644]
Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/meta.json [new file with mode: 0644]
Resources/Textures/Interface/Actions/jump.rsi/icon.png [new file with mode: 0644]
Resources/Textures/Interface/Actions/jump.rsi/meta.json [new file with mode: 0644]

index f73ecf8a460813227b0629b2d3079dd4e6864c28..e5b737f28fdb3a4a25c98999303c5e4616f25fe1 100644 (file)
@@ -1,3 +1,5 @@
+using  Content.Shared.Inventory;
+
 namespace Content.Shared.Actions;
 
 /// <summary>
@@ -17,9 +19,13 @@ public sealed class ActionGrantSystem : EntitySystem
 
     private void OnItemGet(Entity<ItemActionGrantComponent> ent, ref GetItemActionsEvent args)
     {
+
         if (!TryComp(ent.Owner, out ActionGrantComponent? grant))
             return;
 
+        if (ent.Comp.ActiveIfWorn && (args.SlotFlags == null || args.SlotFlags == SlotFlags.POCKET))
+            return;
+
         foreach (var action in grant.ActionEntities)
         {
             args.AddAction(action);
index d1769b51a2ffd9ccac2bab11cd935151c3a54705..db722d0c467f9008de93c1b4457342a37f689883 100644 (file)
@@ -11,4 +11,10 @@ public sealed partial class ItemActionGrantComponent : Component
 {
     [DataField(required: true), AutoNetworkedField, AlwaysPushInheritance]
     public List<EntProtoId> Actions = new();
+
+    /// <summary>
+    /// Actions will only be available if the item is in the clothing slot.
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public bool ActiveIfWorn;
 }
diff --git a/Content.Shared/Movement/Components/JumpAbilityComponent.cs b/Content.Shared/Movement/Components/JumpAbilityComponent.cs
new file mode 100644 (file)
index 0000000..6da9161
--- /dev/null
@@ -0,0 +1,36 @@
+using Content.Shared.Actions;
+using Content.Shared.Movement.Systems;
+using Robust.Shared.Audio;
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Movement.Components;
+
+/// <summary>
+/// A component for configuring the settings for the jump action.
+/// To give the jump action to an entity use <see cref="ActionGrantComponent"/> and <see cref="ItemActionGrantComponent"/>.
+/// The basic action prototype is "ActionGravityJump".
+/// </summary>
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedJumpAbilitySystem))]
+public sealed partial class JumpAbilityComponent : Component
+{
+    /// <summary>
+    /// How far you will jump (in tiles).
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public float JumpDistance = 5f;
+
+    /// <summary>
+    /// Basic “throwing” speed for TryThrow method.
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public float JumpThrowSpeed = 10f;
+
+    /// <summary>
+    /// This gets played whenever the jump action is used.
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public SoundSpecifier? JumpSound;
+}
+
+public sealed partial class GravityJumpEvent : InstantActionEvent;
+
diff --git a/Content.Shared/Movement/Systems/SharedJumpAbilitySystem.cs b/Content.Shared/Movement/Systems/SharedJumpAbilitySystem.cs
new file mode 100644 (file)
index 0000000..ac720ca
--- /dev/null
@@ -0,0 +1,35 @@
+using Content.Shared.Gravity;
+using Content.Shared.Movement.Components;
+using Content.Shared.Throwing;
+using Robust.Shared.Audio.Systems;
+
+namespace Content.Shared.Movement.Systems;
+
+public sealed partial class SharedJumpAbilitySystem : EntitySystem
+{
+    [Dependency] private readonly ThrowingSystem _throwing = default!;
+    [Dependency] private readonly SharedAudioSystem _audio = default!;
+    [Dependency] private readonly SharedGravitySystem _gravity = default!;
+
+    public override void Initialize()
+    {
+        base.Initialize();
+
+        SubscribeLocalEvent<JumpAbilityComponent, GravityJumpEvent>(OnGravityJump);
+    }
+
+    private void OnGravityJump(Entity<JumpAbilityComponent> entity, ref GravityJumpEvent args)
+    {
+        if (_gravity.IsWeightless(args.Performer))
+            return;
+
+        var xform = Transform(args.Performer);
+        var throwing = xform.LocalRotation.ToWorldVec() * entity.Comp.JumpDistance;
+        var direction = xform.Coordinates.Offset(throwing); // to make the character jump in the direction he's looking
+
+        _throwing.TryThrow(args.Performer, direction, entity.Comp.JumpThrowSpeed);
+
+        _audio.PlayPredicted(entity.Comp.JumpSound, args.Performer, args.Performer);
+        args.Handled = true;
+    }
+}
index f3302204210b087a67b9f580457436857d59afc9..3a7f18c7a3ca2e1e29c382f0fd9743746038fcb3 100644 (file)
   copyright: "Created by mattroks101 for Bee Station. cig_snuff converted to mono"
   source: "https://github.com/BeeStation/BeeStation-Hornet/pull/29"
 
+- files: [stealthoff.ogg]
+  copyright: 'TGStation at d4f678a1772007ff8d7eddd21cf7218c8e07bfc0'
+  license: "CC-BY-SA-3.0"
+  source: https://github.com/tgstation/tgstation/commit/d4f678a1772007ff8d7eddd21cf7218c8e07bfc0
+
 - files: ["soft_thump.ogg"]
   license: "CC-BY-4.0"
   copyright: "Clipped by FairlySadPanda (Github) from a sound created by CheChoDj (Freesound)"
diff --git a/Resources/Audio/Effects/stealthoff.ogg b/Resources/Audio/Effects/stealthoff.ogg
new file mode 100644 (file)
index 0000000..d78706e
Binary files /dev/null and b/Resources/Audio/Effects/stealthoff.ogg differ
index 40a576b453668036592971be6d43eaebbbaebdf4..e6587ae6b87026de568be239f1536f1b2bd99807 100644 (file)
     useDelay: 1
     itemIconStyle: BigAction
 
+- type: entity
+  parent: BaseAction
+  id: ActionGravityJump
+  name: Jump
+  description: Activating the advanced propulsion system, you propel yourself a short distance in the direction of your gaze.
+  components:
+  - type: Action
+    useDelay: 8
+    icon: 
+      sprite: Interface/Actions/jump.rsi
+      state: icon
+  - type: InstantAction
+    event: !type:GravityJumpEvent {}
+    
 - type: entity
   parent: BaseToggleAction
   id: ActionToggleRootable
index 5ba1a63ea5e8f15277d1c3aae742ad0b4272496c..26fbc0c7ae58f9d1082d55ee799d2a7d776b3398 100644 (file)
     price: 75
   - type: Tag
     tags: [ ]
+   
+- type: entity
+  parent: ClothingShoesBase
+  id: ClothingShoesBootsJump
+  name: jump boots
+  description: High-tech boots that give you the incredible ability to JUMP! With these boots you can jump over lava, chasms and weird chemicals on the floor!
+  components:
+  - type: Sprite
+    sprite: Clothing/Shoes/Boots/jumpboots.rsi
+    layers:
+    - state: icon
+  - type: Clothing
+    sprite: Clothing/Shoes/Boots/jumpboots.rsi
+  - type: JumpAbility
+    jumpDistance: 4
+    jumpSound: /Audio/Effects/stealthoff.ogg
+  - type: ActionGrant
+    actions:
+    - ActionGravityJump 
+  - type: ItemActionGrant
+    actions:
+    - ActionGravityJump
+    activeIfWorn: true
+  - type: StaticPrice
+    price: 220
+  - type: Tag
+    tags: []
index 16d28fa9bf9df37607dbaf7a165ed3d164da634e..6308570e6f956d299dfb522928c380069de8514a 100644 (file)
@@ -37,6 +37,7 @@
   - ClothingShoesBootsMagSci
   - ClothingShoesBootsMoon
   - ClothingShoesBootsSpeed
+  - ClothingShoesBootsJump
   - ClothingBackpackHolding
   - ClothingBackpackSatchelHolding
   - ClothingBackpackDuffelHolding
index 9d4ecf76978aba3ae1708d90cc817138c56689d9..40d155b1fd9924dbeb83caf946831e88b381b836 100644 (file)
     Plastic: 1000
     Silver: 500
 
+- type: latheRecipe
+  id: ClothingShoesBootsJump
+  result: ClothingShoesBootsJump
+  completetime: 2
+  materials:
+    Steel: 1400
+    Plastic: 600
+    Silver: 200
+    Plasma: 200
+
 - type: latheRecipe
   id: ModularReceiver
   result: ModularReceiver
   result: Ashtray
   completetime: 1
   materials:
-    Steel: 30
\ No newline at end of file
+    Steel: 30
+    
index 467afe5fef03cced9b0d7a7d4aae64b0b2c0d92f..08d2083e3b0932331c42c0b3b0f190b1bc080cf1 100644 (file)
@@ -14,6 +14,7 @@
   - MineralScannerEmpty
   - OreProcessorIndustrialMachineCircuitboard
   - ClothingMaskWeldingGas
+  - ClothingShoesBootsJump
 
 - type: technology
   id: SpaceScanning
diff --git a/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/equipped-FEET-vox.png b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/equipped-FEET-vox.png
new file mode 100644 (file)
index 0000000..e01c5d3
Binary files /dev/null and b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/equipped-FEET-vox.png differ
diff --git a/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/equipped-FEET.png b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/equipped-FEET.png
new file mode 100644 (file)
index 0000000..06c62f2
Binary files /dev/null and b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/equipped-FEET.png differ
diff --git a/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/icon.png b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/icon.png
new file mode 100644 (file)
index 0000000..8a548ba
Binary files /dev/null and b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/icon.png differ
diff --git a/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/inhand-left.png b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/inhand-left.png
new file mode 100644 (file)
index 0000000..7c1c8fa
Binary files /dev/null and b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/inhand-left.png differ
diff --git a/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/inhand-right.png b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/inhand-right.png
new file mode 100644 (file)
index 0000000..f7ee26e
Binary files /dev/null and b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/inhand-right.png differ
diff --git a/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/meta.json b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/meta.json
new file mode 100644 (file)
index 0000000..faaa2fe
--- /dev/null
@@ -0,0 +1,30 @@
+{
+    "version": 1,
+    "license": "CC-BY-SA-3.0",
+    "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/cd6ba31a1b5891133c14b9ebba4a4479143b5167",
+    "size": {
+        "x": 32,
+        "y": 32
+    },
+    "states": [
+        {
+            "name": "icon"
+        },
+        {
+            "name": "equipped-FEET",
+            "directions": 4
+        },
+        {
+            "name": "equipped-FEET-vox",
+            "directions": 4
+        },
+        {
+            "name": "inhand-left",
+            "directions": 4
+        },
+        {
+            "name": "inhand-right",
+            "directions": 4
+        }
+    ]
+}
diff --git a/Resources/Textures/Interface/Actions/jump.rsi/icon.png b/Resources/Textures/Interface/Actions/jump.rsi/icon.png
new file mode 100644 (file)
index 0000000..46af10a
Binary files /dev/null and b/Resources/Textures/Interface/Actions/jump.rsi/icon.png differ
diff --git a/Resources/Textures/Interface/Actions/jump.rsi/meta.json b/Resources/Textures/Interface/Actions/jump.rsi/meta.json
new file mode 100644 (file)
index 0000000..7a2119f
--- /dev/null
@@ -0,0 +1,14 @@
+{
+    "version": 1,
+    "license": "CC-BY-SA-3.0",
+    "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/a373b4cb08298523d40acc14f9c390a0c403fc31",
+    "size": {
+        "x": 32,
+        "y": 32
+    },
+    "states": [
+        {
+            "name": "icon"
+        }
+    ]
+}