forked from LizzyFleckenstein03/Memeclone
Add different boat types
This commit is contained in:
parent
f2b5d5a5ad
commit
22d8aa7a41
|
@ -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
|
||||||
|
|
|
@ -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,38 +133,45 @@ 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"},
|
||||||
inventory_image = "mcl_boats_inventory.png",
|
minetest.register_entity("mcl_boats:boat"..woods[w], boat)
|
||||||
liquids_pointable = true,
|
|
||||||
groups = { boat = 1, },
|
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
minetest.register_craftitem("mcl_boats:boat"..woods[w], {
|
||||||
if pointed_thing.type ~= "node" then
|
description = names[w],
|
||||||
return
|
inventory_image = "mcl_boats_inventory.png",
|
||||||
end
|
liquids_pointable = true,
|
||||||
if not is_water(pointed_thing.under) then
|
groups = { boat = 1, },
|
||||||
return
|
|
||||||
end
|
|
||||||
pointed_thing.under.y = pointed_thing.under.y+0.5
|
|
||||||
minetest.add_entity(pointed_thing.under, "mcl_boats:boat")
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
output = "mcl_boats:boat",
|
if pointed_thing.type ~= "node" then
|
||||||
recipe = {
|
return
|
||||||
{"", "", ""},
|
end
|
||||||
{"default:wood", "", "default:wood"},
|
if not is_water(pointed_thing.under) then
|
||||||
{"default:wood", "default:wood", "default:wood"},
|
return
|
||||||
},
|
end
|
||||||
})
|
pointed_thing.under.y = pointed_thing.under.y+0.5
|
||||||
|
minetest.add_entity(pointed_thing.under, "mcl_boats:boat"..woods[w])
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
local c = craftstuffs[w]
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mcl_boats:boat",
|
||||||
|
recipe = {
|
||||||
|
{c, "", c},
|
||||||
|
{c, c, c},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
|
|
Loading…
Reference in New Issue