summaryrefslogtreecommitdiffstats
path: root/game/client/factory.cc
blob: 5eca00cde75ed5a771c5e1d428450836b9bc2748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "client/pch.hh"
#include "client/factory.hh"

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

#include "client/globals.hh"
#include "client/sound_emitter.hh"

void client_factory::create_player(Dimension *dimension, entt::entity entity)
{
    shared_factory::create_player(dimension, entity);

    const auto &head = dimension->entities.get<HeadComponent>(entity);
    dimension->entities.emplace_or_replace<HeadComponentIntr>(entity, head);
    dimension->entities.emplace_or_replace<HeadComponentPrev>(entity, head);

    const auto &transform = dimension->entities.get<TransformComponent>(entity);
    dimension->entities.emplace_or_replace<TransformComponentIntr>(entity, transform);
    dimension->entities.emplace_or_replace<TransformComponentPrev>(entity, transform);

    if(globals::sound_ctx) {
        dimension->entities.emplace_or_replace<SoundEmitterComponent>(entity);
    }
}