summaryrefslogtreecommitdiffstats
path: root/game/client/entity/factory.cc
blob: 708dc65a62d29575c6d78dccc50fc5a2a487a94c (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
29
#include "client/pch.hh"

#include "client/entity/factory.hh"

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

#include "client/entity/sound_emitter.hh"

#include "client/globals.hh"

void entity::client::create_player(world::Dimension* dimension, entt::entity entity)
{
    entity::shared::create_player(dimension, entity);

    const auto& head = dimension->entities.get<entity::Head>(entity);
    dimension->entities.emplace_or_replace<entity::client::HeadIntr>(entity, head);
    dimension->entities.emplace_or_replace<entity::client::HeadPrev>(entity, head);

    const auto& transform = dimension->entities.get<entity::Transform>(entity);
    dimension->entities.emplace_or_replace<entity::client::TransformIntr>(entity, transform);
    dimension->entities.emplace_or_replace<entity::client::TransformPrev>(entity, transform);

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