diff --git a/Content.Shared/Actions/ActionGrantSystem.cs b/Content.Shared/Actions/ActionGrantSystem.cs index f73ecf8a46..e5b737f28f 100644 --- a/Content.Shared/Actions/ActionGrantSystem.cs +++ b/Content.Shared/Actions/ActionGrantSystem.cs @@ -1,3 +1,5 @@ +using Content.Shared.Inventory; + namespace Content.Shared.Actions; /// @@ -17,9 +19,13 @@ public sealed class ActionGrantSystem : EntitySystem private void OnItemGet(Entity 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); diff --git a/Content.Shared/Actions/ItemActionGrantComponent.cs b/Content.Shared/Actions/ItemActionGrantComponent.cs index d1769b51a2..db722d0c46 100644 --- a/Content.Shared/Actions/ItemActionGrantComponent.cs +++ b/Content.Shared/Actions/ItemActionGrantComponent.cs @@ -11,4 +11,10 @@ public sealed partial class ItemActionGrantComponent : Component { [DataField(required: true), AutoNetworkedField, AlwaysPushInheritance] public List Actions = new(); + + /// + /// Actions will only be available if the item is in the clothing slot. + /// + [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 index 0000000000..6da9161578 --- /dev/null +++ b/Content.Shared/Movement/Components/JumpAbilityComponent.cs @@ -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; + +/// +/// A component for configuring the settings for the jump action. +/// To give the jump action to an entity use and . +/// The basic action prototype is "ActionGravityJump". +/// +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedJumpAbilitySystem))] +public sealed partial class JumpAbilityComponent : Component +{ + /// + /// How far you will jump (in tiles). + /// + [DataField, AutoNetworkedField] + public float JumpDistance = 5f; + + /// + /// Basic “throwing” speed for TryThrow method. + /// + [DataField, AutoNetworkedField] + public float JumpThrowSpeed = 10f; + + /// + /// This gets played whenever the jump action is used. + /// + [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 index 0000000000..ac720cae68 --- /dev/null +++ b/Content.Shared/Movement/Systems/SharedJumpAbilitySystem.cs @@ -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(OnGravityJump); + } + + private void OnGravityJump(Entity 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; + } +} diff --git a/Resources/Audio/Effects/attributions.yml b/Resources/Audio/Effects/attributions.yml index f330220421..3a7f18c7a3 100644 --- a/Resources/Audio/Effects/attributions.yml +++ b/Resources/Audio/Effects/attributions.yml @@ -247,6 +247,11 @@ 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 index 0000000000..d78706e9cd Binary files /dev/null and b/Resources/Audio/Effects/stealthoff.ogg differ diff --git a/Resources/Prototypes/Actions/types.yml b/Resources/Prototypes/Actions/types.yml index 40a576b453..e6587ae6b8 100644 --- a/Resources/Prototypes/Actions/types.yml +++ b/Resources/Prototypes/Actions/types.yml @@ -401,6 +401,20 @@ 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 diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/misc.yml b/Resources/Prototypes/Entities/Clothing/Shoes/misc.yml index 5ba1a63ea5..26fbc0c7ae 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/misc.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/misc.yml @@ -182,3 +182,30 @@ 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: [] diff --git a/Resources/Prototypes/Recipes/Lathes/Packs/science.yml b/Resources/Prototypes/Recipes/Lathes/Packs/science.yml index 16d28fa9bf..6308570e6f 100644 --- a/Resources/Prototypes/Recipes/Lathes/Packs/science.yml +++ b/Resources/Prototypes/Recipes/Lathes/Packs/science.yml @@ -37,6 +37,7 @@ - ClothingShoesBootsMagSci - ClothingShoesBootsMoon - ClothingShoesBootsSpeed + - ClothingShoesBootsJump - ClothingBackpackHolding - ClothingBackpackSatchelHolding - ClothingBackpackDuffelHolding diff --git a/Resources/Prototypes/Recipes/Lathes/misc.yml b/Resources/Prototypes/Recipes/Lathes/misc.yml index 9d4ecf7697..40d155b1fd 100644 --- a/Resources/Prototypes/Recipes/Lathes/misc.yml +++ b/Resources/Prototypes/Recipes/Lathes/misc.yml @@ -167,6 +167,16 @@ 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 @@ -265,4 +275,5 @@ result: Ashtray completetime: 1 materials: - Steel: 30 \ No newline at end of file + Steel: 30 + diff --git a/Resources/Prototypes/Research/industrial.yml b/Resources/Prototypes/Research/industrial.yml index 467afe5fef..08d2083e3b 100644 --- a/Resources/Prototypes/Research/industrial.yml +++ b/Resources/Prototypes/Research/industrial.yml @@ -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 index 0000000000..e01c5d3638 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 index 0000000000..06c62f2869 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 index 0000000000..8a548ba6a4 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 index 0000000000..7c1c8fa122 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 index 0000000000..f7ee26e9a8 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 index 0000000000..faaa2fe6bb --- /dev/null +++ b/Resources/Textures/Clothing/Shoes/Boots/jumpboots.rsi/meta.json @@ -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 index 0000000000..46af10ae27 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 index 0000000000..7a2119f3fb --- /dev/null +++ b/Resources/Textures/Interface/Actions/jump.rsi/meta.json @@ -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" + } + ] +}