summaryrefslogtreecommitdiffstats
path: root/game/shared/entity/stasis.cc
blob: 10e2e0c72cb5cf8026fb5fa1b301038370bfd8e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
        }
    }
}