1
0
Fork 0

Add different boat types

This commit is contained in:
Wuzzy 2017-01-16 19:10:18 +01:00
parent f2b5d5a5ad
commit 22d8aa7a41
2 changed files with 37 additions and 31 deletions

View File

@ -54,7 +54,7 @@ function set_inv(filter, player)
table.insert(creative_list, name) table.insert(creative_list, name)
end end
elseif filter == "#rail" then elseif filter == "#rail" then
if string.find(string.lower(def.name), "rail") or string.find(string.lower(def.description), "rail") or string.find(string.lower(def.name), "cart") or string.find(string.lower(def.description), "cart") or string.find(string.lower(def.description), "boat") then if def.groups.rail or def.groups.cart or def.groups.boat then
table.insert(creative_list, name) table.insert(creative_list, name)
end end
elseif filter == "#misc" then elseif filter == "#misc" then

View File

@ -22,7 +22,6 @@ local boat = {
collisionbox = {-1,-0.5,-1, 1,0.5,1}, collisionbox = {-1,-0.5,-1, 1,0.5,1},
visual = "mesh", visual = "mesh",
mesh = "mcl_boats_base.x", mesh = "mcl_boats_base.x",
textures = {"mcl_boats_texture.png"},
_driver = nil, _driver = nil,
_v = 0, _v = 0,
@ -134,10 +133,16 @@ function boat.on_step(self, dtime)
end end
minetest.register_entity("mcl_boats:boat", boat) local woods = { "", "_spruce", "_birch", "_jungle", "_dark", "_acacia" }
local names = { "Oak Boat", "Spruce Boat", "Birch Boat", "Jungle Boat", "Dark Oak Boat", "Acacia Boat" }
local craftstuffs = { "default:wood", "default:sprucewood", "default:birchwood", "default:junglewood", "default:darkwood", "default:acaciawood" }
minetest.register_craftitem("mcl_boats:boat", { for w=1, #woods do
description = "Boat", textures = {"mcl_boats_texture.png"},
minetest.register_entity("mcl_boats:boat"..woods[w], boat)
minetest.register_craftitem("mcl_boats:boat"..woods[w], {
description = names[w],
inventory_image = "mcl_boats_inventory.png", inventory_image = "mcl_boats_inventory.png",
liquids_pointable = true, liquids_pointable = true,
groups = { boat = 1, }, groups = { boat = 1, },
@ -150,22 +155,23 @@ minetest.register_craftitem("mcl_boats:boat", {
return return
end end
pointed_thing.under.y = pointed_thing.under.y+0.5 pointed_thing.under.y = pointed_thing.under.y+0.5
minetest.add_entity(pointed_thing.under, "mcl_boats:boat") minetest.add_entity(pointed_thing.under, "mcl_boats:boat"..woods[w])
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack
end, end,
}) })
minetest.register_craft({ local c = craftstuffs[w]
minetest.register_craft({
output = "mcl_boats:boat", output = "mcl_boats:boat",
recipe = { recipe = {
{"", "", ""}, {c, "", c},
{"default:wood", "", "default:wood"}, {c, c, c},
{"default:wood", "default:wood", "default:wood"},
}, },
}) })
end
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",