add 'on_block_removed' event
This commit is contained in:
@@ -119,6 +119,7 @@ static int l_close_world(lua::State* L) {
|
||||
if (controller == nullptr) {
|
||||
throw std::runtime_error("no world open");
|
||||
}
|
||||
controller->processBeforeQuit();
|
||||
bool save_world = lua::toboolean(L, 1);
|
||||
if (save_world) {
|
||||
controller->saveWorld();
|
||||
|
||||
@@ -341,6 +341,13 @@ void scripting::on_world_save() {
|
||||
}
|
||||
}
|
||||
|
||||
void scripting::process_before_quit() {
|
||||
auto L = lua::get_main_state();
|
||||
if (lua::getglobal(L, "__vc_process_before_quit")) {
|
||||
lua::call_nothrow(L, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void scripting::on_world_quit() {
|
||||
auto L = lua::get_main_state();
|
||||
for (auto& pack : content_control->getAllContentPacks()) {
|
||||
@@ -677,6 +684,8 @@ void scripting::load_content_script(
|
||||
register_event(env, "on_blocks_tick", prefix + ".blockstick");
|
||||
funcsset.onblockpresent =
|
||||
register_event(env, "on_block_present", prefix + ".blockpresent");
|
||||
funcsset.onblockremoved =
|
||||
register_event(env, "on_block_removed", prefix + ".blockremoved");
|
||||
}
|
||||
|
||||
void scripting::load_content_script(
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace scripting {
|
||||
void on_world_load(LevelController* controller);
|
||||
void on_world_tick(int tps);
|
||||
void on_world_save();
|
||||
void process_before_quit();
|
||||
void on_world_quit();
|
||||
void cleanup(const std::vector<std::string>& nonReset);
|
||||
void on_blocks_tick(const Block& block, int tps);
|
||||
|
||||
Reference in New Issue
Block a user