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:
parent
1805775f3d
commit
b10091be9b
6 changed files with 41 additions and 3 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue