mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Implement unstoppable rolling
This commit is contained in:
parent
01410569a4
commit
a715a84ea7
14
Cargo.lock
generated
14
Cargo.lock
generated
@ -832,7 +832,7 @@ name = "euc"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3026,7 +3026,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
[[package]]
|
||||
name = "vek"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -3055,7 +3054,7 @@ dependencies = [
|
||||
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8",
|
||||
"veloren-common 0.3.0",
|
||||
]
|
||||
|
||||
@ -3084,7 +3083,7 @@ dependencies = [
|
||||
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"specs-idvs 0.1.0 (git+https://gitlab.com/veloren/specs-idvs.git)",
|
||||
"sphynx 0.1.0 (git+https://gitlab.com/veloren/sphynx.git?rev=11cdc7422568aaabd376c87242a60f636e68b40d)",
|
||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3103,7 +3102,7 @@ dependencies = [
|
||||
"serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8",
|
||||
"veloren-common 0.3.0",
|
||||
"veloren-world 0.3.0",
|
||||
]
|
||||
@ -3155,7 +3154,7 @@ dependencies = [
|
||||
"serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"simplelog 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8",
|
||||
"veloren-client 0.3.0",
|
||||
"veloren-common 0.3.0",
|
||||
"veloren-server 0.3.0",
|
||||
@ -3172,7 +3171,7 @@ dependencies = [
|
||||
"noise 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.8",
|
||||
"veloren-common 0.3.0",
|
||||
"zerocopy 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -3722,7 +3721,6 @@ dependencies = [
|
||||
"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
|
||||
"checksum uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e59a167890d173eb0fcd7a1b99b84dc05c521ae8d76599130b8e19bef287abbf"
|
||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||
"checksum vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1c95e5c5c123ecdb4a1a27a590f053a6c6de4b6ea696f4f0ef99054ead450258"
|
||||
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"
|
||||
|
@ -17,3 +17,6 @@ overflow-checks = false
|
||||
debug = true
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
|
||||
[patch.crates-io]
|
||||
vek = { path = "../vek" }
|
||||
|
@ -11,5 +11,5 @@ uvth = "3.1.1"
|
||||
num_cpus = "1.10.1"
|
||||
log = "0.4.8"
|
||||
specs = "0.14.2"
|
||||
vek = "0.9.8"
|
||||
vek = { path = "../../vek", features=["serde"] }
|
||||
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
|
||||
|
@ -73,13 +73,10 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
// Look
|
||||
if controller
|
||||
controller.look_dir = controller
|
||||
.look_dir
|
||||
.map(|n| !n.is_normal() || n.abs() < std::f32::EPSILON)
|
||||
.reduce_or()
|
||||
{
|
||||
controller.look_dir = controller.move_dir.into();
|
||||
}
|
||||
.try_normalized()
|
||||
.unwrap_or(controller.move_dir.into());
|
||||
|
||||
// Glide
|
||||
if controller.glide
|
||||
|
@ -17,8 +17,7 @@ const WIELD_ACCEL: f32 = 70.0;
|
||||
const WIELD_SPEED: f32 = 120.0;
|
||||
const HUMANOID_AIR_ACCEL: f32 = 10.0;
|
||||
const HUMANOID_AIR_SPEED: f32 = 100.0;
|
||||
const ROLL_ACCEL: f32 = 160.0;
|
||||
const ROLL_SPEED: f32 = 550.0;
|
||||
const ROLL_SPEED: f32 = 13.0;
|
||||
const GLIDE_ACCEL: f32 = 15.0;
|
||||
const GLIDE_SPEED: f32 = 45.0;
|
||||
// Gravity is 9.81 * 4, so this makes gravity equal to .15
|
||||
@ -74,24 +73,32 @@ impl<'a> System<'a> for Sys {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Move player according to move_dir
|
||||
vel.0 += Vec2::broadcast(dt.0)
|
||||
* controller.move_dir
|
||||
* match (physics.on_ground, &character.movement) {
|
||||
(true, Run) if vel.0.magnitude_squared() < HUMANOID_SPEED.powf(2.0) => {
|
||||
HUMANOID_ACCEL
|
||||
}
|
||||
(false, Glide) if vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) => {
|
||||
GLIDE_ACCEL
|
||||
}
|
||||
(false, Jump) if vel.0.magnitude_squared() < HUMANOID_AIR_SPEED.powf(2.0) => {
|
||||
HUMANOID_AIR_ACCEL
|
||||
}
|
||||
(true, Roll { .. }) if vel.0.magnitude_squared() < ROLL_SPEED.powf(2.0) => {
|
||||
ROLL_ACCEL
|
||||
}
|
||||
_ => 0.0,
|
||||
};
|
||||
if character.movement.is_roll() {
|
||||
vel.0 = controller
|
||||
.move_dir
|
||||
.try_normalized()
|
||||
.map(Vec3::from)
|
||||
.unwrap_or(vel.0.normalized())
|
||||
* ROLL_SPEED;
|
||||
} else {
|
||||
// Move player according to move_dir
|
||||
vel.0 += Vec2::broadcast(dt.0)
|
||||
* controller.move_dir
|
||||
* match (physics.on_ground, &character.movement) {
|
||||
(true, Run) if vel.0.magnitude_squared() < HUMANOID_SPEED.powf(2.0) => {
|
||||
HUMANOID_ACCEL
|
||||
}
|
||||
(false, Glide) if vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) => {
|
||||
GLIDE_ACCEL
|
||||
}
|
||||
(false, Jump)
|
||||
if vel.0.magnitude_squared() < HUMANOID_AIR_SPEED.powf(2.0) =>
|
||||
{
|
||||
HUMANOID_AIR_ACCEL
|
||||
}
|
||||
_ => 0.0,
|
||||
};
|
||||
}
|
||||
|
||||
// Set direction based on move direction when on the ground
|
||||
let ori_dir = if character.action.is_wield()
|
||||
|
@ -30,7 +30,7 @@ euc = "0.3.0"
|
||||
specs = "0.14.2"
|
||||
|
||||
# Mathematics
|
||||
vek = "0.9.8"
|
||||
vek = { path = "../../vek", features=["serde"] }
|
||||
|
||||
# discord
|
||||
discord-rpc-sdk = { git = "https://github.com/Songtronix/rust-discord-rpc.git", optional = true }
|
||||
|
Loading…
Reference in New Issue
Block a user