Draft: Jump refactor #351
No reviewers
Labels
No labels
Blocked
External
Blocked
Research
Closed
Duplicate
Closed
Invalid
Closed
Won't Fix
Kind
Bug
Kind
Documentation
Kind
Feature
Kind
Rebalance
Kind
Refactor
Priority
Core
Priority
Critical
Priority
Fatal
Priority
High
Priority
Low
Priority
Lowest
Priority
Medium
Triage me!
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DragonFoxCollective/SBEPIS!351
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "variable-jump"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #343
@ -70,27 +67,45 @@ impl Default for PlayerJumpSettings {let high_jump_height = 1.5;let charge_jump_height = 2.0;let unreal_air_jump_height = 2.5;let max_hold_time = 0.3;The min and max stamina costs are for the charging time... they make no sense in the context of normal jumps
The high jump and the slide jump are the same thing (crouch jump)
I know macros like this have their place, but they're not very bevy-ish. That's why I use the event chaining, it's a pattern all over sbepis's code (especially bevy_pretty_nice_input)
Just make this "new" if it's the only constructor function
Also auto-dereference Res<> and Mut<> when passing them through functions, so it should take &PlayerJumpSettings instead of &Res (both are called like
new(&settings))Java-ass name tbh, can be way simpler and component-y. Like just
Jumping@ -138,0 +175,4 @@) -> Result {commands.entity(jump.entity).insert(JumpTimer {timer_max: settings.high_jump.max_hold_time,speed: settings.high_jump.speed,I also think this macro is unnecessary. With the new structs you can just have one condition that holds a JumpType and gets the right settings from the PlayerJumpSettings in the observer
@ -70,27 +67,45 @@ impl Default for PlayerJumpSettings {let high_jump_height = 1.5;let charge_jump_height = 2.0;let unreal_air_jump_height = 2.5;let max_hold_time = 0.3;I assume
is overengineered?
@ -70,27 +67,45 @@ impl Default for PlayerJumpSettings {let high_jump_height = 1.5;let charge_jump_height = 2.0;let unreal_air_jump_height = 2.5;let max_hold_time = 0.3;just trying to make one standard struct for each of them, but this is also something I'm thinking of refactoring away.
@ -70,27 +67,45 @@ impl Default for PlayerJumpSettings {let high_jump_height = 1.5;let charge_jump_height = 2.0;let unreal_air_jump_height = 2.5;let max_hold_time = 0.3;I think I'm going to do some refactoring to make this less confusing. thanks for letting me know.
@ -70,27 +67,45 @@ impl Default for PlayerJumpSettings {let high_jump_height = 1.5;let charge_jump_height = 2.0;let unreal_air_jump_height = 2.5;let max_hold_time = 0.3;not super sure what that looks like...
@ -70,27 +67,45 @@ impl Default for PlayerJumpSettings {let high_jump_height = 1.5;let charge_jump_height = 2.0;let unreal_air_jump_height = 2.5;let max_hold_time = 0.3;thanks for the tip, will refactor that.
@ -70,27 +67,45 @@ impl Default for PlayerJumpSettings {let high_jump_height = 1.5;let charge_jump_height = 2.0;let unreal_air_jump_height = 2.5;let max_hold_time = 0.3;will change it to JumpTimer
@ -138,0 +175,4 @@) -> Result {commands.entity(jump.entity).insert(JumpTimer {timer_max: settings.high_jump.max_hold_time,speed: settings.high_jump.speed,also not sure about how that would work.
@ -70,27 +67,45 @@ impl Default for PlayerJumpSettings {let high_jump_height = 1.5;let charge_jump_height = 2.0;let unreal_air_jump_height = 2.5;let max_hold_time = 0.3;Honestly all of JumpSettings might need to be an enum since the same comment goes for min_speed and max_speed... that feels wrong but it's the best thing i can think of
@ -70,27 +67,45 @@ impl Default for PlayerJumpSettings {let high_jump_height = 1.5;let charge_jump_height = 2.0;let unreal_air_jump_height = 2.5;let max_hold_time = 0.3;It's the thing where the observers for all the different kinds of jumps all trigger
DoJumpForRealsiesThisTimeor whatever i called it, providing the necessary info to actually trigger the beginning of the jump@ -33,2 +31,2 @@#[action(invalidate = false)]pub struct ChargeCrouchJump;#[auto_component(plugin = PlayerControllerPlugin, derive(Debug, Default), reflect, register)]pub struct SlideJumping;Yeah the jump heights are WAY off. This calculation is based on it being a single impulse. Instead of using this, delete it and have a constant speed for all jumps (not using this calculation, just make a magic number in the settings), varying in time instead
Charging should be removed in here
@ -33,2 +31,2 @@#[action(invalidate = false)]pub struct ChargeCrouchJump;#[auto_component(plugin = PlayerControllerPlugin, derive(Debug, Default), reflect, register)]pub struct SlideJumping;Yeahhhh the momentum is carrying the player way higher. i'm gonna have to do some algebra about it