Improve ability trait
This commit is contained in:
parent
47e732377b
commit
1087e66617
2 changed files with 5 additions and 3 deletions
|
@ -21,7 +21,7 @@ use super::{
|
|||
};
|
||||
|
||||
pub trait Ability: Send + Sync + Clone + Default {
|
||||
fn create(context: &Context, asset_path: impl Into<AssetPath>) -> Result<Self>;
|
||||
fn create(world: &mut World, asset_path: impl Into<AssetPath>) -> Result<Self>;
|
||||
|
||||
fn name(&self) -> &str;
|
||||
fn icon_path(&self) -> &AssetPath;
|
||||
|
|
|
@ -53,7 +53,7 @@ pub struct ItemSystem<A: Ability> {
|
|||
|
||||
impl<A: Ability> ItemSystem<A> {
|
||||
pub fn new(
|
||||
context: &Context,
|
||||
world: &mut World,
|
||||
item_settings: &ItemSettings,
|
||||
ability_settings: &AbilitySettings,
|
||||
attribute_settings: &AttributeSettings,
|
||||
|
@ -64,9 +64,11 @@ impl<A: Ability> ItemSystem<A> {
|
|||
|
||||
let abilities = search_dir_recursively(&ability_directory.full_path(), ".abil")?
|
||||
.into_iter()
|
||||
.map(|path| A::create(context, path))
|
||||
.map(|path| A::create(world, path))
|
||||
.collect::<Result<Vec<A>>>()?;
|
||||
|
||||
let context = world.resources.get::<Context>();
|
||||
|
||||
let (
|
||||
item_icon_combinations,
|
||||
ability_icon_combinations,
|
||||
|
|
Loading…
Reference in a new issue