Skip to content

Commit

Permalink
jump boots
Browse files Browse the repository at this point in the history
  • Loading branch information
Jopaglazik committed Oct 17, 2024
1 parent b3c6153 commit c89850e
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 2 deletions.
40 changes: 40 additions & 0 deletions Content.Shared/Movement/Components/JumpComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Content.Shared.Actions;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;


namespace Content.Shared.Movement.Components;

[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class JumpComponent : Component
{
/// <summary>
/// How powerful the jump will be when activated
/// </summary>
[DataField("jumpPower"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public float JumpPower = 5f;


// Logical variables
[DataField]
public EntProtoId Action = "ActionGravityJump";

[DataField]
public EntityUid? ActionEntity;

[DataField]
public bool? IsClothing;

[DataField, AutoNetworkedField]
public EntityUid OnClothingEntity;


// Sound
[DataField("soundJump"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public SoundSpecifier SoundJump = new SoundPathSpecifier("/Audio/Effects/gravity_jump.ogg");
}


public sealed partial class GravityJumpEvent : InstantActionEvent;

51 changes: 51 additions & 0 deletions Content.Shared/Movement/Systems/SharedJumpSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Content.Shared.Actions;
using Content.Shared.Clothing;
using Content.Shared.Throwing;
using Content.Shared.Movement.Components;
using Robust.Shared.Audio.Systems;


namespace Content.Shared.Movement.Systems;

public sealed partial class SharedJumpSystem : EntitySystem
{
[Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly SharedTransformSystem _xform = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<JumpComponent, ClothingGotEquippedEvent>(OnEquip);
SubscribeLocalEvent<JumpComponent, GravityJumpEvent>(JumpAbility);
}


public void OnEquip(Entity<JumpComponent> ent, ref ClothingGotEquippedEvent args)
{
_actions.AddAction(args.Wearer, ref ent.Comp.ActionEntity, ent.Comp.Action, ent);

ent.Comp.IsClothing = true;
ent.Comp.OnClothingEntity = args.Wearer;
}


public void JumpAbility(Entity<JumpComponent> entity, ref GravityJumpEvent args)
{
if (entity.Comp.IsClothing != null) // checking for wearing clothing with a jump component
{
entity.Owner = entity.Comp.OnClothingEntity;
}

var xform = Transform(entity.Owner);
var throwing = xform.LocalRotation.ToWorldVec() * entity.Comp.JumpPower;
var direction = xform.Coordinates.Offset(throwing); // to make the character jump in the direction he's looking

_throwing.TryThrow(entity.Owner, direction);

_audio.PlayPredicted(entity.Comp.SoundJump, entity.Owner, entity);

args.Handled = true;
}
}
Binary file added Resources/Audio/Effects/gravity_jump.ogg
Binary file not shown.
Binary file added Resources/Audio/Effects/stealthoff.ogg
Binary file not shown.
16 changes: 15 additions & 1 deletion Resources/Prototypes/Actions/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
sprite: Objects/Weapons/Grenades/empgrenade.rsi
state: icon
event: !type:ActivateImplantEvent

- type: entity
id: ActionActivateScramImplant
name: SCRAM!
Expand Down Expand Up @@ -326,3 +326,17 @@
itemIconStyle: NoItem
useDelay: 1 # emote spam
event: !type:ToggleActionEvent

- type: entity
id: ActionGravityJump
name: Jump
description: By tensing your muscles you jump a short distance in the direction of your gaze.
components:
- type: InstantAction
useDelay: 8
checkCanInteract: false
icon:
sprite: Interface/Actions/jump.rsi
state: icon
event: !type:GravityJumpEvent {}

20 changes: 20 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Shoes/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,23 @@
price: 75
- type: Tag
tags: [ ]

- type: entity
parent: ClothingShoesBase
id: ClothingShoesJumpBoots
name: jump boots
description: Technological boots used by explorers of new worlds from various unwanted obstacles.
components:
- type: Sprite
sprite: Clothing/Shoes/Boots/jumpboots.rsi
layers:
- state: icon
- type: Clothing
sprite: Clothing/Shoes/Boots/jumpboots.rsi
- type: Jump
jumpPower: 3
soundJump: /Audio/Effects/stealthoff.ogg
- type: StaticPrice
price: 220
- type: Tag
tags: []
3 changes: 3 additions & 0 deletions Resources/Prototypes/Entities/Structures/Machines/lathe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
- ClothingShoesBootsMagSci
- ClothingShoesBootsMoon
- ClothingShoesBootsSpeed
- ClothingShoesJumpBoots
- NodeScanner
- HolofanProjector
- BluespaceBeaker
Expand Down Expand Up @@ -1176,6 +1177,8 @@
- type: Machine
board: BiogeneratorMachineCircuitboard
- type: MaterialStorage
insertOnInteract: false
canEjectStoredMaterials: false
- type: ProduceMaterialExtractor
- type: ItemSlots
slots:
Expand Down
11 changes: 10 additions & 1 deletion Resources/Prototypes/Recipes/Lathes/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,16 @@
Steel: 1500
Plastic: 1000
Silver: 500


- type: latheRecipe
id: ClothingShoesJumpBoots
result: ClothingShoesJumpBoots
completetime: 2
materials:
Steel: 1000
Plastic: 400
Plasma: 200

- type: latheRecipe
id: ModularReceiver
result: ModularReceiver
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Research/industrial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
- OreBagOfHolding
- MiningDrillDiamond
- AdvancedMineralScannerEmpty
- ClothingShoesJumpBoots

# Tier 3

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions Textures/Clothing/Shoes/Boots/jumpboots.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/blob/master/icons/obj/clothing/shoes.dmi",
"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 added Textures/Interface/Actions/jump.rsi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions Textures/Interface/Actions/jump.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/blob/master/icons/hud/implants.dmi",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "icon"
}
]
}

0 comments on commit c89850e

Please sign in to comment.