diff --git a/assets/common/abilities/ability_set_manifest.ron b/assets/common/abilities/ability_set_manifest.ron index 3a4ff30abe..f1277113ba 100644 --- a/assets/common/abilities/ability_set_manifest.ron +++ b/assets/common/abilities/ability_set_manifest.ron @@ -933,6 +933,13 @@ Simple(None, "common.abilities.debug.evolve"), ], ), + Custom("Admin's Eagle"): ( + primary: Simple(None, "common.abilities.debug.glide_speeder"), + secondary: Simple(None, "common.abilities.debug.glide_boost"), + abilities: [ + Simple(None, "common.abilities.debug.eaglify"), + ], + ), Tool(Farming): ( primary: Simple(None, "common.abilities.farming.basic"), secondary: Simple(None, "common.abilities.farming.basic"), @@ -953,11 +960,6 @@ secondary: Simple(None, "common.abilities.empty.basic"), abilities: [], ), - Custom("Admin's Eagle"): ( - primary: Simple(None, "common.abilities.debug.glide_speeder"), - secondary: Simple(None, "common.abilities.debug.glide_boost"), - abilities: [], - ), // Adlets // TODO: Do we want to eventually convert these to simple variants of weapons? Custom("Adlet Hunter"): ( diff --git a/assets/common/abilities/debug/eaglify.ron b/assets/common/abilities/debug/eaglify.ron new file mode 100644 index 0000000000..84a9d73516 --- /dev/null +++ b/assets/common/abilities/debug/eaglify.ron @@ -0,0 +1,7 @@ +Transform( + buildup_duration: 2.0, + recover_duration: 0.5, + target: "common.entity.wild.peaceful.eagle", + specifier: Some(Evolve), + allow_players: true, +) diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 22705bed8a..89bebd41a4 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -255,14 +255,16 @@ impl ActiveAbilities { }, Ability::MainWeaponAux(_) => match source { AbilitySource::Weapons => inst_ability(EquipSlot::ActiveMainhand, false), - // TODO: add auxiliary abilities in the future? AbilitySource::Glider => None, }, Ability::OffWeaponAux(_) => match source { AbilitySource::Weapons => inst_ability(EquipSlot::ActiveOffhand, true), - // TODO: add auxiliary abilities in the future? AbilitySource::Glider => None, }, + Ability::GliderAux(_) => match source { + AbilitySource::Weapons => None, + AbilitySource::Glider => inst_ability(EquipSlot::Glider, false), + }, Ability::Empty => None, Ability::SpeciesMovement => matches!(body, Some(Body::Humanoid(_))) .then(|| CharacterAbility::default_roll(char_state)) @@ -347,8 +349,11 @@ impl ActiveAbilities { .collect() } }, - // TODO: add auxiliary abilities to gliders - AbilitySource::Glider => vec![], + AbilitySource::Glider => { + Self::iter_available_abilities_on(inv, skill_set, EquipSlot::Glider) + .map(AuxiliaryAbility::Glider) + .collect() + }, } } @@ -391,19 +396,24 @@ pub enum Ability { SpeciesMovement, MainWeaponAux(usize), OffWeaponAux(usize), + GliderAux(usize), Empty, /* For future use * ArmorAbility(usize), */ } impl Ability { + // Reverses input this ability would have originated from + // Used for generic ability dispatch (inst_ability) in this file fn try_input(&self) -> Option { let input = match self { Self::ToolGuard => AbilityInput::Guard, Self::ToolPrimary => AbilityInput::Primary, Self::ToolSecondary => AbilityInput::Secondary, Self::SpeciesMovement => AbilityInput::Movement, - Self::OffWeaponAux(idx) | Self::MainWeaponAux(idx) => AbilityInput::Auxiliary(*idx), + Self::GliderAux(idx) | Self::OffWeaponAux(idx) | Self::MainWeaponAux(idx) => { + AbilityInput::Auxiliary(*idx) + }, Self::Empty => return None, }; @@ -468,8 +478,8 @@ impl Ability { Ability::ToolPrimary => inst_ability(EquipSlot::Glider), Ability::ToolSecondary => inst_ability(EquipSlot::Glider), Ability::SpeciesMovement => None, // TODO: Make not None - // TODO: add aux abilities to gliders in the future? Ability::MainWeaponAux(_) | Ability::OffWeaponAux(_) => None, + Ability::GliderAux(_) => inst_ability(EquipSlot::Glider), Ability::Empty => None, }, AbilitySource::Weapons => match self { @@ -483,6 +493,7 @@ impl Ability { Ability::SpeciesMovement => None, // TODO: Make not None Ability::MainWeaponAux(_) => inst_ability(EquipSlot::ActiveMainhand), Ability::OffWeaponAux(_) => inst_ability(EquipSlot::ActiveOffhand), + Ability::GliderAux(_) => None, Ability::Empty => None, }, } @@ -493,6 +504,7 @@ impl Ability { Ability::ToolPrimary | Ability::ToolSecondary | Ability::MainWeaponAux(_) + | Ability::GliderAux(_) | Ability::OffWeaponAux(_) | Ability::ToolGuard => true, Ability::SpeciesMovement | Ability::Empty => false, @@ -567,8 +579,8 @@ impl SpecifiedAbility { Ability::ToolPrimary => inst_ability(EquipSlot::Glider), Ability::ToolSecondary => inst_ability(EquipSlot::Glider), Ability::SpeciesMovement => None, - // TODO: add aux abilities to gliders in the future? Ability::MainWeaponAux(_) | Ability::OffWeaponAux(_) => None, + Ability::GliderAux(_) => inst_ability(EquipSlot::Glider), Ability::Empty => None, }, AbilitySource::Weapons => match self.ability { @@ -579,6 +591,7 @@ impl SpecifiedAbility { Ability::SpeciesMovement => None, // TODO: Make not None Ability::MainWeaponAux(_) => inst_ability(EquipSlot::ActiveMainhand), Ability::OffWeaponAux(_) => inst_ability(EquipSlot::ActiveOffhand), + Ability::GliderAux(_) => None, Ability::Empty => None, }, } @@ -634,6 +647,7 @@ impl From for Ability { pub enum AuxiliaryAbility { MainWeapon(usize), OffWeapon(usize), + Glider(usize), Empty, } @@ -642,6 +656,7 @@ impl From for Ability { match primary { AuxiliaryAbility::MainWeapon(i) => Ability::MainWeaponAux(i), AuxiliaryAbility::OffWeapon(i) => Ability::OffWeaponAux(i), + AuxiliaryAbility::Glider(i) => Ability::GliderAux(i), AuxiliaryAbility::Empty => Ability::Empty, } } diff --git a/server/src/persistence/json_models.rs b/server/src/persistence/json_models.rs index 59706f7d43..9b7d068611 100644 --- a/server/src/persistence/json_models.rs +++ b/server/src/persistence/json_models.rs @@ -127,6 +127,7 @@ fn aux_ability_to_string(ability: comp::ability::AuxiliaryAbility) -> String { match ability { AuxiliaryAbility::MainWeapon(index) => format!("Main Weapon:index:{}", index), AuxiliaryAbility::OffWeapon(index) => format!("Off Weapon:index:{}", index), + AuxiliaryAbility::Glider(index) => format!("Glider:index:{}", index), AuxiliaryAbility::Empty => String::from("Empty"), } } @@ -177,6 +178,27 @@ fn aux_ability_from_string(ability: &str) -> comp::ability::AuxiliaryAbility { AuxiliaryAbility::Empty }, }, + Some("Glider") => match parts + .next() + .map(|index| index.parse::().map_err(|_| index)) + { + Some(Ok(index)) => AuxiliaryAbility::Glider(index), + Some(Err(error)) => { + dev_panic!(format!( + "Conversion from database to ability set failed. Unable to parse index for \ + offhand abilities: {}", + error + )); + AuxiliaryAbility::Empty + }, + None => { + dev_panic!(String::from( + "Conversion from database to ability set failed. Unable to find an index for \ + offhand abilities" + )); + AuxiliaryAbility::Empty + }, + }, Some("Empty") => AuxiliaryAbility::Empty, unknown => { dev_panic!(format!(