JumpBoots Attempt №2 (#36862)

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: unknown <wainzor1337@gmail.com>
Co-authored-by: ScarKy0 <scarky0@onet.eu>
This commit is contained in:
Голубь
2025-07-08 02:19:28 +07:00
committed by GitHub
parent bb02be1dc7
commit 114ec579f5
19 changed files with 187 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
using Content.Shared.Inventory;
namespace Content.Shared.Actions; namespace Content.Shared.Actions;
/// <summary> /// <summary>
@@ -17,9 +19,13 @@ public sealed class ActionGrantSystem : EntitySystem
private void OnItemGet(Entity<ItemActionGrantComponent> ent, ref GetItemActionsEvent args) private void OnItemGet(Entity<ItemActionGrantComponent> ent, ref GetItemActionsEvent args)
{ {
if (!TryComp(ent.Owner, out ActionGrantComponent? grant)) if (!TryComp(ent.Owner, out ActionGrantComponent? grant))
return; return;
if (ent.Comp.ActiveIfWorn && (args.SlotFlags == null || args.SlotFlags == SlotFlags.POCKET))
return;
foreach (var action in grant.ActionEntities) foreach (var action in grant.ActionEntities)
{ {
args.AddAction(action); args.AddAction(action);

View File

@@ -11,4 +11,10 @@ public sealed partial class ItemActionGrantComponent : Component
{ {
[DataField(required: true), AutoNetworkedField, AlwaysPushInheritance] [DataField(required: true), AutoNetworkedField, AlwaysPushInheritance]
public List<EntProtoId> Actions = new(); 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;
} }

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -247,6 +247,11 @@
copyright: "Created by mattroks101 for Bee Station. cig_snuff converted to mono" copyright: "Created by mattroks101 for Bee Station. cig_snuff converted to mono"
source: "https://github.com/BeeStation/BeeStation-Hornet/pull/29" 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"] - files: ["soft_thump.ogg"]
license: "CC-BY-4.0" license: "CC-BY-4.0"
copyright: "Clipped by FairlySadPanda (Github) from a sound created by CheChoDj (Freesound)" copyright: "Clipped by FairlySadPanda (Github) from a sound created by CheChoDj (Freesound)"

Binary file not shown.

View File

@@ -401,6 +401,20 @@
useDelay: 1 useDelay: 1
itemIconStyle: BigAction 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 - type: entity
parent: BaseToggleAction parent: BaseToggleAction
id: ActionToggleRootable id: ActionToggleRootable

View File

@@ -182,3 +182,30 @@
price: 75 price: 75
- type: Tag - type: Tag
tags: [ ] 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: []

View File

@@ -37,6 +37,7 @@
- ClothingShoesBootsMagSci - ClothingShoesBootsMagSci
- ClothingShoesBootsMoon - ClothingShoesBootsMoon
- ClothingShoesBootsSpeed - ClothingShoesBootsSpeed
- ClothingShoesBootsJump
- ClothingBackpackHolding - ClothingBackpackHolding
- ClothingBackpackSatchelHolding - ClothingBackpackSatchelHolding
- ClothingBackpackDuffelHolding - ClothingBackpackDuffelHolding

View File

@@ -167,6 +167,16 @@
Plastic: 1000 Plastic: 1000
Silver: 500 Silver: 500
- type: latheRecipe
id: ClothingShoesBootsJump
result: ClothingShoesBootsJump
completetime: 2
materials:
Steel: 1400
Plastic: 600
Silver: 200
Plasma: 200
- type: latheRecipe - type: latheRecipe
id: ModularReceiver id: ModularReceiver
result: ModularReceiver result: ModularReceiver
@@ -266,3 +276,4 @@
completetime: 1 completetime: 1
materials: materials:
Steel: 30 Steel: 30

View File

@@ -14,6 +14,7 @@
- MineralScannerEmpty - MineralScannerEmpty
- OreProcessorIndustrialMachineCircuitboard - OreProcessorIndustrialMachineCircuitboard
- ClothingMaskWeldingGas - ClothingMaskWeldingGas
- ClothingShoesBootsJump
- type: technology - type: technology
id: SpaceScanning id: SpaceScanning

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -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
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -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"
}
]
}