forked from mtcontrib/witchcraft
Compare commits
5 Commits
nalc-1.0
...
b500873215
Author | SHA1 | Date | |
---|---|---|---|
b500873215 | |||
0e277c51fb | |||
36d76ca7fb | |||
efe57c3137 | |||
ee1eb7d8ce |
@ -8,5 +8,6 @@ farming?
|
||||
lightning?
|
||||
pmobs?
|
||||
hud_hunger?
|
||||
hunger_ng?
|
||||
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
|
||||
-- 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,37 @@ 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
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
groups = {cracky=1, falling_node=1, oddly_breakable_by_hand=1}
|
||||
})
|
||||
@ -2553,105 +2556,106 @@ minetest.register_node("witchcraft:potion_purple", {
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
if minetest.get_modpath("hud_hunger") ~= nil then
|
||||
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
|
||||
|
||||
local register_food = hunger.register_food
|
||||
minetest.register_node("witchcraft:potion_gpurple", {
|
||||
description = "Filling Potion (better with hunger mod)",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"witchcraft_potion_purple.png"},
|
||||
wield_image = "witchcraft_potion_purple.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, potion=1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
inventory_image = "witchcraft_potion_purple.png",
|
||||
on_use = function(itemstack, player)
|
||||
local health = player:get_hp();
|
||||
player:set_hp(health+20)
|
||||
itemstack:replace("vessels:glass_bottle")
|
||||
return itemstack
|
||||
end,
|
||||
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, 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 = {vessel=1,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", {
|
||||
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 (better with hunger mod)",
|
||||
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, potion=1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
inventory_image = "witchcraft_potion_gred.png",
|
||||
on_use = function(itemstack, player)
|
||||
local health = player:get_hp();
|
||||
player:set_hp(health+10)
|
||||
itemstack:replace("vessels:glass_bottle")
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
})
|
||||
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
|
||||
|
||||
minetest.register_node("witchcraft:potion_purple_2", {
|
||||
|
Reference in New Issue
Block a user