forked from mtcontrib/witchcraft
Compare commits
5 Commits
32e3f8928b
...
b500873215
Author | SHA1 | Date | |
---|---|---|---|
b500873215 | |||
0e277c51fb | |||
36d76ca7fb | |||
efe57c3137 | |||
ee1eb7d8ce |
@ -8,5 +8,6 @@ farming?
|
|||||||
lightning?
|
lightning?
|
||||||
pmobs?
|
pmobs?
|
||||||
hud_hunger?
|
hud_hunger?
|
||||||
|
hunger_ng?
|
||||||
moreplants?
|
moreplants?
|
||||||
horror?
|
horror?
|
250
init.lua
250
init.lua
@ -17,11 +17,6 @@
|
|||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- 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 =
|
local vessels_shelf_formspec =
|
||||||
"size[8,7;]"..
|
"size[8,7;]"..
|
||||||
default.gui_bg..
|
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
|
{-0.375, 0.3125, -0.375, -0.3125, 0.375, 0.375}, -- NodeBox20
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
on_rightclick = function(pos, node, clicker, itemstack, _)
|
||||||
local wield_item = clicker:get_wielded_item():get_name()
|
local wield_item = itemstack:get_name()
|
||||||
|
|
||||||
if wield_item == "bucket:bucket_water" or
|
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})
|
minetest.set_node(pos, {name="witchcraft:pot_blue", param2=node.param2})
|
||||||
item:replace("bucket:bucket_empty")
|
return ItemStack("bucket:bucket_empty")
|
||||||
elseif wield_item == "vessels:drinking_glass" then
|
elseif wield_item == "vessels:drinking_glass" then
|
||||||
item:replace("witchcraft:bottle_slime")
|
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
|
||||||
end,
|
end,
|
||||||
groups = {cracky=1, falling_node=1, oddly_breakable_by_hand=1}
|
groups = {cracky=1, falling_node=1, oddly_breakable_by_hand=1}
|
||||||
@ -650,31 +647,37 @@ minetest.register_node("witchcraft:pot_"..color, {
|
|||||||
{-0.4375, 0.375, -0.4375, 0.4375, 0.5, 0.4375}, -- NodeBox7
|
{-0.4375, 0.375, -0.4375, 0.4375, 0.5, 0.4375}, -- NodeBox7
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_rightclick = function(pos, node, clicker, item, _)
|
on_rightclick = function(pos, node, clicker, itemstack, _)
|
||||||
local wield_item = clicker:get_wielded_item():get_name()
|
local wield_item = itemstack:get_name()
|
||||||
if wield_item == "vessels:glass_bottle" and clicker:get_wielded_item():get_count() == 3 then
|
|
||||||
item:replace("witchcraft:potion_"..color)
|
if wield_item == "vessels:glass_bottle" then
|
||||||
minetest.env:add_item({x=pos.x, y=pos.y+1.5, z=pos.z}, "witchcraft:potion_"..color)
|
local wield_items_count = itemstack:get_count()
|
||||||
minetest.env:add_item({x=pos.x, y=pos.y+1.5, z=pos.z}, "witchcraft:potion_"..color)
|
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})
|
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
|
elseif wield_item == ingredient then
|
||||||
item:replace("witchcraft:potion_"..color)
|
|
||||||
minetest.set_node(pos, {name="witchcraft:pot", param2=node.param2})
|
|
||||||
else
|
|
||||||
if wield_item == ingredient then
|
|
||||||
minetest.set_node(pos, {name="witchcraft:pot_"..newcolor, param2=node.param2})
|
minetest.set_node(pos, {name="witchcraft:pot_"..newcolor, param2=node.param2})
|
||||||
item:take_item()
|
itemstack:take_item()
|
||||||
elseif wield_item == ingredient2 then
|
elseif wield_item == ingredient2 then
|
||||||
minetest.set_node(pos, {name="witchcraft:pot_"..newcolor2, param2=node.param2})
|
minetest.set_node(pos, {name="witchcraft:pot_"..newcolor2, param2=node.param2})
|
||||||
item:take_item()
|
itemstack:take_item()
|
||||||
elseif wield_item == "bucket:bucket_water" then
|
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})
|
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
|
elseif wield_item == "witchcraft:potion_"..combine then
|
||||||
minetest.set_node(pos, {name="witchcraft:pot_"..cresult, param2=node.param2})
|
minetest.set_node(pos, {name="witchcraft:pot_"..cresult, param2=node.param2})
|
||||||
item:replace("vessels:glass_bottle")
|
itemstack:replace("vessels:glass_bottle")
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
return itemstack
|
||||||
end,
|
end,
|
||||||
groups = {cracky=1, falling_node=1, oddly_breakable_by_hand=1}
|
groups = {cracky=1, falling_node=1, oddly_breakable_by_hand=1}
|
||||||
})
|
})
|
||||||
@ -2553,105 +2556,106 @@ minetest.register_node("witchcraft:potion_purple", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if minetest.get_modpath("hud_hunger") ~= nil then
|
if minetest.get_modpath("hud_hunger") ~= nil then
|
||||||
local register_food = hunger.register_food
|
local register_food = hunger.register_food
|
||||||
minetest.register_node("witchcraft:potion_gpurple", {
|
|
||||||
description = "Filling Potion",
|
|
||||||
drawtype = "plantlike",
|
|
||||||
tiles = {"witchcraft_potion_gpurple.png"},
|
|
||||||
wield_image = "witchcraft_potion_gpurple.png",
|
|
||||||
paramtype = "light",
|
|
||||||
stack_max = 1,
|
|
||||||
is_ground_content = false,
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
|
|
||||||
},
|
|
||||||
groups = {dig_immediate=3,attached_node=1, potion2=1},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
inventory_image = "witchcraft_potion_gpurple.png",
|
|
||||||
on_use = function(item, placer, pos)
|
|
||||||
item:replace("vessels:glass_bottle")
|
|
||||||
return item
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("witchcraft:potion_gred", {
|
|
||||||
description = "Hunger Potion",
|
|
||||||
drawtype = "plantlike",
|
|
||||||
tiles = {"witchcraft_potion_gred.png"},
|
|
||||||
wield_image = "witchcraft_potion_gred.png",
|
|
||||||
paramtype = "light",
|
|
||||||
stack_max = 1,
|
|
||||||
is_ground_content = false,
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
|
|
||||||
},
|
|
||||||
groups = {dig_immediate=3,attached_node=1, potion2=1},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
inventory_image = "witchcraft_potion_gred.png",
|
|
||||||
on_use = function(item, placer, pos)
|
|
||||||
item:replace("vessels:glass_bottle")
|
|
||||||
return item
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
register_food("witchcraft:potion_gpurple", 10)
|
|
||||||
register_food("witchcraft:potion_gred", -4)
|
|
||||||
else
|
|
||||||
|
|
||||||
minetest.register_node("witchcraft:potion_gpurple", {
|
minetest.register_node("witchcraft:potion_gpurple", {
|
||||||
description = "Filling Potion (better with hunger mod)",
|
description = "Filling Potion",
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = {"witchcraft_potion_purple.png"},
|
tiles = {"witchcraft_potion_gpurple.png"},
|
||||||
wield_image = "witchcraft_potion_purple.png",
|
wield_image = "witchcraft_potion_gpurple.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
|
fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3,attached_node=1, potion=1},
|
groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
inventory_image = "witchcraft_potion_purple.png",
|
inventory_image = "witchcraft_potion_gpurple.png",
|
||||||
on_use = function(itemstack, player)
|
on_use = function(item, placer, pos)
|
||||||
local health = player:get_hp();
|
item:replace("vessels:glass_bottle")
|
||||||
player:set_hp(health+20)
|
return item
|
||||||
itemstack:replace("vessels:glass_bottle")
|
end,
|
||||||
return itemstack
|
})
|
||||||
end,
|
|
||||||
|
|
||||||
minetest.register_node("witchcraft:potion_gred", {
|
minetest.register_node("witchcraft:potion_gred", {
|
||||||
description = "Hunger Potion (better with hunger mod)",
|
description = "Hunger Potion",
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = {"witchcraft_potion_gred.png"},
|
tiles = {"witchcraft_potion_gred.png"},
|
||||||
wield_image = "witchcraft_potion_gred.png",
|
wield_image = "witchcraft_potion_gred.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
|
fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
|
||||||
},
|
},
|
||||||
groups = {dig_immediate=3,attached_node=1, potion=1},
|
groups = {vessel=1,dig_immediate=3,attached_node=1, potion2=1},
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
inventory_image = "witchcraft_potion_gred.png",
|
inventory_image = "witchcraft_potion_gred.png",
|
||||||
on_use = function(itemstack, player)
|
on_use = function(item, placer, pos)
|
||||||
local health = player:get_hp();
|
item:replace("vessels:glass_bottle")
|
||||||
player:set_hp(health+10)
|
return item
|
||||||
itemstack:replace("vessels:glass_bottle")
|
end,
|
||||||
return itemstack
|
})
|
||||||
end,
|
|
||||||
})
|
register_food("witchcraft:potion_gpurple", 10)
|
||||||
})
|
register_food("witchcraft:potion_gred", -4)
|
||||||
|
else
|
||||||
|
minetest.register_node("witchcraft:potion_gpurple", {
|
||||||
|
description = "Filling Potion",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = {"witchcraft_potion_gpurple.png"},
|
||||||
|
wield_image = "witchcraft_potion_gpurple.png",
|
||||||
|
paramtype = "light",
|
||||||
|
stack_max = 1,
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = false,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
|
||||||
|
},
|
||||||
|
groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
inventory_image = "witchcraft_potion_purple.png",
|
||||||
|
on_use = minetest.item_eat(20, "vessels:glass_bottle"),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("witchcraft:potion_gred", {
|
||||||
|
description = "Hunger Potion",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = {"witchcraft_potion_gred.png"},
|
||||||
|
wield_image = "witchcraft_potion_gred.png",
|
||||||
|
paramtype = "light",
|
||||||
|
stack_max = 1,
|
||||||
|
is_ground_content = false,
|
||||||
|
walkable = false,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.25, -0.5, -0.25, 0.25, 0.4, 0.25}
|
||||||
|
},
|
||||||
|
groups = {vessel=1,dig_immediate=3,attached_node=1, potion=1},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
inventory_image = "witchcraft_potion_gred.png",
|
||||||
|
on_use = minetest.item_eat(-10, "vessels:glass_bottle"),
|
||||||
|
})
|
||||||
|
|
||||||
|
if minetest.get_modpath("hunger_ng") ~= nil then
|
||||||
|
local register_food = hunger_ng.add_hunger_data
|
||||||
|
|
||||||
|
register_food('witchcraft:potion_gpurple', {
|
||||||
|
satiates = 10,
|
||||||
|
returns = 'vessels:glass_bottle'
|
||||||
|
})
|
||||||
|
|
||||||
|
register_food('witchcraft:potion_gred', {
|
||||||
|
satiates = -4,
|
||||||
|
returns = 'vessels:glass_bottle'
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("witchcraft:potion_purple_2", {
|
minetest.register_node("witchcraft:potion_purple_2", {
|
||||||
|
Reference in New Issue
Block a user