mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add entity events: on_aim_on, on_aim_off
This commit is contained in:
parent
54902d7f49
commit
a36ffaacd9
3 changed files with 31 additions and 0 deletions
|
|
@ -346,6 +346,8 @@ void scripting::on_entity_spawn(
|
|||
funcsset.on_sensor_enter = lua::hasfield(L, "on_sensor_enter");
|
||||
funcsset.on_sensor_exit = lua::hasfield(L, "on_sensor_exit");
|
||||
funcsset.on_save = lua::hasfield(L, "on_save");
|
||||
funcsset.on_aim_on = lua::hasfield(L, "on_aim_on");
|
||||
funcsset.on_aim_off = lua::hasfield(L, "on_aim_off");
|
||||
lua::pop(L, 2);
|
||||
|
||||
component->env = compenv;
|
||||
|
|
@ -423,6 +425,20 @@ void scripting::on_sensor_exit(const Entity& entity, size_t index, entityid_t oi
|
|||
});
|
||||
}
|
||||
|
||||
void scripting::on_aim_on(const Entity& entity, Player* player) {
|
||||
process_entity_callback(entity, "on_aim_on",
|
||||
&entity_funcs_set::on_aim_on, [player](auto L) {
|
||||
return lua::pushinteger(L, player->getId());
|
||||
});
|
||||
}
|
||||
|
||||
void scripting::on_aim_off(const Entity& entity, Player* player) {
|
||||
process_entity_callback(entity, "on_aim_off",
|
||||
&entity_funcs_set::on_aim_off, [player](auto L) {
|
||||
return lua::pushinteger(L, player->getId());
|
||||
});
|
||||
}
|
||||
|
||||
void scripting::on_entities_update() {
|
||||
auto L = lua::get_main_thread();
|
||||
lua::get_from(L, STDCOMP, "update", true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue