feat: added revolver

This commit is contained in:
Sara 2025-07-31 21:47:59 +02:00
parent 3b22cd86f7
commit 6eba3b0454
17 changed files with 195 additions and 29 deletions

View file

@ -13,9 +13,6 @@ void WeaponBase::ready() {
this->input = cast_to<PlayerInput>(get_parent()->get_node(NodePath("%PlayerInput")));
this->camera = cast_to<PlayerCamera>(get_parent());
this->body = cast_to<PlayerBody>(get_parent()->get_owner());
if (this->anim) {
this->anim->play("RESET");
}
}
void WeaponBase::_notification(int what) {
@ -30,6 +27,20 @@ void WeaponBase::_notification(int what) {
}
}
PackedStringArray WeaponBase::get_configuration_warnings() const {
PackedStringArray warnings{ super_type::get_configuration_warnings() };
if (this->anim == nullptr) {
warnings.push_back("Weapons need something to animate them.\nRemember to configure the 'anim' property on this weapon");
}
return warnings;
}
bool WeaponBase::is_animating() const {
return !get_anim()->get_current_animation().is_empty() || !get_anim()->get_queue().is_empty();
}
void WeaponBase::set_anim(AnimationPlayer *anim) {
this->anim = anim;
}