diff --git a/src/entity.cpp b/src/entity.cpp index 64f9f0d..71c0a25 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -7,7 +7,6 @@ #include "rect.hpp" #include "resourcemanager.hpp" #include "soundmanager.hpp" -#include using namespace framework; @@ -156,6 +155,12 @@ void entity::set_action(const std::string_view action) noexcept { _props.action = action; } +void entity::unset_action() noexcept { + _props.action = std::string(); + _props.frame = 0; + _props.last_frame = 0; +} + std::string entity::action() const noexcept { return _props.action; } diff --git a/src/entity.hpp b/src/entity.hpp index 3332222..fa02d39 100644 --- a/src/entity.hpp +++ b/src/entity.hpp @@ -52,6 +52,8 @@ class entity : public std::enable_shared_from_this { void set_action(const std::string_view action) noexcept; + void unset_action() noexcept; + std::string action() const noexcept; void set_visible(bool visible) noexcept; diff --git a/src/scriptengine.cpp b/src/scriptengine.cpp index 3f65f8d..9642903 100644 --- a/src/scriptengine.cpp +++ b/src/scriptengine.cpp @@ -126,6 +126,7 @@ void scriptengine::run() { "on_mail", &entity::set_onmail, "set_flip", &entity::set_flip, "set_action", &entity::set_action, + "unset_action", &entity::unset_action, "set_velocity", &entity::set_velocity, "set_placement", &entity::set_placement);