summaryrefslogtreecommitdiffstats
path: root/game/shared/entity/stasis.cc
diff options
context:
space:
mode:
Diffstat (limited to 'game/shared/entity/stasis.cc')
-rw-r--r--game/shared/entity/stasis.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/game/shared/entity/stasis.cc b/game/shared/entity/stasis.cc
new file mode 100644
index 0000000..10e2e0c
--- /dev/null
+++ b/game/shared/entity/stasis.cc
@@ -0,0 +1,19 @@
+#include "shared/pch.hh"
+
+#include "shared/entity/stasis.hh"
+
+#include "shared/entity/transform.hh"
+#include "shared/world/dimension.hh"
+
+void entity::Stasis::fixed_update(world::Dimension* dimension)
+{
+ auto view = dimension->entities.view<entity::Transform>();
+
+ for(auto [entity, transform] : view.each()) {
+ if(dimension->find_chunk(transform.chunk)) {
+ dimension->entities.remove<entity::Stasis>(entity);
+ } else {
+ dimension->entities.emplace_or_replace<entity::Stasis>(entity);
+ }
+ }
+}