Ability pool updates after switching weapons now.

This commit is contained in:
Sam 2021-11-09 19:51:06 -05:00
parent a8bec0280c
commit d33ff9f17e
2 changed files with 17 additions and 0 deletions

View File

@ -34,6 +34,10 @@ pub const MAX_ABILITIES: usize = 5;
// essentially require custom enum that are only used for those (except maybe
// dodge if we make movement and have potentially differ based off of armor) but
// would also allow logic to be a bit more centralized
// TODO: Potentially look into storing previous ability sets for weapon
// combinations and automatically reverting back to them on switching to that
// set of weapons. Consider after UI is set up and people weigh in on memory
// considerations.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AbilityPool {
primary: Ability,

View File

@ -767,6 +767,19 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
// manipulating the inventory mutated the trade, so reset the accept flags
trades.implicit_mutation_occurred(&uid);
}
// After any inventory manipulation, update the ability
// TODO: Make less hacky, probably remove entirely but needs UI
if let Some(mut ability_pool) = state
.ecs()
.write_storage::<comp::AbilityPool>()
.get_mut(entity)
{
ability_pool.auto_update(
state.ecs().read_storage::<comp::Inventory>().get(entity),
state.ecs().read_storage::<comp::SkillSet>().get(entity),
);
}
}
fn within_pickup_range<S: FindDist<find_dist::Cylinder>>(