-
-
Notifications
You must be signed in to change notification settings - Fork 260
Open
Labels
c: registerRegister classes, functions and other symbols to GDScriptRegister classes, functions and other symbols to GDScriptfeatureAdds functionality to the libraryAdds functionality to the library
Description
Edit bromeon: rust code tags + rustfmt
I want to implement a system to choose a skill from a pool.
My current approach was defining a trait called and then implement it in different ways (e.g. one implementation for the AI and another one for the player - linked to UI)
pub(crate) trait SkillChooser {
fn choose(
&mut self,
skill_pool: &Gd<SkillContainerModule>,
target: &Gd<BattleEntity>,
) -> DynGd<Node, dyn SkillImplementation>;
}The issue is that to link it to the UI, I would need to make this async. I can emit a signal once a skill is chosen. Something like:
pub(crate) trait SkillChooser {
fn choose(&mut self, skill_pool: &Gd<SkillContainerModule>, target: &Gd<BattleEntity>);
#[signal]
fn skill_chosen(skill: DynGd<Node, dyn SkillImplementation>);
}However, I cannot declare a signal inside a trait (because I cannot annotate it with #[godot_api]).
I don't know if it is feasible or not to have this feature but I wanted to raise this just in case it is a valid request.
Thank you
Metadata
Metadata
Assignees
Labels
c: registerRegister classes, functions and other symbols to GDScriptRegister classes, functions and other symbols to GDScriptfeatureAdds functionality to the libraryAdds functionality to the library