1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add min_y and max_y checks for Active Block Modifiers (ABM) (#11333)

This check can be used by ABM to reduce CPU usage.
This commit is contained in:
sfence 2021-06-20 17:21:35 +02:00 committed by GitHub
parent 1805775f3d
commit b10091be9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 3 deletions

View file

@ -150,13 +150,19 @@ void ScriptApiEnv::initializeEnvironment(ServerEnvironment *env)
bool simple_catch_up = true;
getboolfield(L, current_abm, "catch_up", simple_catch_up);
s16 min_y = INT16_MIN;
getintfield(L, current_abm, "min_y", min_y);
s16 max_y = INT16_MAX;
getintfield(L, current_abm, "max_y", max_y);
lua_getfield(L, current_abm, "action");
luaL_checktype(L, current_abm + 1, LUA_TFUNCTION);
lua_pop(L, 1);
LuaABM *abm = new LuaABM(L, id, trigger_contents, required_neighbors,
trigger_interval, trigger_chance, simple_catch_up);
trigger_interval, trigger_chance, simple_catch_up, min_y, max_y);
env->addActiveBlockModifier(abm);