+using Content.Shared.Inventory;
+
namespace Content.Shared.Actions;
/// <summary>
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);
{
[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;
}
--- /dev/null
+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;
+
--- /dev/null
+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;
+ }
+}
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)"
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
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: []
- ClothingShoesBootsMagSci
- ClothingShoesBootsMoon
- ClothingShoesBootsSpeed
+ - ClothingShoesBootsJump
- ClothingBackpackHolding
- ClothingBackpackSatchelHolding
- ClothingBackpackDuffelHolding
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
+
- MineralScannerEmpty
- OreProcessorIndustrialMachineCircuitboard
- ClothingMaskWeldingGas
+ - ClothingShoesBootsJump
- type: technology
id: SpaceScanning
--- /dev/null
+{
+ "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
+ }
+ ]
+}
--- /dev/null
+{
+ "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"
+ }
+ ]
+}