mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add entity event: on_grounded
This commit is contained in:
parent
eb2be5e8b6
commit
e0e5faa4a8
7 changed files with 24 additions and 6 deletions
|
|
@ -243,6 +243,14 @@ bool scripting::on_entity_despawn(const EntityDef& def, entityid_t eid) {
|
|||
});
|
||||
}
|
||||
|
||||
bool scripting::on_entity_grounded(const EntityDef& def, entityid_t eid) {
|
||||
std::string name = def.name + ".grounded";
|
||||
return lua::emit_event(lua::get_main_thread(), name, [eid] (auto L) {
|
||||
lua::pushinteger(L, eid);
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
void scripting::on_ui_open(
|
||||
UiDocument* layout,
|
||||
std::vector<dynamic::Value> args
|
||||
|
|
@ -332,6 +340,7 @@ void scripting::load_entity_script(const scriptenv& senv, const std::string& pre
|
|||
funcsset.init = register_event(env, "init", prefix+".init");
|
||||
funcsset.on_spawn = register_event(env, "on_spawn", prefix+".spawn");
|
||||
funcsset.on_despawn = register_event(env, "on_despawn", prefix+".despawn");
|
||||
funcsset.on_grounded = register_event(env, "on_grounded", prefix+".grounded");
|
||||
}
|
||||
|
||||
void scripting::load_world_script(const scriptenv& senv, const std::string& prefix, const fs::path& file) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue