forked from nalc/witchcraft
Tidy code and remove stack_max limit of Glass Bottle
This commit is contained in:
parent
36d76ca7fb
commit
0e277c51fb
57
init.lua
57
init.lua
@ -17,11 +17,6 @@
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
--changes so that bottles can't stack
|
||||
minetest.override_item("vessels:glass_bottle", {
|
||||
stack_max = 3,
|
||||
})
|
||||
|
||||
local vessels_shelf_formspec =
|
||||
"size[8,7;]"..
|
||||
default.gui_bg..
|
||||
@ -543,14 +538,16 @@ minetest.register_node("witchcraft:pot", {
|
||||
{-0.375, 0.3125, -0.375, -0.3125, 0.375, 0.375}, -- NodeBox20
|
||||
}
|
||||
},
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
local wield_item = clicker:get_wielded_item():get_name()
|
||||
on_rightclick = function(pos, node, clicker, itemstack, _)
|
||||
local wield_item = itemstack:get_name()
|
||||
|
||||
if wield_item == "bucket:bucket_water" or
|
||||
wield_item == "bucket:bucket_river_water" then
|
||||
wield_item == "bucket:bucket_river_water" then
|
||||
minetest.set_node(pos, {name="witchcraft:pot_blue", param2=node.param2})
|
||||
item:replace("bucket:bucket_empty")
|
||||
elseif wield_item == "vessels:drinking_glass" then
|
||||
item:replace("witchcraft:bottle_slime")
|
||||
return ItemStack("bucket:bucket_empty")
|
||||
elseif wield_item == "vessels:drinking_glass" then
|
||||
itemstack:set_count(itemstack:get_count() - 1)
|
||||
minetest.env:add_item({x=pos.x, y=pos.y+1.5, z=pos.z}, "witchcraft:bottle_slime")
|
||||
end
|
||||
end,
|
||||
groups = {cracky=1, falling_node=1, oddly_breakable_by_hand=1}
|
||||
@ -650,31 +647,35 @@ minetest.register_node("witchcraft:pot_"..color, {
|
||||
{-0.4375, 0.375, -0.4375, 0.4375, 0.5, 0.4375}, -- NodeBox7
|
||||
}
|
||||
},
|
||||
on_rightclick = function(pos, node, clicker, item, _)
|
||||
local wield_item = clicker:get_wielded_item():get_name()
|
||||
if wield_item == "vessels:glass_bottle" and clicker:get_wielded_item():get_count() == 3 then
|
||||
item:replace("witchcraft:potion_"..color)
|
||||
minetest.env:add_item({x=pos.x, y=pos.y+1.5, z=pos.z}, "witchcraft:potion_"..color)
|
||||
minetest.env:add_item({x=pos.x, y=pos.y+1.5, z=pos.z}, "witchcraft:potion_"..color)
|
||||
on_rightclick = function(pos, node, clicker, itemstack, _)
|
||||
local wield_item = itemstack:get_name()
|
||||
|
||||
if wield_item == "vessels:glass_bottle" then
|
||||
local wield_items_count = itemstack:get_count()
|
||||
local potions_count = (wield_items_count <= 3 and wield_items_count) or 3
|
||||
local wield_items_left = (wield_items_count - potions_count)
|
||||
|
||||
itemstack:set_count((wield_items_left < 0 and 0) or wield_items_left)
|
||||
|
||||
for i = 1, potions_count do
|
||||
minetest.env:add_item({x=pos.x, y=pos.y+1.5, z=pos.z}, "witchcraft:potion_"..color)
|
||||
end
|
||||
|
||||
minetest.set_node(pos, {name="witchcraft:pot", param2=node.param2})
|
||||
elseif wield_item == "vessels:glass_bottle" and clicker:get_wielded_item():get_count() ~= 3 then
|
||||
item:replace("witchcraft:potion_"..color)
|
||||
minetest.set_node(pos, {name="witchcraft:pot", param2=node.param2})
|
||||
else
|
||||
if wield_item == ingredient then
|
||||
elseif wield_item == ingredient then
|
||||
minetest.set_node(pos, {name="witchcraft:pot_"..newcolor, param2=node.param2})
|
||||
item:take_item()
|
||||
itemstack:take_item()
|
||||
elseif wield_item == ingredient2 then
|
||||
minetest.set_node(pos, {name="witchcraft:pot_"..newcolor2, param2=node.param2})
|
||||
item:take_item()
|
||||
elseif wield_item == "bucket:bucket_water" then
|
||||
itemstack:take_item()
|
||||
elseif wield_item == "bucket:bucket_water" or
|
||||
wield_item == "bucket:bucket_river_water" then
|
||||
minetest.set_node(pos, {name="witchcraft:pot_blue", param2=node.param2})
|
||||
item:replace("bucket:bucket_empty")
|
||||
return ItemStack("bucket:bucket_empty")
|
||||
elseif wield_item == "witchcraft:potion_"..combine then
|
||||
minetest.set_node(pos, {name="witchcraft:pot_"..cresult, param2=node.param2})
|
||||
item:replace("vessels:glass_bottle")
|
||||
itemstack:replace("vessels:glass_bottle")
|
||||
end
|
||||
end
|
||||
end,
|
||||
groups = {cracky=1, falling_node=1, oddly_breakable_by_hand=1}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user