nodes_feldweg.lua 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. ---------------------------------------------------------------------------------------
  2. -- decoration and building material
  3. ---------------------------------------------------------------------------------------
  4. -- * includes a wagon wheel that can be used as decoration on walls or to build (stationary) wagons
  5. -- * dirt road - those are more natural in small old villages than cobble roads
  6. -- * loam - no, old buildings are usually not built out of clay; loam was used
  7. -- * straw - useful material for roofs
  8. -- * glass pane - an improvement compared to fence posts as windows :-)
  9. ---------------------------------------------------------------------------------------
  10. local S = cottages.S
  11. -- supported modes:
  12. -- * simple: only a straight dirt road; no curves, junctions etc.
  13. -- * flat: each node is a full node; junction, t-junction and corner are included
  14. -- * nodebox: like flat - except that each node has a nodebox that fits to that road node
  15. -- * mesh: like nodebox - except that it uses a nice roundish model
  16. local cottages_feldweg_mode = minetest.settings:get("cottages_feldweg_mode")
  17. if( cottages_feldweg_mode ~= "mesh"
  18. and cottages_feldweg_mode ~= "flat"
  19. and cottages_feldweg_mode ~= "nodebox"
  20. and cottages_feldweg_mode ~= "flat") then
  21. cottages_feldweg_mode = "mesh";
  22. -- add the setting to the minetest.conf so that the player can set it there
  23. minetest.settings:set("cottages_feldweg_mode", "mesh")
  24. end
  25. local function register_recipes(include_end)
  26. minetest.register_craft({
  27. output = "cottages:feldweg_crossing 5",
  28. recipe = {
  29. {"", "cottages:feldweg", "" },
  30. {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"},
  31. {"", "cottages:feldweg", "" },
  32. },
  33. })
  34. minetest.register_craft({
  35. output = "cottages:feldweg_t_junction 5",
  36. recipe = {
  37. {"", "cottages:feldweg", "" },
  38. {"", "cottages:feldweg", "" },
  39. {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}
  40. },
  41. })
  42. minetest.register_craft({
  43. output = "cottages:feldweg_curve 5",
  44. recipe = {
  45. {"cottages:feldweg", "", "" },
  46. {"cottages:feldweg", "", ""},
  47. {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}
  48. },
  49. })
  50. if include_end then
  51. minetest.register_craft({
  52. output = "cottages:feldweg_end 5",
  53. recipe = {
  54. {"cottages:feldweg", "", "cottages:feldweg" },
  55. {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}
  56. },
  57. })
  58. end
  59. end
  60. --- a nice dirt road for small villages or paths to fields
  61. if( cottages_feldweg_mode == "simple" or cottages_feldweg_mode == "flat" ) then
  62. minetest.register_node("cottages:feldweg", {
  63. description = S("dirt road"),
  64. tiles = {"cottages_feldweg.png","default_dirt.png", "default_dirt.png^default_grass_side.png"},
  65. paramtype2 = "facedir",
  66. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  67. legacy_facedir_simple = true,
  68. groups = {crumbly=3},
  69. sounds = cottages.sounds.dirt,
  70. is_ground_content = false,
  71. })
  72. end
  73. -- add crossing, t-junction and corner
  74. --
  75. -- flat - just textures, full blocks
  76. --
  77. if( cottages_feldweg_mode == "flat" ) then
  78. minetest.register_node("cottages:feldweg_crossing", {
  79. description = S("dirt road crossing"),
  80. tiles = {"cottages_feldweg_kreuzung.png","default_dirt.png", "default_dirt.png^default_grass_side.png"},
  81. paramtype2 = "facedir",
  82. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  83. legacy_facedir_simple = true,
  84. groups = {crumbly=3},
  85. sounds = cottages.sounds.dirt,
  86. is_ground_content = false,
  87. })
  88. minetest.register_node("cottages:feldweg_t_junction", {
  89. description = S("dirt road t junction"),
  90. tiles = {"cottages_feldweg_t-kreuzung.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"},
  91. paramtype2 = "facedir",
  92. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  93. legacy_facedir_simple = true,
  94. groups = {crumbly=3},
  95. sounds = cottages.sounds.dirt,
  96. is_ground_content = false,
  97. })
  98. minetest.register_node("cottages:feldweg_curve", {
  99. description = S("dirt road curve"),
  100. tiles = {"cottages_feldweg_ecke.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"},
  101. paramtype2 = "facedir",
  102. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  103. legacy_facedir_simple = true,
  104. groups = {crumbly=3},
  105. sounds = cottages.sounds.dirt,
  106. is_ground_content = false,
  107. })
  108. register_recipes(false)
  109. --
  110. -- cube-style nodebox version
  111. --
  112. elseif( cottages_feldweg_mode == "nodebox" ) then
  113. minetest.register_node("cottages:feldweg", {
  114. description = S("dirt road"),
  115. tiles = {"cottages_feldweg_orig.png","default_dirt.png", "default_dirt.png^default_grass_side.png"},
  116. paramtype2 = "facedir",
  117. roups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  118. legacy_facedir_simple = true,
  119. groups = {crumbly=3},
  120. sounds = cottages.sounds.dirt,
  121. is_ground_content = false,
  122. drawtype = "nodebox",
  123. -- top, bottom, side1, side2, inner, outer
  124. paramtype = "light",
  125. node_box = {
  126. type = "fixed",
  127. fixed = {
  128. { -0.5, -0.5, -0.5, 0.5, 0.5-2/16, 0.5},
  129. -- Rasenkanten
  130. { -0.5, 0.5-2/16, -0.5, -0.5+3/16, 0.5, 0.5},
  131. { 0.5-3/16, 0.5-2/16, -0.5, 0.5, 0.5, 0.5},
  132. -- uebergang zwischen Wagenspur und Rasenkante
  133. { -0.5+3/16, 0.5-2/16, -0.5, -0.5+4/16, 0.5-1/16, 0.5},
  134. { 0.5-4/16, 0.5-2/16, -0.5, 0.5-3/16, 0.5-1/16, 0.5},
  135. },
  136. },
  137. selection_box = {
  138. type = "fixed",
  139. fixed = {
  140. { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  141. },
  142. },
  143. })
  144. minetest.register_node("cottages:feldweg_crossing", {
  145. description = S("dirt road crossing"),
  146. tiles = {"cottages_feldweg_kreuzung.png","default_dirt.png", "default_dirt.png^default_grass_side.png"},
  147. paramtype2 = "facedir",
  148. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  149. legacy_facedir_simple = true,
  150. groups = {crumbly=3},
  151. sounds = cottages.sounds.dirt,
  152. is_ground_content = false,
  153. drawtype = "nodebox",
  154. -- top, bottom, side1, side2, inner, outer
  155. paramtype = "light",
  156. node_box = {
  157. type = "fixed",
  158. fixed = {
  159. { -0.5, -0.5, -0.5, 0.5, 0.5-2/16, 0.5},
  160. -- Rasenkanten
  161. { -0.5, 0.5-2/16, -0.5, -0.5+3/16, 0.5, -0.5+3/16},
  162. { 0.5-3/16, 0.5-2/16, -0.5, 0.5, 0.5, -0.5+3/16},
  163. { -0.5, 0.5-2/16, 0.5-3/16, -0.5+3/16, 0.5, 0.5},
  164. { 0.5-3/16, 0.5-2/16, 0.5-3/16, 0.5, 0.5, 0.5},
  165. -- uebergang zwischen Wagenspur und Rasenkante
  166. { -0.5+3/16, 0.5-2/16, -0.5, -0.5+4/16, 0.5-1/16, -0.5+4/16},
  167. { 0.5-4/16, 0.5-2/16, -0.5, 0.5-3/16, 0.5-1/16, -0.5+4/16},
  168. { -0.5+3/16, 0.5-2/16, 0.5-4/16, -0.5+4/16, 0.5-1/16, 0.5},
  169. { 0.5-4/16, 0.5-2/16, 0.5-4/16, 0.5-3/16, 0.5-1/16, 0.5},
  170. { -0.5, 0.5-2/16, -0.5+3/16, -0.5+3/16, 0.5-1/16, -0.5+4/16},
  171. { 0.5-3/16, 0.5-2/16, -0.5+3/16, 0.5, 0.5-1/16, -0.5+4/16},
  172. { -0.5, 0.5-2/16, 0.5-4/16, -0.5+3/16, 0.5-1/16, 0.5-3/16},
  173. { 0.5-3/16, 0.5-2/16, 0.5-4/16, 0.5, 0.5-1/16, 0.5-3/16},
  174. },
  175. },
  176. selection_box = {
  177. type = "fixed",
  178. fixed = {
  179. { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  180. },
  181. },
  182. })
  183. minetest.register_node("cottages:feldweg_t_junction", {
  184. description = S("dirt road t junction"),
  185. tiles = {"cottages_feldweg_t-kreuzung.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"},
  186. paramtype2 = "facedir",
  187. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  188. legacy_facedir_simple = true,
  189. groups = {crumbly=3},
  190. sounds = cottages.sounds.dirt,
  191. is_ground_content = false,
  192. drawtype = "nodebox",
  193. -- top, bottom, side1, side2, inner, outer
  194. paramtype = "light",
  195. node_box = {
  196. type = "fixed",
  197. fixed = {
  198. { -0.5, -0.5, -0.5, 0.5, 0.5-2/16, 0.5},
  199. -- Rasenkanten
  200. { -0.5, 0.5-2/16, -0.5, -0.5+3/16, 0.5, -0.5+3/16},
  201. { -0.5, 0.5-2/16, 0.5-3/16, -0.5+3/16, 0.5, 0.5},
  202. -- Rasenkante seitlich durchgehend
  203. { 0.5-3/16, 0.5-2/16, -0.5, 0.5, 0.5, 0.5},
  204. -- uebergang zwischen Wagenspur und Rasenkante
  205. { -0.5+3/16, 0.5-2/16, -0.5, -0.5+4/16, 0.5-1/16, -0.5+4/16},
  206. { -0.5+3/16, 0.5-2/16, 0.5-4/16, -0.5+4/16, 0.5-1/16, 0.5},
  207. { -0.5, 0.5-2/16, -0.5+3/16, -0.5+3/16, 0.5-1/16, -0.5+4/16},
  208. { -0.5, 0.5-2/16, 0.5-4/16, -0.5+3/16, 0.5-1/16, 0.5-3/16},
  209. -- Ueberganng seitlich durchgehend
  210. { 0.5-4/16, 0.5-2/16, -0.5, 0.5-3/16, 0.5-1/16, 0.5},
  211. },
  212. },
  213. selection_box = {
  214. type = "fixed",
  215. fixed = {
  216. { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  217. },
  218. },
  219. })
  220. minetest.register_node("cottages:feldweg_curve", {
  221. description = S("dirt road curve"),
  222. tiles = {"cottages_feldweg_ecke.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"},
  223. paramtype2 = "facedir",
  224. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  225. legacy_facedir_simple = true,
  226. groups = {crumbly=3},
  227. sounds = cottages.sounds.dirt,
  228. is_ground_content = false,
  229. drawtype = "nodebox",
  230. -- top, bottom, side1, side2, inner, outer
  231. paramtype = "light",
  232. node_box = {
  233. type = "fixed",
  234. fixed = {
  235. { -0.5, -0.5, -0.5, 0.5, 0.5-2/16, 0.5},
  236. -- Rasenkante vorne durchgehend
  237. { -0.5, 0.5-2/16, -0.5, 0.5-3/16, 0.5, -0.5+3/16},
  238. -- Rasenkanten
  239. { -0.5, 0.5-2/16, 0.5-3/16, -0.5+3/16, 0.5, 0.5},
  240. -- Rasenkante seitlich durchgehend
  241. { 0.5-3/16, 0.5-2/16, -0.5, 0.5, 0.5, 0.5},
  242. -- uebergang zwischen Wagenspur und Rasenkante
  243. { -0.5+3/16, 0.5-2/16, 0.5-4/16, -0.5+4/16, 0.5-1/16, 0.5},
  244. -- Uebergang vorne durchgehend
  245. { -0.5, 0.5-2/16, -0.5+3/16, 0.5-3/16, 0.5-1/16, -0.5+4/16},
  246. { -0.5, 0.5-2/16, 0.5-4/16, -0.5+3/16, 0.5-1/16, 0.5-3/16},
  247. -- Ueberganng seitlich durchgehend
  248. { 0.5-4/16, 0.5-2/16, -0.5, 0.5-3/16, 0.5-1/16, 0.5},
  249. },
  250. },
  251. selection_box = {
  252. type = "fixed",
  253. fixed = {
  254. { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  255. },
  256. },
  257. })
  258. register_recipes(false)
  259. --
  260. -- the mesh version (rounded); provided and created by VanessaE
  261. --
  262. elseif( cottages_feldweg_mode == "mesh" ) then
  263. -- a nice dirt road for small villages or paths to fields
  264. minetest.register_node("cottages:feldweg", {
  265. description = S("dirt road"),
  266. paramtype2 = "facedir",
  267. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  268. legacy_facedir_simple = true,
  269. groups = {crumbly=3},
  270. sounds = cottages.sounds.dirt,
  271. is_ground_content = false,
  272. tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png",
  273. "default_dirt.png", "default_grass.png",
  274. "cottages_feldweg_surface.png",
  275. "cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
  276. paramtype = "light",
  277. drawtype = "mesh",
  278. mesh = "feldweg.obj",
  279. })
  280. minetest.register_node("cottages:feldweg_crossing", {
  281. description = S("dirt road crossing"),
  282. paramtype2 = "facedir",
  283. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  284. legacy_facedir_simple = true,
  285. groups = {crumbly=3},
  286. sounds = cottages.sounds.dirt,
  287. is_ground_content = false,
  288. tiles = {"cottages_feldweg_end.png","default_dirt.png",
  289. "default_grass.png","cottages_feldweg_surface.png",
  290. "cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
  291. paramtype = "light",
  292. drawtype = "mesh",
  293. mesh = "feldweg-crossing.obj",
  294. })
  295. minetest.register_node("cottages:feldweg_t_junction", {
  296. description = S("dirt road t junction"),
  297. paramtype2 = "facedir",
  298. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  299. legacy_facedir_simple = true,
  300. groups = {crumbly=3},
  301. sounds = cottages.sounds.dirt,
  302. is_ground_content = false,
  303. tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", "default_dirt.png",
  304. "default_grass.png","cottages_feldweg_surface.png",
  305. "cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
  306. paramtype = "light",
  307. drawtype = "mesh",
  308. mesh = "feldweg-T-junction.obj",
  309. })
  310. minetest.register_node("cottages:feldweg_curve", {
  311. description = S("dirt road curve"),
  312. paramtype2 = "facedir",
  313. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  314. legacy_facedir_simple = true,
  315. groups = {crumbly=3},
  316. sounds = cottages.sounds.dirt,
  317. is_ground_content = false,
  318. tiles = {"default_dirt.png^default_grass_side.png","default_grass.png",
  319. "default_dirt.png^default_grass_side.png","cottages_feldweg_surface.png",
  320. "default_dirt.png","cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
  321. paramtype = "light",
  322. drawtype = "mesh",
  323. mesh = "feldweg-curve.obj",
  324. })
  325. minetest.register_node("cottages:feldweg_end", {
  326. description = S("dirt road end"),
  327. paramtype2 = "facedir",
  328. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  329. legacy_facedir_simple = true,
  330. groups = {crumbly=3},
  331. sounds = cottages.sounds.dirt,
  332. is_ground_content = false,
  333. tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png",
  334. "default_dirt.png", "default_grass.png",
  335. "cottages_feldweg_surface.png^cottages_feldweg_edges.png",
  336. "cottages_feldweg_surface.png"},
  337. paramtype = "light",
  338. drawtype = "mesh",
  339. mesh = "feldweg_end.obj",
  340. })
  341. register_recipes(true)
  342. end
  343. -- create stairs if possible
  344. if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab) then
  345. stairs.register_stair_and_slab("feldweg", "cottages:feldweg",
  346. {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  347. {"cottages_feldweg.png","default_dirt.png", "default_grass.png","default_grass.png","cottages_feldweg.png","cottages_feldweg.png"},
  348. S("Dirt Road Stairs"),
  349. S("Dirt Road, half height"),
  350. cottages.sounds.dirt)
  351. end
  352. if( cottages_feldweg_mode == "nodebox" or cottages_feldweg_mode == "mesh" ) then
  353. local box_slope = {
  354. type = "fixed",
  355. fixed = {
  356. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  357. {-0.5, -0.25, -0.25, 0.5, 0, 0.5},
  358. {-0.5, 0, 0, 0.5, 0.25, 0.5},
  359. {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}
  360. }};
  361. local box_slope_long = {
  362. type = "fixed",
  363. fixed = {
  364. {-0.5, -0.5, -1.5, 0.5, -0.10, 0.5},
  365. {-0.5, -0.25, -1.3, 0.5, -0.25, 0.5},
  366. {-0.5, -0.25, -1.0, 0.5, 0, 0.5},
  367. {-0.5, 0, -0.5, 0.5, 0.25, 0.5},
  368. {-0.5, 0.25, 0, 0.5, 0.5, 0.5}
  369. }};
  370. minetest.register_node("cottages:feldweg_slope", {
  371. description = S("dirt road slope"),
  372. paramtype2 = "facedir",
  373. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  374. legacy_facedir_simple = true,
  375. groups = {crumbly=3},
  376. sounds = cottages.sounds.dirt,
  377. is_ground_content = false,
  378. tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png",
  379. "default_dirt.png", "default_grass.png",
  380. "cottages_feldweg_surface.png",
  381. "cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
  382. paramtype = "light",
  383. drawtype = "mesh",
  384. mesh = "feldweg_slope.obj",
  385. collision_box = box_slope,
  386. selection_box = box_slope,
  387. })
  388. minetest.register_node("cottages:feldweg_slope_long", {
  389. description = S("dirt road slope long"),
  390. paramtype2 = "facedir",
  391. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  392. legacy_facedir_simple = true,
  393. groups = {crumbly=3},
  394. sounds = cottages.sounds.dirt,
  395. is_ground_content = false,
  396. tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png",
  397. "default_dirt.png", "default_grass.png",
  398. "cottages_feldweg_surface.png",
  399. "cottages_feldweg_surface.png^cottages_feldweg_edges.png"},
  400. paramtype = "light",
  401. drawtype = "mesh",
  402. mesh = "feldweg_slope_long.obj",
  403. collision_box = box_slope_long,
  404. selection_box = box_slope_long,
  405. })
  406. minetest.register_craft({
  407. output = "cottages:feldweg_slope 3",
  408. recipe = {
  409. {"cottages:feldweg", "", "" },
  410. {"cottages:feldweg", "cottages:feldweg", ""}
  411. },
  412. })
  413. minetest.register_craft({
  414. output = "cottages:feldweg_slope_long 4",
  415. recipe = {
  416. {"cottages:feldweg", "", "" },
  417. {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}
  418. },
  419. })
  420. end