mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-14 15:11:05 +01:00
Place boats and minecarts with dispenser
This commit is contained in:
parent
2350752aca
commit
76e77cceb4
1 changed files with 28 additions and 1 deletions
|
@ -115,7 +115,7 @@ local dispenserdef = {
|
||||||
bucket_id = "bucket:bucket_lava"
|
bucket_id = "bucket:bucket_lava"
|
||||||
end
|
end
|
||||||
if collect_liquid then
|
if collect_liquid then
|
||||||
minetest.swap_node(droppos, {name="air"})
|
minetest.set_node(droppos, {name="air"})
|
||||||
|
|
||||||
-- Fill bucket with liquid and put it back into inventory
|
-- Fill bucket with liquid and put it back into inventory
|
||||||
-- if there's still space. If not, drop it.
|
-- if there's still space. If not, drop it.
|
||||||
|
@ -170,6 +170,33 @@ local dispenserdef = {
|
||||||
inv:set_stack("main", stack_id, stack)
|
inv:set_stack("main", stack_id, stack)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif iname == "mcl_minecarts:minecart" then
|
||||||
|
-- Place minecart as entity on rail
|
||||||
|
if dropnodedef.groups.rail then
|
||||||
|
minetest.add_entity(droppos, "mcl_minecarts:minecart")
|
||||||
|
|
||||||
|
else
|
||||||
|
-- Drop item
|
||||||
|
minetest.add_item(droppos, dropitem)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
stack:take_item()
|
||||||
|
inv:set_stack("main", stack_id, stack)
|
||||||
|
|
||||||
|
elseif igroups.boat then
|
||||||
|
local below = {x=droppos.x, y=droppos.y-1, z=droppos.z}
|
||||||
|
local belownode = minetest.get_node(below)
|
||||||
|
-- Place boat as entity on or in water
|
||||||
|
if dropnodedef.groups.water or (dropnode.name == "air" and minetest.registered_nodes[belownode.name].groups.water) then
|
||||||
|
minetest.add_entity(droppos, "mcl_boats:boat")
|
||||||
|
else
|
||||||
|
minetest.add_item(droppos, dropitem)
|
||||||
|
end
|
||||||
|
|
||||||
|
stack:take_item()
|
||||||
|
inv:set_stack("main", stack_id, stack)
|
||||||
|
|
||||||
-- TODO: Many other dispenser actions
|
-- TODO: Many other dispenser actions
|
||||||
else
|
else
|
||||||
-- Drop item
|
-- Drop item
|
||||||
|
|
Loading…
Reference in a new issue