summaryrefslogtreecommitdiffstats
path: root/game/shared/stasis.cc
blob: 4e474aff8c3fca233a7bd3d1b7a8f5d869ee87ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "shared/pch.hh"
#include "shared/stasis.hh"

#include "shared/dimension.hh"
#include "shared/transform.hh"

void StasisComponent::fixed_update(Dimension *dimension)
{
    auto view = dimension->entities.view<TransformComponent>();

    for(auto [entity, transform] : view.each()) {
        if(dimension->find_chunk(transform.chunk))
            dimension->entities.remove<StasisComponent>(entity);
        else dimension->entities.emplace_or_replace<StasisComponent>(entity);
    }
}