mirror of
https://github.com/appgurueu/modlib.git
synced 2024-08-20 13:24:11 +02:00
Code cleanup
This commit is contained in:
parent
f1aa7f5a98
commit
f2c79ca258
@ -1,11 +1,13 @@
|
|||||||
-- Localize globals
|
-- Localize globals
|
||||||
local assert, minetest, modlib, next, pairs, string, table, type = assert, minetest, modlib, next, pairs, string, table, type
|
local assert, minetest, modlib, next, pairs, string, table, type
|
||||||
|
= assert, minetest, modlib, next, pairs, string, table, type
|
||||||
|
|
||||||
-- Set environment
|
-- Set environment
|
||||||
local _ENV = ...
|
local _ENV = ...
|
||||||
setfenv(1, _ENV)
|
setfenv(1, _ENV)
|
||||||
|
|
||||||
max_wear = 2 ^ 16 - 1
|
max_wear = 2 ^ 16 - 1
|
||||||
|
|
||||||
function override(function_name, function_builder)
|
function override(function_name, function_builder)
|
||||||
local func = minetest[function_name]
|
local func = minetest[function_name]
|
||||||
minetest["original_" .. function_name] = func
|
minetest["original_" .. function_name] = func
|
||||||
@ -35,13 +37,9 @@ function register_form_listener(formname, func)
|
|||||||
form_listeners[formname] = current_listeners
|
form_listeners[formname] = current_listeners
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local icall = modlib.table.icall
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local handlers = form_listeners[formname]
|
icall(form_listeners[formname] or {})
|
||||||
if handlers then
|
|
||||||
for _, handler in pairs(handlers) do
|
|
||||||
handler(player, fields)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function texture_modifier_inventorycube(face_1, face_2, face_3)
|
function texture_modifier_inventorycube(face_1, face_2, face_3)
|
||||||
|
Loading…
Reference in New Issue
Block a user