mirror of
https://github.com/tacigar/maidroid.git
synced 2025-01-10 08:10:17 +01:00
remove unused parameters and variables
M maidroid_tool/api.lua
This commit is contained in:
parent
25f3bbaba5
commit
a5e36b9c50
@ -16,12 +16,12 @@ function maidroid_tool.register_writer(nodename, options)
|
|||||||
local on_deactivate = options.on_deactivate
|
local on_deactivate = options.on_deactivate
|
||||||
local empty_itemname = options.empty_itemname
|
local empty_itemname = options.empty_itemname
|
||||||
local dye_item_map = options.dye_item_map
|
local dye_item_map = options.dye_item_map
|
||||||
local is_mainitem = options.is_mainitem
|
--~ local is_mainitem = options.is_mainitem
|
||||||
local on_metadata_inventory_put_to_main = options.on_metadata_inventory_put_to_main
|
local on_metadata_inventory_put_to_main = options.on_metadata_inventory_put_to_main
|
||||||
local on_metadata_inventory_take_from_main = options.on_metadata_inventory_take_from_main
|
local on_metadata_inventory_take_from_main = options.on_metadata_inventory_take_from_main
|
||||||
|
|
||||||
-- can_dig is a common callback.
|
-- can_dig is a common callback.
|
||||||
local function can_dig(pos, player)
|
local function can_dig(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inventory = meta:get_inventory()
|
local inventory = meta:get_inventory()
|
||||||
return (
|
return (
|
||||||
@ -39,7 +39,7 @@ function maidroid_tool.register_writer(nodename, options)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- on_timer is a common callback.
|
-- on_timer is a common callback.
|
||||||
local function on_timer(pos, elapsed)
|
local function on_timer(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inventory = meta:get_inventory()
|
local inventory = meta:get_inventory()
|
||||||
local main_list = inventory:get_list("main")
|
local main_list = inventory:get_list("main")
|
||||||
@ -94,9 +94,7 @@ function maidroid_tool.register_writer(nodename, options)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- allow_metadata_inventory_put is a common callback.
|
-- allow_metadata_inventory_put is a common callback.
|
||||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
local function allow_metadata_inventory_put(_, listname, _, stack)
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inventory = meta:get_inventory()
|
|
||||||
local itemname = stack:get_name()
|
local itemname = stack:get_name()
|
||||||
|
|
||||||
if (listname == "fuel" and itemname == "default:coal_lump") then
|
if (listname == "fuel" and itemname == "default:coal_lump") then
|
||||||
@ -110,7 +108,7 @@ function maidroid_tool.register_writer(nodename, options)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- allow_metadata_inventory_move is a common callback for the node.
|
-- allow_metadata_inventory_move is a common callback for the node.
|
||||||
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
local function allow_metadata_inventory_move(pos, from_list, from_index, _, to_index, _, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inventory = meta:get_inventory()
|
local inventory = meta:get_inventory()
|
||||||
local stack = inventory:get_stack(from_list, from_index)
|
local stack = inventory:get_stack(from_list, from_index)
|
||||||
@ -130,11 +128,10 @@ function maidroid_tool.register_writer(nodename, options)
|
|||||||
inventory:set_size("dye", 1)
|
inventory:set_size("dye", 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_metadata_inventory_put(pos, listname, index, stack, player)
|
local function on_metadata_inventory_put(pos, listname)
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
timer:start(0.25)
|
timer:start(0.25)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
if listname == "main" then
|
if listname == "main" then
|
||||||
if on_metadata_inventory_put_to_main ~= nil then
|
if on_metadata_inventory_put_to_main ~= nil then
|
||||||
on_metadata_inventory_put_to_main(pos) -- call on_metadata_inventory_put_to_main callback.
|
on_metadata_inventory_put_to_main(pos) -- call on_metadata_inventory_put_to_main callback.
|
||||||
@ -142,15 +139,16 @@ function maidroid_tool.register_writer(nodename, options)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
local function on_metadata_inventory_move(pos, from_list, from_index, _, to_index, _, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inventory = meta:get_inventory()
|
local inventory = meta:get_inventory()
|
||||||
local stack = inventory:get_stack(from_list, from_index)
|
local stack = inventory:get_stack(from_list, from_index)
|
||||||
|
|
||||||
|
-- listname is not set here, is it? ~Hybrid Dog
|
||||||
on_metadata_inventory_put(pos, listname, to_index, stack, player)
|
on_metadata_inventory_put(pos, listname, to_index, stack, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_metadata_inventory_take(pos, listname, index, stack, player)
|
local function on_metadata_inventory_take(pos, listname)
|
||||||
if listname == "main" then
|
if listname == "main" then
|
||||||
if on_metadata_inventory_take_from_main ~= nil then
|
if on_metadata_inventory_take_from_main ~= nil then
|
||||||
on_metadata_inventory_take_from_main(pos) -- call on_metadata_inventory_take_from_main callback.
|
on_metadata_inventory_take_from_main(pos) -- call on_metadata_inventory_take_from_main callback.
|
||||||
@ -158,7 +156,7 @@ function maidroid_tool.register_writer(nodename, options)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
|
local function allow_metadata_inventory_take(_,_,_, stack)
|
||||||
return stack:get_count() -- maybe add more.
|
return stack:get_count() -- maybe add more.
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -187,7 +185,7 @@ function maidroid_tool.register_writer(nodename, options)
|
|||||||
end -- end register inactive node.
|
end -- end register inactive node.
|
||||||
|
|
||||||
do -- register a definition of an active node.
|
do -- register a definition of an active node.
|
||||||
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
|
local function allow_metadata_inventory_take(_, listname, _, stack)
|
||||||
if listname == "main" then
|
if listname == "main" then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user