Refactor machines.lua (reduced ~300 lines of code)

This commit is contained in:
mrkubax10 2023-04-07 19:50:39 +02:00
parent dbb83ba6e3
commit 40d0e578c4
3 changed files with 523 additions and 600 deletions

View File

@ -249,7 +249,7 @@ industrialtest.api.powerFlow=function(pos)
if def then if def then
local updateFormspec=def._industrialtest_updateFormspec local updateFormspec=def._industrialtest_updateFormspec
if updateFormspec then if updateFormspec then
updateFormspec(value) updateFormspec(neighbourPositions[key])
end end
local onPowerFlow=def._industrialtest_onPowerFlow local onPowerFlow=def._industrialtest_onPowerFlow
if onPowerFlow and transferred then if onPowerFlow and transferred then

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,7 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
meta:set_string("industrialtest.powerIOConfig",fields.powerIOConfig) meta:set_string("industrialtest.powerIOConfig",fields.powerIOConfig)
local def=minetest.registered_nodes[minetest.get_node(context).name] local def=minetest.registered_nodes[minetest.get_node(context).name]
if def and def._industrialtest_updateFormspec then if def and def._industrialtest_updateFormspec then
def._industrialtest_updateFormspec(meta) def._industrialtest_updateFormspec(context)
end end
minetest.close_formspec(player:get_player_name(),formname) minetest.close_formspec(player:get_player_name(),formname)
elseif fields.triggerNeighbours then elseif fields.triggerNeighbours then