From 5c675fdbe2630634d01781eed140c621fbcb0eae Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 19 Mar 2023 20:23:42 -0400 Subject: [PATCH] Addressed review --- common/src/comp/ability.rs | 14 ++++++-------- common/src/comp/inventory/item/tool.rs | 21 +++++++++++++-------- server-cli/src/main.rs | 4 ---- voxygen/anim/src/character/divemelee.rs | 4 ++-- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 65d95df780..c1b3d9f481 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -280,11 +280,11 @@ impl Ability { .map(|i| &i.item_config_expect().abilities) }; - let contextual_id = |auxiliary_kind: Option<&'a AbilityKind<_>>| -> Option<&'a str> { + let contextual_id = |kind: Option<&'a AbilityKind<_>>| -> Option<&'a str> { if let Some(AbilityKind::Contextualized { pseudo_id, abilities: _, - }) = auxiliary_kind + }) = kind { Some(pseudo_id.as_str()) } else { @@ -2320,9 +2320,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState { exhausted: false, start_next_strike: false, timer: Duration::default(), - // If ability is a stance, if starting from wielding, get ready to enter stance, - // otherwise enter stance immediately, otherwise if not a stance immediately begin - // the strike stage_section: StageSection::Buildup, completed_strikes: 0, }), @@ -2795,7 +2792,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState { ability_info, }, timer: Duration::default(), - stage_section: if data.vel.0.z < 0.0 || buildup_duration.is_none() { + stage_section: if data.vel.0.z < -*vertical_speed || buildup_duration.is_none() { StageSection::Movement } else { StageSection::Buildup @@ -2861,6 +2858,7 @@ pub struct AbilityMeta { #[serde(default)] pub capabilities: Capability, #[serde(default)] + /// This is an event that gets emitted when the ability is first activated pub init_event: Option, #[serde(default)] pub requirements: AbilityRequirements, @@ -2894,8 +2892,8 @@ bitflags::bitflags! { #[derive(Default, Serialize, Deserialize)] // If more are ever needed, first check if any not used anymore, as some were only used in intermediary stages so may be free pub struct Capability: u8 { - // Allows rolls to interrupt the ability at any point for free, not just during buildup - const ROLL_INTERRUPTS_FREE = 0b00000001; + // There used to be a capability here, to keep ordering the same below this is now a placeholder + const PLACEHOLDER = 0b00000001; // Allows blocking to interrupt the ability at any point const BLOCK_INTERRUPT = 0b00000010; // When the ability is in the buildup section, it counts as a block with 50% DR diff --git a/common/src/comp/inventory/item/tool.rs b/common/src/comp/inventory/item/tool.rs index fa2726f6c1..f1fe2f7ef3 100644 --- a/common/src/comp/inventory/item/tool.rs +++ b/common/src/comp/inventory/item/tool.rs @@ -341,14 +341,19 @@ impl AbilityKind { AbilityKind::Contextualized { pseudo_id: _, abilities, - } => abilities - .get(&context) - .and_then(|(s, a)| unlocked(*s, a)) - .or_else(|| { - abilities - .get(&AbilityContext::None) - .and_then(|(s, a)| unlocked(*s, a)) - }), + } => { + // In the event that the ability from the current context is not unlocked with + // the required skill, try falling back to the ability from this input that does + // not require a context + abilities + .get(&context) + .and_then(|(s, a)| unlocked(*s, a)) + .or_else(|| { + abilities + .get(&AbilityContext::None) + .and_then(|(s, a)| unlocked(*s, a)) + }) + }, } } } diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index ae9d38c698..7074177400 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -91,10 +91,6 @@ fn main() -> io::Result<()> { .unwrap(), ); - // agent and world imported here so that mim-alloc can be used when hot - // reloading these crates without separately declaring mim-alloc as the - // allocator in those crates (doing so causes UB when a vec (and presumably - // other allocations) are passed to a dynlib and resized within that dynlib) #[cfg(feature = "hot-agent")] { agent::init(); diff --git a/voxygen/anim/src/character/divemelee.rs b/voxygen/anim/src/character/divemelee.rs index d0fdb72db3..b8c23e5a39 100644 --- a/voxygen/anim/src/character/divemelee.rs +++ b/voxygen/anim/src/character/divemelee.rs @@ -3,7 +3,7 @@ use super::{ CharacterSkeleton, SkeletonAttr, }; use common::states::utils::{AbilityInfo, StageSection}; -use core::f32::consts::PI; +use core::f32::consts::{PI, TAU}; pub struct DiveMeleeAnimation; impl Animation for DiveMeleeAnimation { @@ -70,7 +70,7 @@ impl Animation for DiveMeleeAnimation { next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - next.torso.orientation.rotate_x(move1alt * -6.28); + next.torso.orientation.rotate_x(move1alt * -TAU); next.torso.orientation.rotate_x(move1 * -0.8); next.control.orientation.rotate_x(move1 * 1.5);