summaryrefslogtreecommitdiffhomepage
path: root/src/critter-script-walk.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-03 18:42:09 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-05 03:16:22 +0200
commite5a80257216d76f5033b4120f348f309ca7764f1 (patch)
tree6544f3ada808214beb7915704f317aba98966e88 /src/critter-script-walk.cpp
parentba91cb1393274072721e1c31db0c7f73dc9c9db7 (diff)
a wip
Diffstat (limited to 'src/critter-script-walk.cpp')
-rw-r--r--src/critter-script-walk.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/critter-script-walk.cpp b/src/critter-script-walk.cpp
new file mode 100644
index 00000000..9c92798c
--- /dev/null
+++ b/src/critter-script-walk.cpp
@@ -0,0 +1,62 @@
+#include "critter-script.hpp"
+//#include "raycast.hpp"
+#include "point.hpp"
+#include "critter.hpp"
+#include "search-result.hpp"
+#include "search-astar.hpp"
+#include "entity/name-of.hpp"
+
+namespace floormat {
+
+namespace {
+
+enum class walk_mode : uint8_t
+{
+ none, line, path,
+};
+
+struct walk_script final : critter_script
+{
+ const void* type_id() const override;
+ void on_init(const std::shared_ptr<critter>& c) override;
+ void on_update(const std::shared_ptr<critter>& c, size_t& i, const Ns& dt) override;
+ void on_destroy(const std::shared_ptr<critter>& c, script_destroy_reason reason) override;
+ void delete_self() noexcept override;
+
+ point to;
+ path_search_result path;
+ walk_mode mode = walk_mode::none;
+};
+
+constexpr StringView script_name = name_of<walk_script>;
+
+const void* walk_script::type_id() const
+{
+ return &script_name;
+}
+
+void walk_script::on_init(const std::shared_ptr<critter>& c)
+{
+}
+
+void walk_script::on_update(const std::shared_ptr<critter>& c, size_t& i, const Ns& dt)
+{
+}
+
+void walk_script::on_destroy(const std::shared_ptr<critter>& c, script_destroy_reason reason)
+{
+}
+
+void walk_script::delete_self() noexcept
+{
+ delete this;
+}
+
+} // namespace
+
+critter_script* critter_script::make_walk_script(point to, path_search_result path)
+{
+ return new walk_script{};
+}
+
+} // namespace floormat