Add different boat types

master
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)
end
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)
end
elseif filter == "#misc" then

View File

@ -22,7 +22,6 @@ local boat = {
collisionbox = {-1,-0.5,-1, 1,0.5,1},
visual = "mesh",
mesh = "mcl_boats_base.x",
textures = {"mcl_boats_texture.png"},
_driver = nil,
_v = 0,
@ -134,10 +133,16 @@ function boat.on_step(self, dtime)
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", {
description = "Boat",
for w=1, #woods do
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",
liquids_pointable = true,
groups = { boat = 1, },
@ -150,7 +155,7 @@ minetest.register_craftitem("mcl_boats:boat", {
return
end
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
itemstack:take_item()
end
@ -158,14 +163,15 @@ minetest.register_craftitem("mcl_boats:boat", {
end,
})
local c = craftstuffs[w]
minetest.register_craft({
output = "mcl_boats:boat",
recipe = {
{"", "", ""},
{"default:wood", "", "default:wood"},
{"default:wood", "default:wood", "default:wood"},
{c, "", c},
{c, c, c},
},
})
end
minetest.register_craft({
type = "fuel",