0
0
Fork 0

Allow dispensers to convert dirt to mud

This commit is contained in:
TheRandomLegoBrick 2022-07-06 12:43:54 -07:00
parent 973dc7fa41
commit 0142b58edc
1 changed files with 22 additions and 0 deletions

View File

@ -235,6 +235,17 @@ minetest.register_craftitem("mcl_potions:water", {
-- Drink the water by default -- Drink the water by default
return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing) return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing)
end, end,
_on_dispense = function(stack, pos, droppos)
local node = minetest.get_node(droppos)
if node.name == "mcl_core:dirt" or node.name == "mcl_core:coarse_dirt" then
minetest.set_node(droppos, {name = "mcl_core:mud"})
minetest.sound_play("mcl_potions_bottle_pour", {pos=droppos, gain=0.5, max_hear_range=16}, true)
return ItemStack("mcl_potions:glass_bottle")
elseif node.name == "mcl_core:mud" then
return stack
end
end,
_dispense_into_walkable = true,
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
}) })
@ -297,6 +308,17 @@ minetest.register_craftitem("mcl_potions:river_water", {
-- Drink the water by default -- Drink the water by default
return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing) return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing)
end, end,
_on_dispense = function(stack, pos, droppos)
local node = minetest.get_node(droppos)
if node.name == "mcl_core:dirt" or node.name == "mcl_core:coarse_dirt" then
minetest.set_node(droppos, {name = "mcl_core:mud"})
minetest.sound_play("mcl_potions_bottle_pour", {pos=droppos, gain=0.5, max_hear_range=16}, true)
return ItemStack("mcl_potions:glass_bottle")
elseif node.name == "mcl_core:mud" then
return stack
end
end,
_dispense_into_walkable = true,
on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"),
}) })