mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add on_player_set entity component event
This commit is contained in:
parent
8d7fab1f2f
commit
e4a11f182e
9 changed files with 29 additions and 15 deletions
|
|
@ -113,6 +113,11 @@ int64_t Entity::getPlayer() const {
|
|||
}
|
||||
|
||||
void Entity::setPlayer(int64_t id) {
|
||||
registry.get<EntityId>(entity).player = id;
|
||||
auto& eid = registry.get<EntityId>(entity);
|
||||
if (eid.player == id) {
|
||||
return;
|
||||
}
|
||||
eid.player = id;
|
||||
scripting::on_entity_player_set(*this, id);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue