mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2025-07-23 15:40:18 +02:00
switch to colored itemstacks
with full crafting recipes (requires Unified Dyes commit 2a816534 or later) known issues: standing lamp bypasses vertical stack check bed expansion changes the color of the first-placed bed to match the second when creating a king bed.
This commit is contained in:
@ -211,22 +211,21 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks
|
||||
local rightnode = minetest.get_node(rightpos)
|
||||
|
||||
local inv = placer:get_inventory()
|
||||
local lastdye = unifieddyes.last_used_dye[placer_name]
|
||||
|
||||
if leftnode.name == "homedecor:bed_regular" then
|
||||
local newname = string.gsub(thisnode.name, "_regular", "_kingsize")
|
||||
local meta = minetest.get_meta(leftpos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local leftmeta = minetest.get_meta(leftpos)
|
||||
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
minetest.set_node(leftpos, { name = newname, param2 = param2})
|
||||
meta:set_string("dye", lastdye)
|
||||
inv:add_item("main", lastdye)
|
||||
minetest.swap_node(leftpos, { name = newname, param2 = param2})
|
||||
elseif rightnode.name == "homedecor:bed_regular" then
|
||||
local newname = string.gsub(thisnode.name, "_regular", "_kingsize")
|
||||
local meta = minetest.get_meta(rightpos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local rightmeta = minetest.get_meta(rightpos)
|
||||
|
||||
minetest.set_node(rightpos, {name = "air"})
|
||||
minetest.set_node(pos, { name = newname, param2 = param2})
|
||||
meta:set_string("dye", lastdye)
|
||||
inv:add_item("main", lastdye)
|
||||
minetest.swap_node(pos, { name = newname, param2 = param2})
|
||||
end
|
||||
|
||||
local toppos = {x=pos.x, y=pos.y+1.0, z=pos.z}
|
||||
@ -235,14 +234,7 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks
|
||||
if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then
|
||||
local newname = string.gsub(thisnode.name, "_regular", "_extended")
|
||||
local newparam2 = param2 % 8
|
||||
if inv:contains_item("main", lastdye) then
|
||||
minetest.set_node(toppos, { name = thisnode.name, param2 = param2})
|
||||
if lastdye then inv:remove_item("main", lastdye.." 1") end
|
||||
else
|
||||
minetest.set_node(toppos, { name = thisnode.name, param2 = newparam2})
|
||||
minetest.chat_send_player(placer_name, "Ran out of "..lastdye..", using neutral color.")
|
||||
unifieddyes.last_used_dye[placer_name] = nil
|
||||
end
|
||||
minetest.swap_node(toppos, { name = thisnode.name, param2 = param2})
|
||||
minetest.swap_node(pos, { name = newname, param2 = param2})
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
Reference in New Issue
Block a user