mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Glider stamina only costs on deploy
This commit is contained in:
parent
5eefa86d68
commit
30168e375f
@ -29,8 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Doubled range of ScaleMode slider when set to Custom
|
- Doubled range of ScaleMode slider when set to Custom
|
||||||
- Glider can now be deployed even when not on the ground
|
- Glider can now be deployed mid-air at the cost of some stamina based on fall speed
|
||||||
- Gliding now has an energy cost for strenuous maneuvers based on lift
|
|
||||||
- Translations are now folders with multiple files instead of a huge single file
|
- Translations are now folders with multiple files instead of a huge single file
|
||||||
- Default inventory slots reduced to 18 - existing characters given 3x 6-slot bags as compensation
|
- Default inventory slots reduced to 18 - existing characters given 3x 6-slot bags as compensation
|
||||||
- Protection rating was moved to the top left of the loadout view
|
- Protection rating was moved to the top left of the loadout view
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::utils::handle_climb;
|
use super::utils::handle_climb;
|
||||||
use crate::{
|
use crate::{
|
||||||
comp::{inventory::slot::EquipSlot, CharacterState, EnergySource, StateUpdate},
|
comp::{inventory::slot::EquipSlot, CharacterState, StateUpdate},
|
||||||
states::behavior::{CharacterBehavior, JoinData},
|
states::behavior::{CharacterBehavior, JoinData},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
};
|
};
|
||||||
@ -59,17 +59,6 @@ impl CharacterBehavior for Data {
|
|||||||
* (horiz_speed_sq * f32::powf(0.075, 2.0)).clamp(0.2, 1.0);
|
* (horiz_speed_sq * f32::powf(0.075, 2.0)).clamp(0.2, 1.0);
|
||||||
|
|
||||||
update.vel.0.z += lift * data.dt.0;
|
update.vel.0.z += lift * data.dt.0;
|
||||||
|
|
||||||
// Expend energy during strenuous maneuvers.
|
|
||||||
// Cost increases with lift exceeding that of calmly gliding.
|
|
||||||
let energy_cost = (0.25 * (lift - GLIDE_ANTIGRAV)).max(0.0) as i32;
|
|
||||||
if update
|
|
||||||
.energy
|
|
||||||
.try_change_by(-energy_cost, EnergySource::Glide)
|
|
||||||
.is_err()
|
|
||||||
{
|
|
||||||
update.character = CharacterState::Idle {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update
|
update
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::utils::*;
|
use super::utils::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
comp::{slot::EquipSlot, CharacterState, StateUpdate},
|
comp::{slot::EquipSlot, CharacterState, EnergySource, StateUpdate},
|
||||||
states::behavior::{CharacterBehavior, JoinData},
|
states::behavior::{CharacterBehavior, JoinData},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -17,7 +17,18 @@ impl CharacterBehavior for Data {
|
|||||||
|
|
||||||
// If not on the ground while wielding glider enter gliding state
|
// If not on the ground while wielding glider enter gliding state
|
||||||
if !data.physics.on_ground {
|
if !data.physics.on_ground {
|
||||||
update.character = CharacterState::Glide;
|
// Expend energy to slow a fall
|
||||||
|
let energy_cost = (0.5 * data.vel.0.z.min(0.0).powi(2)) as i32;
|
||||||
|
if update
|
||||||
|
.energy
|
||||||
|
.try_change_by(-energy_cost, EnergySource::Glide)
|
||||||
|
.is_ok()
|
||||||
|
{
|
||||||
|
update.character = CharacterState::Glide;
|
||||||
|
} else {
|
||||||
|
update.energy.set_to(0, EnergySource::Glide);
|
||||||
|
update.character = CharacterState::Idle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if data
|
if data
|
||||||
.physics
|
.physics
|
||||||
|
Loading…
Reference in New Issue
Block a user