space.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. local cbox_full = {
  2. type = "fixed",
  3. fixed = {
  4. {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  5. }
  6. }
  7. local cbox_pinstripe = {
  8. type = "fixed",
  9. fixed = {
  10. {-0.125, -0.5, -0.5, 0.125, -0.49, 0.5},
  11. }
  12. }
  13. local cbox_pinstripe_45 = {
  14. type = "fixed",
  15. fixed = {
  16. {-0.125, -0.5, 0.4375, 0.1875, -0.49, 0.5},
  17. {-0.0625, -0.5, 0.375, 0.25, -0.49, 0.4375},
  18. {0, -0.5, 0.3125, 0.3125, -0.49, 0.375},
  19. {0.0625, -0.5, 0.25, 0.375, -0.49, 0.3125},
  20. {0.125, -0.5, 0.1875, 0.4375, -0.49, 0.25},
  21. {0.1875, -0.5, 0.125, 0.5, -0.49, 0.1875},
  22. {0.25, -0.5, 0.0625, 0.5, -0.49, 0.125},
  23. {0.3125, -0.5, 0, 0.5, -0.49, 0.0625},
  24. {0.375, -0.5, -0.0625, 0.5, -0.49, 0},
  25. {0.4375, -0.5, -0.125, 0.5, -0.49, -0.0625},
  26. }
  27. }
  28. local wall_col = {{"White",100},{"Black",180},{"Red",150},{"Lime",170}}
  29. for i in ipairs(wall_col) do
  30. local desc = wall_col[i][1]
  31. local num = wall_col[i][2]
  32. local col = string.lower(desc)
  33. minetest.register_node("decor:ship_wall_"..col, {
  34. description = "Ship Wall "..desc,
  35. tiles = {"decor_ship.png^decor_ship_overlay.png^[colorize:"..col..":"..num},
  36. drawtype = "normal",
  37. paramtype = "light",
  38. paramtype2 = "facedir",
  39. pointable = true,
  40. is_ground_content = false,
  41. groups = {cracky=3,not_in_creative_inventory=0},
  42. })
  43. stairs.register_stair_and_slab("ship_wall_"..col,
  44. "decor:ship_wall_"..col,
  45. {cracky=3,not_in_creative_inventory=0},
  46. {"decor_ship.png^decor_ship_overlay.png^[colorize:"..col..":"..num},
  47. desc.." Ship Stairs",
  48. desc.."Ship Slab",
  49. default.node_sound_stone_defaults())
  50. minetest.register_node("decor:pinstrip_"..col, {
  51. description = "Pinstripe",
  52. tiles = {"decor_ship.png^[colorize:"..col..":220"},
  53. drawtype = "nodebox",
  54. paramtype = "light",
  55. paramtype2 = "facedir",
  56. sunlight_propagates = true,
  57. groups = {oddly_breakable_by_hand = 2,not_in_creative_inventory=0},
  58. node_box = cbox_pinstripe,
  59. collision_box = cbox_pinstripe,
  60. })
  61. minetest.register_node("decor:pinstrip_45_"..col, {
  62. description = "Pinstripe 45",
  63. tiles = {"decor_ship.png^[colorize:"..col..":220"},
  64. drawtype = "nodebox",
  65. paramtype = "light",
  66. paramtype2 = "facedir",
  67. sunlight_propagates = true,
  68. pointable = true,
  69. is_ground_content = false,
  70. groups = {cracky=3,not_in_creative_inventory=0},
  71. node_box = cbox_pinstripe_45,
  72. collision_box = cbox_pinstripe_45,
  73. })
  74. end
  75. local ship_parts = {
  76. {"Pipes", "decor_ship.png^[colorize:black:100", cbox_full ,{oddly_breakable_by_hand = 2}},
  77. {"Pipes Corner", "decor_ship.png^[colorize:black:100", cbox_full ,{oddly_breakable_by_hand = 2}},
  78. {"Floor Grate", "decor_ship.png", cbox_full ,{oddly_breakable_by_hand = 2}},
  79. {"Grooved Wall", "decor_ship.png", cbox_full ,{oddly_breakable_by_hand = 2}},
  80. {"Ship Ladder", "decor_ship.png^[colorize:black:180", cbox_full ,{oddly_breakable_by_hand = 2}},
  81. }
  82. for i in ipairs (ship_parts) do
  83. local desc = ship_parts[i][1]
  84. local img = ship_parts[i][2]
  85. local col = ship_parts[i][3]
  86. local gro = ship_parts[i][4]
  87. local itm = string.lower(string.gsub(desc," ","_"))
  88. minetest.register_node("decor:"..itm, {
  89. description = desc,
  90. drawtype = "mesh",
  91. mesh = "decor_"..itm..'.obj',
  92. paramtype = "light",
  93. paramtype2 = "facedir",
  94. selection_box = col,
  95. collision_box = col,
  96. tiles = {img},
  97. groups = gro,
  98. })
  99. end
  100. local ship_models = { -- description, name, model, texture, colbox, light
  101. {'Walkway Inside Corner', 'eic', 'edge_incorner', 'floor_corner_inside.png', 'something', 2},
  102. {'Walkway Outside Corner', 'eoc', 'edge_outcorner', 'floor_corner_outside.png', 'something', 2},
  103. {'Walkway Edge', 'es', 'edge_straight', 'floor.png', 'something', 2},
  104. {'Floor Angle', 'fa', 'floor_angle', 'floor_angle.png', 'something', 2},
  105. {'Floor Square', 'fs', 'floor_square', 'floor_double.png', 'something', 2},
  106. {'Rail Angled', 'ra', 'rail_angle', 'rail.png', 'soemthing', 4},
  107. {'Rail Single', 'rs', 'rail_single', 'rail.png', 'something', 4},
  108. {'Rail Double', 'rd', 'rail_double', 'rail.png', 'something', 4}
  109. }
  110. for i in ipairs (ship_models) do
  111. local desc = ship_models[i][1]
  112. local name = ship_models[i][2]
  113. local model = ship_models[i][3]
  114. local tex = ship_models[i][4]
  115. -- local colbox = ship_models[i][5]
  116. local lit = ship_models[i][6]
  117. minetest.register_node('decor:ss_'..name, {
  118. description = desc,
  119. drawtype = "mesh",
  120. mesh = "ss_"..model..'.obj',
  121. paramtype = "light",
  122. paramtype2 = "facedir",
  123. light_source = lit,
  124. -- selection_box = colbox,
  125. -- collision_box = colbox,
  126. tiles = {'decor_ship_'..tex},
  127. groups = {oddly_breakable_by_hand=1}
  128. })
  129. end