Add boat item

This commit is contained in:
oilboi 2020-02-19 07:55:25 -05:00
parent bce4924cfe
commit 7be68e35f2
2 changed files with 31 additions and 1 deletions

View File

@ -144,7 +144,7 @@ minetest.register_entity("boat:boat", {
local node_above = minetest.get_node(vector.new(pos.x,pos.y+1,pos.z)).name
local goalx = 0
local goalz = 0
print(node_above)
--print(node_above)
if (node == "main:waterflow" or node == "main:water" ) and not self.moving == true and (node_above ~= "main:water" and node_above ~= "main:waterflow") then
local currentvel = self.object:getvelocity()
local level = minetest.get_node_level(pos)
@ -193,3 +193,33 @@ minetest.register_entity("boat:boat", {
self.slowdown(self)
end,
})
minetest.register_craftitem("boat:boat", {
description = "Boat",
inventory_image = "boatitem.png",
wield_image = "boatitem.png",
liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return
end
if minetest.get_item_group(minetest.get_node(pointed_thing.under).name, "water")>0 then
minetest.add_entity(pointed_thing.under, "boat:boat")
else
return
end
itemstack:take_item()
return itemstack
end,
})
minetest.register_craft({
output = "boat:boat",
recipe = {
{"main:wood", "", "main:wood"},
{"main:wood", "main:wood", "main:wood"},
},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B