55 lines
1.7 KiB
Lua
55 lines
1.7 KiB
Lua
|
|
local dbg
|
|
if moddebug then dbg=moddebug.dbg("railcarts") else dbg={v1=function() end,v2=function() end,v3=function() end} end
|
|
|
|
minetest.register_entity("railcarts:cargo_cart_ent", {
|
|
physical = true,
|
|
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
|
visual = "mesh",
|
|
textures = { "railcarts_tex_transportcart.png" },
|
|
mesh= "railcarts_transport_cart.x",
|
|
visual_size = {x=1,y=1,z=1},
|
|
groups = { immortal=1, },
|
|
|
|
carttype = "cargo",
|
|
getitem = "railcarts:cargo_cart",
|
|
|
|
on_step = cartbase.on_step_handler,
|
|
on_punch = cartbase.on_punch_handler,
|
|
on_activate = cartbase.on_activate_handler,
|
|
get_staticdata = cartbase.get_staticdata_handler,
|
|
|
|
on_rightclick = function(self,clicker)
|
|
local playername = clicker:get_player_name()
|
|
minetest.show_formspec(playername, "cargo_cart_formspec",
|
|
"size[8,9;]"..
|
|
"label[0,0;Cargo cart content:]" ..
|
|
"list[detached:" .. self.inventoryname .. ";main;2,1;4,3;]"..
|
|
"list[current_player;main;0,5;8,4;]")
|
|
return true
|
|
end
|
|
|
|
})
|
|
|
|
minetest.register_craftitem("railcarts:cargo_cart", {
|
|
description = "Cargo Cart",
|
|
image = minetest.inventorycube("railcarts_inv_transportcart_top.png",
|
|
"railcarts_inv_cart_side.png",
|
|
"railcarts_inv_cart_side.png"),
|
|
|
|
on_place = function(item, placer, pointed_thing)
|
|
return cartbase.place_cart(item, pointed_thing, "railcarts:cargo_cart_ent")
|
|
end
|
|
})
|
|
|
|
minetest.register_craft({
|
|
output = "railcarts:cargo_cart",
|
|
recipe = {
|
|
{"", "", ""},
|
|
{"default:steel_ingot", "default:chest", "default:steel_ingot"},
|
|
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
|
},
|
|
})
|
|
|
|
|