summaryrefslogtreecommitdiffhomepage
path: root/editor/scenery-editor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-02 16:34:05 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-02 22:35:39 +0200
commit6abcd7d52cda334c58ec999d212491fc24f13c9d (patch)
tree86998508afe8eb7447ad70a2d5beebdbc9995a8f /editor/scenery-editor.cpp
parent03b67a512ec9ef1cf5c337aa5c47a5a76d4a8a61 (diff)
script lifecycle mostly implemented
Diffstat (limited to 'editor/scenery-editor.cpp')
-rw-r--r--editor/scenery-editor.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/editor/scenery-editor.cpp b/editor/scenery-editor.cpp
index 55e194bf..b472fca5 100644
--- a/editor/scenery-editor.cpp
+++ b/editor/scenery-editor.cpp
@@ -5,6 +5,8 @@
#include "src/RTree-search.hpp"
#include "src/rotation.inl"
#include "app.hpp"
+#include "src/scenery.hpp"
+
#include <Magnum/Math/Range.h>
namespace floormat {
@@ -94,8 +96,9 @@ start:
for (auto i = 0uz; i < sz; i++)
if (const auto eʹ = es[i]; eʹ->id == id)
{
- //eʹ->on_destroy(eʹ, false);
+ eʹ->destroy_script_pre(eʹ, script_destroy_reason::kill);
c.remove_object(i);
+ eʹ->destroy_script_post();
goto start;
}
break;
@@ -103,8 +106,8 @@ start:
}
else
{
- // todo check collision at pos
- w.make_scenery(w.make_id(), pos, scenery_proto(s.proto));
+ auto sc = w.make_scenery(w.make_id(), pos, scenery_proto(s.proto));
+ sc->init_script(sc);
}
}