properties.lua 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. -- Test Nodes: Node property tests
  2. local S = core.get_translator("testnodes")
  3. -- Is supposed to fall when it doesn't rest on solid ground
  4. core.register_node("testnodes:falling", {
  5. description = S("Falling Node").."\n"..
  6. S("Falls down if no node below"),
  7. tiles = {
  8. "testnodes_node.png",
  9. "testnodes_node.png",
  10. "testnodes_node_falling.png",
  11. },
  12. groups = { falling_node = 1, dig_immediate = 3 },
  13. })
  14. core.register_node("testnodes:falling_facedir", {
  15. description = S("Falling Facedir Node").."\n"..
  16. S("Falls down if no node below").."\n"..
  17. S("param2 = facedir rotation"),
  18. tiles = {
  19. "testnodes_node_falling_1.png",
  20. "testnodes_node_falling_2.png",
  21. "testnodes_node_falling_3.png",
  22. "testnodes_node_falling_4.png",
  23. "testnodes_node_falling_5.png",
  24. "testnodes_node_falling_6.png",
  25. },
  26. paramtype2 = "facedir",
  27. groups = { falling_node = 1, dig_immediate = 3 },
  28. })
  29. -- Same as falling node, but will stop falling on top of liquids
  30. core.register_node("testnodes:falling_float", {
  31. description = S("Falling+Floating Node").."\n"..
  32. S("Falls down if no node below, floats on liquids (liquidtype ~= \"none\")"),
  33. groups = { falling_node = 1, float = 1, dig_immediate = 3 },
  34. tiles = {
  35. "testnodes_node.png",
  36. "testnodes_node.png",
  37. "testnodes_node_falling.png",
  38. },
  39. color = "cyan",
  40. })
  41. -- This node attaches to the floor and drops as item
  42. -- when the floor is gone.
  43. core.register_node("testnodes:attached", {
  44. description = S("Floor-Attached Node").."\n"..
  45. S("Drops as item if no solid node below"),
  46. tiles = {
  47. "testnodes_attached_top.png",
  48. "testnodes_attached_bottom.png",
  49. "testnodes_attached_side.png",
  50. },
  51. groups = { attached_node = 1, dig_immediate = 3 },
  52. })
  53. -- This node attaches to the side of a node and drops as item
  54. -- when the node it attaches to is gone.
  55. core.register_node("testnodes:attached_wallmounted", {
  56. description = S("Wallmounted Attached Node").."\n"..
  57. S("Attaches to solid node it was placed on; drops as item if neighbor node is gone").."\n"..
  58. S("param2 = wallmounted rotation (0..7)"),
  59. paramtype2 = "wallmounted",
  60. tiles = {
  61. "testnodes_attachedw_top.png",
  62. "testnodes_attachedw_bottom.png",
  63. "testnodes_attachedw_side.png",
  64. },
  65. groups = { attached_node = 1, dig_immediate = 3 },
  66. })
  67. -- This node attaches to the side of a node and drops as item
  68. -- when the node it attaches to is gone.
  69. -- Also adds vertical 90° rotation variants.
  70. core.register_node("testnodes:attached_wallmounted_rot", {
  71. description = S("Rotatable Wallmounted Attached Node").."\n"..
  72. S("Attaches to solid node it was placed on; drops as item if neighbor node is gone").."\n"..
  73. S("param2 = wallmounted rotation (0..7)").."\n"..
  74. S("May be rotated by 90° if placed at floor or ceiling"),
  75. paramtype2 = "wallmounted",
  76. tiles = {
  77. "testnodes_attachedwr_top.png",
  78. "testnodes_attachedwr_bottom.png",
  79. "testnodes_attachedwr_side.png",
  80. },
  81. wallmounted_rotate_vertical = true,
  82. groups = { attached_node = 1, dig_immediate = 3 },
  83. })
  84. -- Wallmounted node that always attaches to the floor
  85. core.register_node("testnodes:attached_wallmounted_floor", {
  86. description = S("Floor-Attached Wallmounted Node").."\n"..
  87. S("Drops as item if no solid node below (regardless of rotation)").."\n"..
  88. S("param2 = wallmounted rotation (visual only) (0..7)"),
  89. paramtype2 = "wallmounted",
  90. tiles = {
  91. "testnodes_attached_top.png",
  92. "testnodes_attached_bottom.png",
  93. "testnodes_attached_side.png",
  94. },
  95. groups = { attached_node = 3, dig_immediate = 3 },
  96. color = "#FF8080",
  97. })
  98. -- Wallmounted node that always attaches to the floor.
  99. -- Also adds 90° rotation variants.
  100. core.register_node("testnodes:attached_wallmounted_floor_rot", {
  101. description = S("Rotatable Floor-Attached Wallmounted Node").."\n"..
  102. S("Drops as item if no solid node below (regardless of rotation)").."\n"..
  103. S("param2 = wallmounted rotation (visual only) (0..7)").."\n"..
  104. S("May be rotated by 90° if placed at floor or ceiling"),
  105. paramtype2 = "wallmounted",
  106. tiles = {
  107. "testnodes_attachedfr_top.png",
  108. "testnodes_attachedfr_bottom.png",
  109. "testnodes_attachedfr_side.png",
  110. },
  111. wallmounted_rotate_vertical = true,
  112. groups = { attached_node = 3, dig_immediate = 3 },
  113. })
  114. -- This node attaches to the ceiling and drops as item
  115. -- when the ceiling is gone.
  116. core.register_node("testnodes:attached_top", {
  117. description = S("Ceiling-Attached Node").."\n"..
  118. S("Drops as item if no solid node above"),
  119. tiles = {
  120. "testnodes_attached_bottom.png",
  121. "testnodes_attached_top.png",
  122. "testnodes_attached_side.png^[transformR180",
  123. },
  124. groups = { attached_node = 4, dig_immediate = 3 },
  125. })
  126. -- Same as wallmounted attached, but for facedir
  127. core.register_node("testnodes:attached_facedir", {
  128. description = S("Facedir Attached Node").."\n"..
  129. S("Attaches to a neighboring solid node; drops as item if that node is gone").."\n"..
  130. S("param2 = facedir rotation (0..23)"),
  131. paramtype2 = "facedir",
  132. tiles = {
  133. "testnodes_attachedf_side.png^[transformR180",
  134. "testnodes_attachedf_side.png",
  135. "testnodes_attachedf_side.png^[transformR90",
  136. "testnodes_attachedf_side.png^[transformR270",
  137. "testnodes_attachedf_bottom.png",
  138. "testnodes_attachedf_top.png",
  139. },
  140. groups = { attached_node = 2, dig_immediate = 3 },
  141. })
  142. -- Same as facedir attached, but for 4dir
  143. core.register_node("testnodes:attached_4dir", {
  144. description = S("4dir Attached Node").."\n"..
  145. S("Attaches to the side of a solid node; drops as item if that node is gone").."\n"..
  146. S("param2 = 4dir rotation (0..3)"),
  147. paramtype2 = "4dir",
  148. tiles = {
  149. "testnodes_attached4_side.png^[transformR180",
  150. "testnodes_attached4_side.png",
  151. "testnodes_attached4_side.png^[transformR90",
  152. "testnodes_attached4_side.png^[transformR270",
  153. "testnodes_attached4_bottom.png",
  154. "testnodes_attached4_top.png",
  155. },
  156. groups = { attached_node = 2, dig_immediate = 3 },
  157. })
  158. -- Jump disabled
  159. core.register_node("testnodes:nojump", {
  160. description = S("Non-jumping Node").."\n"..
  161. S("You can't jump on it"),
  162. groups = {disable_jump=1, dig_immediate=3},
  163. tiles = {"testnodes_nojump_top.png", "testnodes_nojump_side.png"},
  164. })
  165. -- Jump disabled plant
  166. core.register_node("testnodes:nojump_walkable", {
  167. description = S("Non-jumping Plant Node").."\n"..
  168. S("You can't jump while your feet are in it"),
  169. drawtype = "plantlike",
  170. groups = {disable_jump=1, dig_immediate=3},
  171. walkable = false,
  172. tiles = {"testnodes_nojump_top.png"},
  173. })
  174. local climbable_nodebox = {
  175. type = "regular",
  176. }
  177. -- Climbable up and down with jump and sneak keys
  178. core.register_node("testnodes:climbable", {
  179. description = S("Climbable Node").."\n"..
  180. S("You can climb up and down"),
  181. climbable = true,
  182. walkable = false,
  183. paramtype = "light",
  184. sunlight_propagates = true,
  185. is_ground_content = false,
  186. tiles = {"testnodes_climbable_top.png","testnodes_climbable_top.png","testnodes_climbable_side.png"},
  187. use_texture_alpha = "clip",
  188. drawtype = "nodebox",
  189. node_box = climbable_nodebox,
  190. groups = {dig_immediate=3},
  191. })
  192. -- Climbable only downwards with sneak key
  193. core.register_node("testnodes:climbable_nojump", {
  194. description = S("Downwards-climbable Node").."\n"..
  195. S("You can climb only downwards"),
  196. climbable = true,
  197. walkable = false,
  198. groups = {disable_jump=1, dig_immediate=3},
  199. drawtype = "nodebox",
  200. node_box = climbable_nodebox,
  201. tiles = {"testnodes_climbable_nojump_top.png","testnodes_climbable_nojump_top.png","testnodes_climbable_nojump_side.png"},
  202. use_texture_alpha = "clip",
  203. paramtype = "light",
  204. sunlight_propagates = true,
  205. })
  206. core.register_node("testnodes:climbable_nodescend", {
  207. description = S("Upwards-climbable Node"),
  208. climbable = true,
  209. walkable = false,
  210. groups = {disable_descend=1, dig_immediate=3},
  211. drawtype = "nodebox",
  212. node_box = climbable_nodebox,
  213. tiles = {"testnodes_climbable_nodescend_top.png","testnodes_climbable_nodescend_top.png","testnodes_climbable_nodescend_side.png"},
  214. use_texture_alpha = "clip",
  215. paramtype = "light",
  216. sunlight_propagates = true,
  217. })
  218. core.register_node("testnodes:climbable_nodescend_nojump", {
  219. description = S("Horizontal-only Climbable Node"),
  220. climbable = true,
  221. walkable = false,
  222. groups = {disable_jump=1, disable_descend=1, dig_immediate=3},
  223. drawtype = "nodebox",
  224. node_box = climbable_nodebox,
  225. tiles = {"testnodes_climbable_noclimb_top.png","testnodes_climbable_noclimb_top.png","testnodes_climbable_noclimb_side.png"},
  226. use_texture_alpha = "clip",
  227. paramtype = "light",
  228. sunlight_propagates = true,
  229. })
  230. -- A liquid in which you can't rise
  231. core.register_node("testnodes:liquid_nojump", {
  232. description = S("Non-jumping Liquid Source Node").."\n"..
  233. S("Swimmable liquid, but you can't swim upwards"),
  234. liquidtype = "source",
  235. liquid_range = 1,
  236. liquid_viscosity = 0,
  237. liquid_alternative_flowing = "testnodes:liquidflowing_nojump",
  238. liquid_alternative_source = "testnodes:liquid_nojump",
  239. liquid_renewable = false,
  240. groups = {disable_jump=1, dig_immediate=3},
  241. walkable = false,
  242. drawtype = "liquid",
  243. tiles = {"testnodes_liquidsource.png^[colorize:#FF0000:127"},
  244. special_tiles = {
  245. {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = false},
  246. {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = true},
  247. },
  248. use_texture_alpha = "blend",
  249. paramtype = "light",
  250. pointable = false,
  251. liquids_pointable = true,
  252. is_ground_content = false,
  253. post_effect_color = {a = 70, r = 255, g = 0, b = 200},
  254. })
  255. -- A liquid in which you can't rise (flowing variant)
  256. core.register_node("testnodes:liquidflowing_nojump", {
  257. description = S("Non-jumping Flowing Liquid Node").."\n"..
  258. S("Swimmable liquid, but you can't swim upwards"),
  259. liquidtype = "flowing",
  260. liquid_range = 1,
  261. liquid_viscosity = 0,
  262. liquid_alternative_flowing = "testnodes:liquidflowing_nojump",
  263. liquid_alternative_source = "testnodes:liquid_nojump",
  264. liquid_renewable = false,
  265. groups = {disable_jump=1, dig_immediate=3},
  266. walkable = false,
  267. drawtype = "flowingliquid",
  268. tiles = {"testnodes_liquidflowing.png^[colorize:#FF0000:127"},
  269. special_tiles = {
  270. {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
  271. {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
  272. },
  273. use_texture_alpha = "blend",
  274. paramtype = "light",
  275. paramtype2 = "flowingliquid",
  276. pointable = false,
  277. liquids_pointable = true,
  278. is_ground_content = false,
  279. post_effect_color = {a = 70, r = 255, g = 0, b = 200},
  280. })
  281. -- A liquid which doesn't have liquid movement physics (source variant)
  282. core.register_node("testnodes:liquid_noswim", {
  283. description = S("No-swim Liquid Source Node").."\n"..
  284. S("Liquid node, but swimming is disabled"),
  285. liquidtype = "source",
  286. liquid_range = 1,
  287. liquid_viscosity = 0,
  288. liquid_alternative_flowing = "testnodes:liquidflowing_noswim",
  289. liquid_alternative_source = "testnodes:liquid_noswim",
  290. liquid_renewable = false,
  291. liquid_move_physics = false,
  292. groups = {dig_immediate=3},
  293. walkable = false,
  294. drawtype = "liquid",
  295. tiles = {"testnodes_liquidsource.png^[colorize:#FF00FF:127"},
  296. special_tiles = {
  297. {name = "testnodes_liquidsource.png^[colorize:#FF00FF:127", backface_culling = false},
  298. {name = "testnodes_liquidsource.png^[colorize:#FF00FF:127", backface_culling = true},
  299. },
  300. use_texture_alpha = "blend",
  301. paramtype = "light",
  302. pointable = false,
  303. liquids_pointable = true,
  304. buildable_to = true,
  305. is_ground_content = false,
  306. post_effect_color = {a = 70, r = 255, g = 200, b = 200},
  307. })
  308. -- A liquid which doen't have liquid movement physics (flowing variant)
  309. core.register_node("testnodes:liquidflowing_noswim", {
  310. description = S("No-swim Flowing Liquid Node").."\n"..
  311. S("Liquid node, but swimming is disabled"),
  312. liquidtype = "flowing",
  313. liquid_range = 1,
  314. liquid_viscosity = 0,
  315. liquid_alternative_flowing = "testnodes:liquidflowing_noswim",
  316. liquid_alternative_source = "testnodes:liquid_noswim",
  317. liquid_renewable = false,
  318. liquid_move_physics = false,
  319. groups = {dig_immediate=3},
  320. walkable = false,
  321. drawtype = "flowingliquid",
  322. tiles = {"testnodes_liquidflowing.png^[colorize:#FF00FF:127"},
  323. special_tiles = {
  324. {name = "testnodes_liquidflowing.png^[colorize:#FF00FF:127", backface_culling = false},
  325. {name = "testnodes_liquidflowing.png^[colorize:#FF00FF:127", backface_culling = false},
  326. },
  327. use_texture_alpha = "blend",
  328. paramtype = "light",
  329. paramtype2 = "flowingliquid",
  330. pointable = false,
  331. liquids_pointable = true,
  332. buildable_to = true,
  333. is_ground_content = false,
  334. post_effect_color = {a = 70, r = 255, g = 200, b = 200},
  335. })
  336. -- A liquid in which you can't actively descend.
  337. -- Note: You'll still descend slowly by doing nothing.
  338. core.register_node("testnodes:liquid_nodescend", {
  339. description = S("No-descending Liquid Source Node"),
  340. liquidtype = "source",
  341. liquid_range = 0,
  342. liquid_viscosity = 0,
  343. liquid_alternative_flowing = "testnodes:liquidflowing_nodescend",
  344. liquid_alternative_source = "testnodes:liquid_nodescend",
  345. liquid_renewable = false,
  346. groups = {disable_descend=1, dig_immediate=3},
  347. walkable = false,
  348. drawtype = "liquid",
  349. tiles = {"testnodes_liquidsource.png^[colorize:#FFFF00:127"},
  350. special_tiles = {
  351. {name = "testnodes_liquidsource.png^[colorize:#FFFF00:127", backface_culling = false},
  352. {name = "testnodes_liquidsource.png^[colorize:#FFFF00:127", backface_culling = true},
  353. },
  354. use_texture_alpha = "blend",
  355. paramtype = "light",
  356. pointable = false,
  357. liquids_pointable = true,
  358. is_ground_content = false,
  359. post_effect_color = {a = 70, r = 255, g = 255, b = 200},
  360. })
  361. -- A liquid in which you can't actively descend (flowing variant)
  362. core.register_node("testnodes:liquidflowing_nodescend", {
  363. description = S("No-descending Flowing Liquid Node"),
  364. liquidtype = "flowing",
  365. liquid_range = 1,
  366. liquid_viscosity = 0,
  367. liquid_alternative_flowing = "testnodes:liquidflowing_nodescend",
  368. liquid_alternative_source = "testnodes:liquid_nodescend",
  369. liquid_renewable = false,
  370. groups = {disable_descend=1, dig_immediate=3},
  371. walkable = false,
  372. drawtype = "flowingliquid",
  373. tiles = {"testnodes_liquidflowing.png^[colorize:#FFFF00:127"},
  374. special_tiles = {
  375. {name = "testnodes_liquidflowing.png^[colorize:#FFFF00:127", backface_culling = false},
  376. {name = "testnodes_liquidflowing.png^[colorize:#FFFF00:127", backface_culling = false},
  377. },
  378. use_texture_alpha = "blend",
  379. paramtype = "light",
  380. paramtype2 = "flowingliquid",
  381. pointable = false,
  382. liquids_pointable = true,
  383. is_ground_content = false,
  384. post_effect_color = {a = 70, r = 255, g = 255, b = 200},
  385. })
  386. -- Nodes that modify fall damage (various damage modifiers)
  387. for i=-100, 100, 25 do
  388. if i ~= 0 then
  389. local subname, descnum
  390. if i < 0 then
  391. subname = "NEG"..string.format("%03d", math.abs(i))
  392. descnum = tostring(i)
  393. else
  394. subname = string.format("%03d", i)
  395. descnum = S("+@1", i)
  396. end
  397. local tex, color, desc
  398. if i > 0 then
  399. local val = math.floor((i/100)*255)
  400. tex = "testnodes_fall_damage_plus.png"
  401. color = { b=0, g=255-val, r=255, a=255 }
  402. desc = S("Fall Damage Node (+@1%)", i)
  403. else
  404. tex = "testnodes_fall_damage_minus.png"
  405. if i == -100 then
  406. color = { r=0, b=0, g=255, a=255 }
  407. else
  408. local val = math.floor((math.abs(i)/100)*255)
  409. color = { r=0, b=255, g=255-val, a=255 }
  410. end
  411. desc = S("Fall Damage Node (-@1%)", math.abs(i))
  412. end
  413. core.register_node("testnodes:damage"..subname, {
  414. description = desc,
  415. groups = {fall_damage_add_percent=i, dig_immediate=3},
  416. tiles = { tex },
  417. is_ground_content = false,
  418. color = color,
  419. })
  420. end
  421. end
  422. -- Bouncy nodes (various bounce levels)
  423. local MAX_BOUNCE_JUMPY = 180
  424. local MAX_BOUNCE_NONJUMPY = 140
  425. for i=-MAX_BOUNCE_NONJUMPY, MAX_BOUNCE_JUMPY, 20 do
  426. if i ~= 0 then
  427. local desc
  428. local val = math.floor((math.abs(i) - 20) / 200 * 255)
  429. local val2 = math.max(0, 255 - val)
  430. local num = string.format("%03d", math.abs(i))
  431. if i > 0 then
  432. desc = S("Bouncy Node (@1%), jumpy", i).."\n"..
  433. S("Sneaking/jumping affects bounce")
  434. color = { r=val2, g=val2, b=255, a=255 }
  435. else
  436. desc = S("Bouncy Node (@1%), non-jumpy", math.abs(i)).."\n"..
  437. S("Sneaking/jumping does not affect bounce")
  438. color = { r=val2, g=255, b=val2, a=255 }
  439. num = "NEG"..num
  440. end
  441. core.register_node("testnodes:bouncy"..num, {
  442. description = desc,
  443. groups = {bouncy=i, dig_immediate=3},
  444. color = color,
  445. tiles ={"testnodes_bouncy.png"},
  446. is_ground_content = false,
  447. })
  448. end
  449. end
  450. -- Slippery nodes (various slippery levels)
  451. for i=1, 5 do
  452. core.register_node("testnodes:slippery"..i, {
  453. description = S("Slippery Node (@1)", i),
  454. tiles ={"testnodes_slippery.png"},
  455. is_ground_content = false,
  456. groups = {slippery=i, dig_immediate=3},
  457. color = { r=0, g=255, b=math.floor((i/5)*255), a=255 },
  458. })
  459. end
  460. -- Move resistance nodes (various resistance levels)
  461. for r=0, 7 do
  462. if r > 0 then
  463. core.register_node("testnodes:move_resistance"..r, {
  464. description = S("Move-resistant Node (@1)", r).."\n"..
  465. S("Reduces movement speed"),
  466. walkable = false,
  467. move_resistance = r,
  468. drawtype = "glasslike",
  469. paramtype = "light",
  470. sunlight_propagates = true,
  471. tiles = { "testnodes_move_resistance.png" },
  472. is_ground_content = false,
  473. groups = { dig_immediate = 3 },
  474. color = { b = 0, g = 255, r = math.floor((r/7)*255), a = 255 },
  475. })
  476. end
  477. local mdesc, mcolor
  478. if r == 0 then
  479. mdesc = S("Liquidlike Movement Node").."\n"..
  480. S("Swimmable (no move resistance)")
  481. mcolor = { b = 255, g = 255, r = 128 }
  482. else
  483. mdesc = S("Move-resistant Node (@1), liquidlike", r).."\n"..
  484. S("Reduces movement speed; swimmable")
  485. mcolor = { b = 255, g = 0, r = math.floor((r/7)*255), a = 255 }
  486. end
  487. core.register_node("testnodes:move_resistance_liquidlike"..r, {
  488. description = mdesc,
  489. walkable = false,
  490. move_resistance = r,
  491. liquid_move_physics = true,
  492. drawtype = "glasslike",
  493. paramtype = "light",
  494. sunlight_propagates = true,
  495. tiles = { "testnodes_move_resistance.png" },
  496. is_ground_content = false,
  497. groups = { dig_immediate = 3 },
  498. color = mcolor,
  499. })
  500. end
  501. core.register_node("testnodes:climbable_move_resistance_4", {
  502. description = S("Climbable Move-resistant Node (4)").."\n"..
  503. S("You can climb up and down; reduced movement speed"),
  504. walkable = false,
  505. climbable = true,
  506. move_resistance = 4,
  507. drawtype = "nodebox",
  508. paramtype = "light",
  509. sunlight_propagates = true,
  510. tiles = {"testnodes_climbable_top.png","testnodes_climbable_top.png","testnodes_climbable_resistance_side.png"},
  511. use_texture_alpha = "clip",
  512. is_ground_content = false,
  513. groups = { dig_immediate = 3 },
  514. })
  515. -- By placing something on the node, the node itself will be replaced
  516. core.register_node("testnodes:buildable_to", {
  517. description = S("\"buildable_to\" Node").."\n"..
  518. S("Placing a node on it will replace it"),
  519. buildable_to = true,
  520. tiles = {"testnodes_buildable_to.png"},
  521. is_ground_content = false,
  522. groups = {dig_immediate=3},
  523. })
  524. -- Nodes that deal damage to players that are inside them.
  525. -- Negative damage nodes should heal.
  526. for d=-3,3 do
  527. if d ~= 0 then
  528. local sub, tile, desc
  529. if d > 0 then
  530. sub = tostring(d)
  531. tile = "testnodes_damage.png"
  532. desc = S("Damage Node (@1 damage per second)", d)
  533. else
  534. sub = "m" .. tostring(math.abs(d))
  535. tile = "testnodes_damage_neg.png"
  536. desc = S("Healing Node (@1 HP per second)", math.abs(d))
  537. end
  538. if math.abs(d) == 2 then
  539. tile = tile .. "^[colorize:#000000:70"
  540. elseif math.abs(d) == 3 then
  541. tile = tile .. "^[colorize:#000000:140"
  542. end
  543. core.register_node("testnodes:damage_"..sub, {
  544. description = desc,
  545. damage_per_second = d,
  546. walkable = false,
  547. is_ground_content = false,
  548. drawtype = "allfaces",
  549. paramtype = "light",
  550. sunlight_propagates = true,
  551. tiles = { tile },
  552. groups = {dig_immediate=3},
  553. })
  554. end
  555. end
  556. -- Causes drowning damage
  557. core.register_node("testnodes:drowning_1", {
  558. description = S("Drowning Node (@1 damage)", 1).."\n"..
  559. S("You'll drown inside it"),
  560. drowning = 1,
  561. walkable = false,
  562. is_ground_content = false,
  563. drawtype = "allfaces",
  564. paramtype = "light",
  565. sunlight_propagates = true,
  566. tiles = { "testnodes_drowning.png" },
  567. groups = {dig_immediate=3},
  568. })
  569. -- post_effect_color_shaded
  570. core.register_node("testnodes:post_effect_color_shaded_false", {
  571. description = S("\"post_effect_color_shaded = false\" Node"),
  572. drawtype = "allfaces",
  573. tiles = {"testnodes_post_effect_color_shaded_false.png"},
  574. use_texture_alpha = "blend",
  575. paramtype = "light",
  576. sunlight_propagates = true,
  577. post_effect_color = {a = 128, r = 255, g = 255, b = 255},
  578. post_effect_color_shaded = false,
  579. walkable = false,
  580. is_ground_content = false,
  581. groups = {dig_immediate=3},
  582. })
  583. core.register_node("testnodes:post_effect_color_shaded_true", {
  584. description = S("\"post_effect_color_shaded = true\" Node"),
  585. drawtype = "allfaces",
  586. tiles = {"testnodes_post_effect_color_shaded_true.png"},
  587. use_texture_alpha = "blend",
  588. paramtype = "light",
  589. sunlight_propagates = true,
  590. post_effect_color = {a = 128, r = 255, g = 255, b = 255},
  591. post_effect_color_shaded = true,
  592. walkable = false,
  593. is_ground_content = false,
  594. groups = {dig_immediate=3},
  595. })
  596. -- Pointability
  597. -- Register wrapper for compactness
  598. local function register_pointable_test_node(name, description, pointable)
  599. local texture = "testnodes_"..name..".png"
  600. core.register_node("testnodes:"..name, {
  601. description = S(description),
  602. tiles = {texture},
  603. drawtype = "glasslike_framed",
  604. paramtype = "light",
  605. walkable = false,
  606. pointable = pointable,
  607. groups = {dig_immediate=3, [name.."_test"]=1},
  608. })
  609. end
  610. register_pointable_test_node("pointable", "Pointable Node", true)
  611. register_pointable_test_node("not_pointable", "Not Pointable Node", false)
  612. register_pointable_test_node("blocking_pointable", "Blocking Pointable Node", "blocking")