summaryrefslogtreecommitdiffstats
path: root/src/game/client/factory.cc
blob: 4c1c24ec9d31a4dbd3bfeba0ce056a9f9cf232a4 (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
28
#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);
    }
}