diff --git a/handlers/animations.lua b/handlers/animations.lua index 6c240b4..2849667 100755 --- a/handlers/animations.lua +++ b/handlers/animations.lua @@ -18,7 +18,7 @@ function xdecor.sit(pos, node, clicker, pointed_thing) if default.player_attached[player_name] then pos.y = pos.y - 0.5 - clicker:setpos(pos) + clicker:set_pos(pos) clicker:set_eye_offset(vector.new(), vector.new()) clicker:set_physics_override({speed = 1, jump = 1, gravity = 1}) default.player_attached[player_name] = false @@ -29,7 +29,7 @@ function xdecor.sit(pos, node, clicker, pointed_thing) clicker:set_eye_offset({x = 0, y = -7, z = 2}, vector.new()) clicker:set_physics_override({speed = 0, jump = 0, gravity = 1}) - clicker:setpos(pos) + clicker:set_pos(pos) default.player_attached[player_name] = true default.player_set_animation(clicker, "sit", 30) @@ -55,4 +55,3 @@ function xdecor.sit_dig(pos, digger) return true end - diff --git a/mod.conf b/mod.conf index 2e97596..74a8013 100755 --- a/mod.conf +++ b/mod.conf @@ -1 +1,4 @@ name = xdecor +depends = default, bucket, doors, stairs, xpanes +optional_depends = fire, oresplus, moreblocks, mesecons_plus +description = A decoration mod meant to be simple and well-featured. diff --git a/src/enchanting.lua b/src/enchanting.lua index b731f61..cad328b 100755 --- a/src/enchanting.lua +++ b/src/enchanting.lua @@ -237,7 +237,7 @@ minetest.register_entity("xdecor:book_open", { physical = false, textures = {"xdecor_book_open.png"}, on_activate = function(self) - local pos = self.object:getpos() + local pos = self.object:get_pos() local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z} if minetest.get_node(pos_under).name ~= "xdecor:enchantment_table" then diff --git a/src/itemframe.lua b/src/itemframe.lua index 83cce3f..9f37b5c 100755 --- a/src/itemframe.lua +++ b/src/itemframe.lua @@ -85,7 +85,11 @@ function itemframe.rightclick(pos, node, clicker, itemstack) local itemstring = itemstack:take_item():to_string() meta:set_string("item", itemstring) update_item(pos, node) - + if itemstring == "" then + meta:set_string("infotext", "Item Frame (owned by " .. owner .. ")") + else + meta:set_string("infotext", itemstring.." (owned by " .. owner .. ")") + end return itemstack end diff --git a/src/workbench.lua b/src/workbench.lua index ad775f8..8d2084d 100755 --- a/src/workbench.lua +++ b/src/workbench.lua @@ -69,7 +69,7 @@ function workbench:get_output(inv, input, name) local item = name .. "_" .. nbox[1] item = nbox[3] and item or "stairs:" .. nbox[1] .. "_" .. name:match(":(.*)") - output[#output + 1] = item .. " " .. count + output[i] = item .. " " .. count end inv:set_list("forms", output) @@ -184,7 +184,7 @@ function workbench.timer(pos) return true end -function workbench.put(_, listname, _, stack) +function workbench.allow_put(pos, listname, index, stack, player) local stackname = stack:get_name() if (listname == "tool" and stack:get_wear() > 0 and workbench:repairable(stackname)) or @@ -197,11 +197,7 @@ function workbench.put(_, listname, _, stack) return 0 end -function workbench.move(_, from_list, _, to_list, _, count) - return (to_list == "storage" and from_list ~= "forms") and count or 0 -end - -function workbench.on_put(pos, listname, _, stack) +function workbench.on_put(pos, listname, index, stack, player) local inv = minetest.get_meta(pos):get_inventory() if listname == "input" then local input = inv:get_stack("input", 1) @@ -212,6 +208,24 @@ function workbench.on_put(pos, listname, _, stack) end end +function workbench.allow_move(pos, from_list, from_index, to_list, to_index, count, player) + return (to_list == "storage" and from_list ~= "forms") and count or 0 +end + +function workbench.on_move(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local from_stack = inv:get_stack(from_list, from_index) + local to_stack = inv:get_stack(to_list, to_index) + + workbench.on_take(pos, from_list, from_index, from_stack, player) + workbench.on_put(pos, to_list, to_index, to_stack, player) +end + +function workbench.allow_take(pos, listname, index, stack, player) + return stack:get_count() +end + function workbench.on_take(pos, listname, index, stack, player) local inv = minetest.get_meta(pos):get_inventory() local input = inv:get_stack("input", 1) @@ -255,8 +269,10 @@ xdecor.register("workbench", { on_receive_fields = workbench.fields, on_metadata_inventory_put = workbench.on_put, on_metadata_inventory_take = workbench.on_take, - allow_metadata_inventory_put = workbench.put, - allow_metadata_inventory_move = workbench.move + on_metadata_inventory_move = workbench.on_move, + allow_metadata_inventory_put = workbench.allow_put, + allow_metadata_inventory_take = workbench.allow_take, + allow_metadata_inventory_move = workbench.allow_move }) for _, d in ipairs(workbench.defs) do