rails.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. local colbox_rail_angle = {
  2. type = 'fixed',
  3. fixed = {
  4. {-.4, -.5, -.4, -.3, .3, -.3},
  5. {-.3, -.5, -.3, -.2, .3, -.2},
  6. {-.2, -.5, -.2, -.1, .3, -.1},
  7. {-.1, -.5, -.1, 0, .3, 0},
  8. {0, -.5, 0, .1, .3, .1},
  9. {.1, -.5, .1, .2, .3, .2},
  10. {.2, -.5, .2, .3, .3, .3},
  11. {.3, -.5, .3, .4, .3, .4},
  12. }
  13. }
  14. local colbox_rail_single = {
  15. type = 'fixed',
  16. fixed = {
  17. {-.5, -.5, .4, .5, .3, .5},
  18. }
  19. }
  20. local colbox_rail_double = {
  21. type = 'fixed',
  22. fixed = {
  23. {-.5, -.5, -.5, -.4, .3, .5},
  24. {.4, -.5, -.5, .5, .3, .5}
  25. }
  26. }
  27. local colbox_rail_corner = {
  28. type = 'fixed',
  29. fixed = {
  30. {.4, -.5, -.5, .5, .3, .5},
  31. {-.5, -.5, .4, .5, .3, .5}
  32. }
  33. }
  34. for i in ipairs (ship_parts_colors) do
  35. local shipcol = ship_parts_colors[i][1]
  36. local shipval = ship_parts_colors[i][2]
  37. local shipdesc = ship_parts_colors[i][3]
  38. local ship_rail = { -- description, name, model, texture, colbox
  39. {shipcol..' Rail Angled', shipdesc..'ra', 'rail_angle', '(ship_rail_overlay.png^['..shipval..')', colbox_rail_angle},
  40. {shipcol..' Rail Single', shipdesc..'rs', 'rail_single', '(ship_rail_overlay.png^['..shipval..')', colbox_rail_single},
  41. {shipcol..' Rail Double', shipdesc..'rd', 'rail_double', '(ship_rail_overlay.png^['..shipval..')', colbox_rail_double},
  42. {shipcol..' Rail Corner', shipdesc..'rc', 'rail_corner', '(ship_rail_overlay.png^['..shipval..')', colbox_rail_corner}
  43. }
  44. for i in ipairs (ship_rail) do
  45. local desc = ship_rail[i][1]
  46. local name = ship_rail[i][2]
  47. local model = ship_rail[i][3]
  48. local tex = ship_rail[i][4]
  49. local colbox = ship_rail[i][5]
  50. minetest.register_node('ship:'..name, {
  51. description = desc,
  52. drawtype = 'mesh',
  53. mesh = 'ship_'..model..'.obj',
  54. paramtype = 'light',
  55. paramtype2 = 'facedir',
  56. light_source = 4,
  57. selection_box = colbox,
  58. collision_box = colbox,
  59. tiles = {'ship_rail_blank.png^'..tex},
  60. groups = {breakable=1,}
  61. })
  62. end
  63. end