123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- local colbox_floor = {
- type = 'fixed',
- fixed = {
- {-.5, .3, -.5, .5, .5, .5},
- }
- }
- local colbox_floor_edge = {
- type = 'fixed',
- fixed = {
- {-.5, .3, -.5, .5, .5, .5},
- }
- }
- local colbox_floor_square = {
- type = 'fixed',
- fixed = {
- {-.5, .4, -.5, .5, .5, .5},
- }
- }
- local colbox_floor_angle = {
- type = 'fixed',
- fixed = {
- {.25, .4, 0, .5, .5, .25},
- {0, .4, -.5, .5, .5, 0},
- {-.25, .4, -.25, 0, .5, -.5}
- }
- }
- local colbox_ramp_1 = {
- type = 'fixed',
- fixed = {
- {-.5, -.5, 0, .5, 0, .5},
- {-.5, -.5, -.5, .5, -.25, 0},
- }
- }
- local colbox_stair = { --Stairs nodebox
- type = 'fixed',
- fixed = {
- {-.5, -.5, -.5, .5, 0, .5},
- {-.5, 0, 0, .5, .5, .5},
- }}
- minetest.register_node('ship:floor', {
- description = 'Floor',
- drawtype = 'mesh',
- mesh = 'ship_floor.obj',
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = colbox_floor,
- collision_box = colbox_floor,
- tiles = {'ship_floor_blank.png'},
- groups = {breakable=1}
- })
- minetest.register_node('ship:ramp1', {
- description = 'Ramp Bottom',
- drawtype = 'mesh',
- mesh = 'ship_ramp-1.obj',
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = colbox_ramp_1,
- collision_box = colbox_ramp_1,
- tiles = {'ship_floor_blank.png'},
- groups = {breakable=1}
- })
- minetest.register_node('ship:ramp2', {
- description = 'Ramp Top',
- drawtype = 'mesh',
- mesh = 'ship_ramp-2.obj',
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = colbox_stair,
- collision_box = colbox_stair,
- tiles = {'ship_floor_blank.png'},
- groups = {breakable=1}
- })
- minetest.register_node('ship:stairs', {
- description = 'Stairs',
- drawtype = 'mesh',
- mesh = 'ship_stairs.obj',
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = colbox_stair,
- collision_box = colbox_stair,
- tiles = {'ship_rail_blank.png', 'ship_floor_blank.png'},
- groups = {breakable=1}
- })
- for i in ipairs (ship_parts_colors) do
- local shipcol = ship_parts_colors[i][1]
- local shipval = ship_parts_colors[i][2]
- local shipdesc = ship_parts_colors[i][3]
- local ship_floor = { -- description, name, model, texture, colbox
- {shipcol..' Walkway Inside Corner', shipdesc..'eic', 'edge_incorner', '(ship_ship_floor_corner_inside.png^['..shipval..')', colbox_floor_edge},
- {shipcol..' Walkway Outside Corner', shipdesc..'eoc', 'edge_outcorner', '(ship_ship_floor_outcorn.png^['..shipval..')', colbox_floor_edge},
- {shipcol..' Walkway Edge', shipdesc..'es', 'edge_straight', '(ship_ship_floor.png^['..shipval..')', colbox_floor_edge},
- {shipcol..' Floor Angle', shipdesc..'fa', 'floor_angle', '(ship_ship_floor_angle.png^['..shipval..')', colbox_floor_angle},
- {shipcol..' Floor Square', shipdesc..'fs', 'floor_square', '(ship_ship_floor_double.png^['..shipval..')', colbox_floor_square},
- {shipcol..' Ramp Top Right', shipdesc..'r2r', 'ramp-2', '(ship_ship_floor.png^['..shipval..')^[transform2', colbox_stair},
- {shipcol..' Ramp Bottom Right', shipdesc..'r1r', 'ramp-1', '(ship_ship_floor.png^['..shipval..')^[transform2', colbox_ramp_1},
- {shipcol..' Ramp Top Left', shipdesc..'r2l', 'ramp-2', '(ship_ship_floor.png^['..shipval..')', colbox_stair},
- {shipcol..' Ramp Bottom Left', shipdesc..'r1l', 'ramp-1', '(ship_ship_floor.png^['..shipval..')', colbox_ramp_1}
- }
- for i in ipairs (ship_floor) do
- local desc = ship_floor[i][1]
- local name = ship_floor[i][2]
- local model = ship_floor[i][3]
- local tex = ship_floor[i][4]
- local colbox = ship_floor[i][5]
- minetest.register_node('ship:'..name, {
- description = desc,
- drawtype = 'mesh',
- mesh = 'ship_'..model..'.obj',
- paramtype = 'light',
- paramtype2 = 'facedir',
- light_source = 3,
- selection_box = colbox,
- collision_box = colbox,
- tiles = {'ship_floor_blank.png^'..tex, 'ship_floor_blank.png'},
- groups = {breakable=1},
- after_place_node = function(pos, placer, itemstack, pointed_thing)
- local something = pointed_thing.under
- local node = minetest.get_node(pointed_thing.under)
- if node.name == 'ship:'..name then
- minetest.set_node(pos, {name = 'ship:'..name, param2=node.param2})
- end
- end,
- })
- end
- end
|