1
0
mirror of https://github.com/tacigar/maidroid.git synced 2024-11-10 12:10:28 +01:00

[UPDATE] Update inactive core writer callbasks (allow)

This commit is contained in:
tacigar 2016-09-14 19:22:44 +09:00
parent 99fd18ec0d
commit b614a24d23
2 changed files with 28 additions and 12 deletions

View File

@ -17,18 +17,6 @@
},
};
function allow_metadata_inventory_put(pos, listname, index, stack, player)
end
function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
end
function allow_metadata_inventory_take(pos, listname, index, stack, player)
end
(function() -- register a definition of an inactive core writer.
local tiles = {
"maidroid_tool_core_writer_top.png",
@ -57,6 +45,33 @@
end
function allow_metadata_inventory_put(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
local inventory = meta:get_inventory()
local itemname = stack:get_name()
if (listname == "fuel" and itemname == "default:coal_lump") then
return stack:get_count()
elseif listname == "dye" and minetest.get_item_group(itemname, "dye") > 0 then
return stack:get_count()
else if listname == "core" and maidroid.is_core(itemname then
return stack:get_count()
end
return 0
end
function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
local inventory = meta:get_inventory()
local stack = inventory:get_stack(from_list, from_index)
return allow_metadata_inventory_put(pos, listname, to_index, stack, player)
end
function allow_metadata_inventory_take(pos, listname, index, stack, player)
return stack:get_count() -- maybe add more.
end
minetest.register_node("maidroid_tool:core_writer", {
description = "maidroid tool : core writer",
drawtype = "nodebox",

View File

@ -1,3 +1,4 @@
default
dye
maidroid
maidroid_core