1
0
mirror of https://github.com/Sokomine/replacer.git synced 2025-07-04 17:10:44 +02:00

remove prevention of selecting items not_in_creative due to breaking stairsplus support. Add group not_in_replacer.

This commit is contained in:
kakalak-lumberjack
2023-05-28 08:23:28 -04:00
parent 5b4240b0f9
commit 6dde3122f5

View File

@ -114,7 +114,7 @@ replacer.set_replacement_node = function(itemstack, user, pointed_thing)
node_name = replacer.conversions[node_name]
end
if minetest.get_node_group(node_name, "not_in_creative_inventory") ~= 0 then
if minetest.get_node_group(node_name, "not_in_replacer") ~= 0 then
return replacer.set_hud(name, "Error: " .. node_name .. " cannot be selected")
end
metadata = node_name..' '..node.param1..' '..node.param2;
@ -300,6 +300,34 @@ replacer.node_is_owned = function(pos, placer)
end
end
-- Handle taking item from inventory or unified inventory bags
local function get_player_bag_stack(player, i)
return minetest.get_inventory({
type = "detached",
name = user:get_player_name() .. "_bags"
}):get_stack("bag" .. i, 1)
end
replacer.remove_from_inventory = function()
local inv = user:get_inventory()
for i = 1, 4 do
local def = get_player_bag_stack(player, i):get_definition()
if def.groups.bagslots then
local list_name = "bag" .. i .. "contents"
local size = inv:get_size(list_name)
for si = 1, size do
local stk = inv:get_stack(list_name, si)
if not stk:is_empty() then
minetest.chat_send_all(stk:to_string())
end
end
end
end
end
-- Handle mode setting/getting
replacer.set_mode = function(player, mode_name)
if mode_name ~= "legacy" and mode_name ~= "paint" then