nodes.lua 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901
  1. -- mods/default/nodes.lua
  2. --[[ Node name convention:
  3. Although many node names are in combined-word form, the required form for new
  4. node names is words separated by underscores. If both forms are used in written
  5. language (for example pinewood and pine wood) the underscore form should be used.
  6. --]]
  7. --[[ Index:
  8. Stone
  9. -----
  10. (1. Material 2. Cobble variant 3. Brick variant 4. Modified forms)
  11. default:stone
  12. default:cobble
  13. default:stonebrick
  14. default:stone_block
  15. default:mossycobble
  16. default:desert_stone
  17. default:desert_cobble
  18. default:desert_stonebrick
  19. default:desert_stone_block
  20. default:sandstone
  21. default:sandstonebrick
  22. default:sandstone_block
  23. default:desert_sandstone
  24. default:desert_sandstone_brick
  25. default:desert_sandstone_block
  26. default:silver_sandstone
  27. default:silver_sandstone_brick
  28. default:silver_sandstone_block
  29. default:obsidian
  30. default:obsidianbrick
  31. default:obsidian_block
  32. Soft / Non-Stone
  33. ----------------
  34. (1. Material 2. Modified forms)
  35. default:dirt
  36. default:dirt_with_grass
  37. default:dirt_with_grass_footsteps
  38. default:dirt_with_dry_grass
  39. default:dirt_with_snow
  40. default:dirt_with_rainforest_litter
  41. default:dirt_with_coniferous_litter
  42. default:sand
  43. default:desert_sand
  44. default:silver_sand
  45. default:gravel
  46. default:clay
  47. default:snow
  48. default:snowblock
  49. default:ice
  50. Trees
  51. -----
  52. (1. Trunk 2. Fabricated trunk 3. Leaves 4. Sapling 5. Fruits)
  53. default:tree
  54. default:wood
  55. default:leaves
  56. default:sapling
  57. default:apple
  58. default:jungletree
  59. default:junglewood
  60. default:jungleleaves
  61. default:junglesapling
  62. default:pine_tree
  63. default:pine_wood
  64. default:pine_needles
  65. default:pine_sapling
  66. default:acacia_tree
  67. default:acacia_wood
  68. default:acacia_leaves
  69. default:acacia_sapling
  70. default:aspen_tree
  71. default:aspen_wood
  72. default:aspen_leaves
  73. default:aspen_sapling
  74. Ores
  75. ----
  76. (1. In stone 2. Blocks)
  77. default:stone_with_coal
  78. default:coalblock
  79. default:stone_with_iron
  80. default:steelblock
  81. default:stone_with_copper
  82. default:copperblock
  83. default:stone_with_tin
  84. default:tinblock
  85. default:bronzeblock
  86. default:stone_with_gold
  87. default:goldblock
  88. default:stone_with_mese
  89. default:mese
  90. default:stone_with_diamond
  91. default:diamondblock
  92. Plantlife
  93. ---------
  94. default:cactus
  95. default:papyrus
  96. default:dry_shrub
  97. default:junglegrass
  98. default:grass_1
  99. default:grass_2
  100. default:grass_3
  101. default:grass_4
  102. default:grass_5
  103. default:dry_grass_1
  104. default:dry_grass_2
  105. default:dry_grass_3
  106. default:dry_grass_4
  107. default:dry_grass_5
  108. default:fern_1
  109. default:fern_2
  110. default:fern_3
  111. default:bush_stem
  112. default:bush_leaves
  113. default:bush_sapling
  114. default:acacia_bush_stem
  115. default:acacia_bush_leaves
  116. default:acacia_bush_sapling
  117. default:sand_with_kelp
  118. Corals
  119. ------
  120. default:coral_brown
  121. default:coral_orange
  122. default:coral_skeleton
  123. Liquids
  124. -------
  125. (1. Source 2. Flowing)
  126. default:water_source
  127. default:water_flowing
  128. default:river_water_source
  129. default:river_water_flowing
  130. default:lava_source
  131. default:lava_flowing
  132. Tools / "Advanced" crafting / Non-"natural"
  133. -------------------------------------------
  134. default:chest
  135. default:chest_locked
  136. default:bookshelf
  137. default:sign_wall_wood
  138. default:sign_wall_steel
  139. default:ladder_wood
  140. default:ladder_steel
  141. default:fence_wood
  142. default:fence_acacia_wood
  143. default:fence_junglewood
  144. default:fence_pine_wood
  145. default:fence_aspen_wood
  146. default:glass
  147. default:obsidian_glass
  148. default:brick
  149. default:meselamp
  150. default:mese_post_light
  151. Misc
  152. ----
  153. default:cloud
  154. --]]
  155. --
  156. -- Stone
  157. --
  158. minetest.register_node("default:stone", {
  159. description = "Stone",
  160. tiles = {"default_stone.png"},
  161. groups = {cracky = 3, stone = 1},
  162. drop = 'default:cobble',
  163. legacy_mineral = true,
  164. stack_max = 1,
  165. sounds = default.node_sound_stone_defaults(),
  166. })
  167. minetest.register_node("default:cobble", {
  168. description = "Cobblestone",
  169. tiles = {"default_cobble.png"},
  170. is_ground_content = false,
  171. stack_max = 1,
  172. groups = {cracky = 3, falling_node = 1, stone = 2},
  173. sounds = default.node_sound_stone_defaults(),
  174. })
  175. minetest.register_node("default:stonebrick", {
  176. description = "Stone Brick",
  177. paramtype2 = "facedir",
  178. place_param2 = 0,
  179. tiles = {"default_stone_brick.png"},
  180. is_ground_content = false,
  181. stack_max = 1,
  182. groups = {cracky = 2, stone = 1},
  183. sounds = default.node_sound_stone_defaults(),
  184. })
  185. minetest.register_node("default:stone_block", {
  186. description = "Stone Block",
  187. tiles = {"default_stone_block.png"},
  188. is_ground_content = false,
  189. groups = {cracky = 2, stone = 1},
  190. stack_max = 1,
  191. sounds = default.node_sound_stone_defaults(),
  192. })
  193. minetest.register_node("default:mossycobble", {
  194. description = "Mossy Cobblestone",
  195. tiles = {"default_mossycobble.png"},
  196. is_ground_content = false,
  197. groups = {cracky = 3, falling_node = 1, stone = 1},
  198. stack_max = 1,
  199. sounds = default.node_sound_stone_defaults(),
  200. })
  201. minetest.register_node("default:desert_stone", {
  202. description = "Desert Stone",
  203. tiles = {"default_desert_stone.png"},
  204. groups = {cracky = 3, stone = 1},
  205. drop = 'default:desert_cobble',
  206. legacy_mineral = true,
  207. stack_max = 1,
  208. sounds = default.node_sound_stone_defaults(),
  209. })
  210. minetest.register_node("default:desert_cobble", {
  211. description = "Desert Cobblestone",
  212. tiles = {"default_desert_cobble.png"},
  213. is_ground_content = false,
  214. groups = {cracky = 3, falling_node = 1, stone = 2},
  215. sounds = default.node_sound_stone_defaults(),
  216. stack_max = 1,
  217. })
  218. minetest.register_node("default:desert_stonebrick", {
  219. description = "Desert Stone Brick",
  220. paramtype2 = "facedir",
  221. place_param2 = 0,
  222. tiles = {"default_desert_stone_brick.png"},
  223. is_ground_content = false,
  224. groups = {cracky = 2, stone = 1},
  225. stack_max = 1,
  226. sounds = default.node_sound_stone_defaults(),
  227. })
  228. minetest.register_node("default:desert_stone_block", {
  229. description = "Desert Stone Block",
  230. tiles = {"default_desert_stone_block.png"},
  231. is_ground_content = false,
  232. groups = {cracky = 2, stone = 1},
  233. stack_max = 1,
  234. sounds = default.node_sound_stone_defaults(),
  235. })
  236. minetest.register_node("default:sandstone", {
  237. description = "Sandstone",
  238. tiles = {"default_sandstone.png"},
  239. groups = {crumbly = 1, cracky = 3},
  240. stack_max = 1,
  241. sounds = default.node_sound_stone_defaults(),
  242. })
  243. minetest.register_node("default:sandstonebrick", {
  244. description = "Sandstone Brick",
  245. paramtype2 = "facedir",
  246. stack_max = 1,
  247. place_param2 = 0,
  248. tiles = {"default_sandstone_brick.png"},
  249. is_ground_content = false,
  250. groups = {cracky = 2},
  251. sounds = default.node_sound_stone_defaults(),
  252. })
  253. minetest.register_node("default:sandstone_block", {
  254. description = "Sandstone Block",
  255. tiles = {"default_sandstone_block.png"},
  256. is_ground_content = false,
  257. stack_max = 1,
  258. groups = {cracky = 2},
  259. sounds = default.node_sound_stone_defaults(),
  260. })
  261. minetest.register_node("default:desert_sandstone", {
  262. description = "Desert Sandstone",
  263. tiles = {"default_desert_sandstone.png"},
  264. groups = {crumbly = 1, cracky = 3},
  265. stack_max = 1,
  266. sounds = default.node_sound_stone_defaults(),
  267. })
  268. minetest.register_node("default:desert_sandstone_brick", {
  269. description = "Desert Sandstone Brick",
  270. paramtype2 = "facedir",
  271. place_param2 = 0,
  272. stack_max = 1,
  273. tiles = {"default_desert_sandstone_brick.png"},
  274. is_ground_content = false,
  275. groups = {cracky = 2},
  276. sounds = default.node_sound_stone_defaults(),
  277. })
  278. minetest.register_node("default:desert_sandstone_block", {
  279. description = "Desert Sandstone Block",
  280. tiles = {"default_desert_sandstone_block.png"},
  281. is_ground_content = false,
  282. stack_max = 1,
  283. groups = {cracky = 2},
  284. sounds = default.node_sound_stone_defaults(),
  285. })
  286. minetest.register_node("default:silver_sandstone", {
  287. description = "Silver Sandstone",
  288. tiles = {"default_silver_sandstone.png"},
  289. groups = {crumbly = 1, cracky = 3},
  290. stack_max = 1,
  291. sounds = default.node_sound_stone_defaults(),
  292. })
  293. minetest.register_node("default:silver_sandstone_brick", {
  294. description = "Silver Sandstone Brick",
  295. paramtype2 = "facedir",
  296. place_param2 = 0,
  297. tiles = {"default_silver_sandstone_brick.png"},
  298. is_ground_content = false,
  299. stack_max = 1,
  300. groups = {cracky = 2},
  301. sounds = default.node_sound_stone_defaults(),
  302. })
  303. minetest.register_node("default:silver_sandstone_block", {
  304. description = "Silver Sandstone Block",
  305. tiles = {"default_silver_sandstone_block.png"},
  306. is_ground_content = false,
  307. groups = {cracky = 2},
  308. sounds = default.node_sound_stone_defaults(),
  309. stack_max = 1,
  310. })
  311. minetest.register_node("default:obsidian", {
  312. description = "Obsidian",
  313. tiles = {"default_obsidian.png"},
  314. sounds = default.node_sound_stone_defaults(),
  315. stack_max = 2,
  316. groups = {cracky = 1, level = 2},
  317. })
  318. minetest.register_node("default:obsidianbrick", {
  319. description = "Obsidian Brick",
  320. paramtype2 = "facedir",
  321. place_param2 = 0,
  322. tiles = {"default_obsidian_brick.png"},
  323. is_ground_content = false,
  324. stack_max = 1,
  325. sounds = default.node_sound_stone_defaults(),
  326. groups = {cracky = 1, level = 2},
  327. })
  328. minetest.register_node("default:obsidian_block", {
  329. description = "Obsidian Block",
  330. tiles = {"default_obsidian_block.png"},
  331. is_ground_content = false,
  332. sounds = default.node_sound_stone_defaults(),
  333. stack_max = 1,
  334. groups = {cracky = 1, level = 2},
  335. })
  336. --
  337. -- Soft / Non-Stone
  338. --
  339. minetest.register_node("default:dirt", {
  340. description = "Dirt",
  341. tiles = {"default_dirt.png"},
  342. groups = {crumbly = 3, falling_node = 1, soil = 1},
  343. stack_max = 2,
  344. sounds = default.node_sound_dirt_defaults(),
  345. })
  346. minetest.register_node("default:dirt_with_grass", {
  347. description = "Dirt with Grass",
  348. tiles = {"default_grass.png", "default_dirt.png",
  349. {name = "default_dirt.png^default_grass_side.png",
  350. tileable_vertical = false}},
  351. groups = {crumbly = 3, soil = 1, falling_node = 1, spreading_dirt_type = 1},
  352. drop = 'default:dirt',
  353. stack_max = 2,
  354. sounds = default.node_sound_dirt_defaults({
  355. footstep = {name = "default_grass_footstep", gain = 0.25},
  356. }),
  357. })
  358. minetest.register_node("default:dirt_with_grass_footsteps", {
  359. description = "Dirt with Grass and Footsteps",
  360. tiles = {"default_grass.png^default_footprint.png", "default_dirt.png",
  361. {name = "default_dirt.png^default_grass_side.png",
  362. tileable_vertical = false}},
  363. groups = {crumbly = 3, soil = 1, falling_node = 1, not_in_creative_inventory = 1},
  364. drop = 'default:dirt',
  365. stack_max = 2,
  366. sounds = default.node_sound_dirt_defaults({
  367. footstep = {name = "default_grass_footstep", gain = 0.25},
  368. }),
  369. })
  370. minetest.register_node("default:dirt_with_dry_grass", {
  371. description = "Dirt with Dry Grass",
  372. stack_max = 2,
  373. tiles = {"default_dry_grass.png",
  374. "default_dirt.png",
  375. {name = "default_dirt.png^default_dry_grass_side.png",
  376. tileable_vertical = false}},
  377. groups = {crumbly = 3, soil = 1, falling_node = 1, spreading_dirt_type = 1},
  378. drop = 'default:dirt',
  379. sounds = default.node_sound_dirt_defaults({
  380. footstep = {name = "default_grass_footstep", gain = 0.4},
  381. }),
  382. })
  383. minetest.register_node("default:dirt_with_snow", {
  384. description = "Dirt with Snow",
  385. tiles = {"default_snow.png", "default_dirt.png",
  386. {name = "default_dirt.png^default_snow_side.png",
  387. tileable_vertical = false}},
  388. groups = {crumbly = 3, spreading_dirt_type = 1, falling_node = 1, snowy = 1},
  389. drop = 'default:dirt',
  390. stack_max = 2,
  391. sounds = default.node_sound_dirt_defaults({
  392. footstep = {name = "default_snow_footstep", gain = 0.2},
  393. }),
  394. })
  395. minetest.register_node("default:dirt_with_rainforest_litter", {
  396. description = "Dirt with Rainforest Litter",
  397. tiles = {
  398. "default_rainforest_litter.png",
  399. "default_dirt.png",
  400. {name = "default_dirt.png^default_rainforest_litter_side.png",
  401. tileable_vertical = false}
  402. },
  403. groups = {crumbly = 3, soil = 1, falling_node = 1, spreading_dirt_type = 1},
  404. drop = "default:dirt",
  405. stack_max = 2,
  406. sounds = default.node_sound_dirt_defaults({
  407. footstep = {name = "default_grass_footstep", gain = 0.4},
  408. }),
  409. })
  410. minetest.register_node("default:dirt_with_coniferous_litter", {
  411. description = "Dirt with Coniferous Litter",
  412. tiles = {
  413. "default_coniferous_litter.png",
  414. "default_dirt.png",
  415. {name = "default_dirt.png^default_coniferous_litter_side.png",
  416. tileable_vertical = false}
  417. },
  418. groups = {crumbly = 3, soil = 1, falling_node = 1, spreading_dirt_type = 1},
  419. drop = "default:dirt",
  420. stack_max = 2,
  421. sounds = default.node_sound_dirt_defaults({
  422. footstep = {name = "default_grass_footstep", gain = 0.4},
  423. }),
  424. })
  425. minetest.register_node("default:sand", {
  426. description = "Sand",
  427. tiles = {"default_sand.png"},
  428. groups = {crumbly = 3, falling_node = 1, sand = 1},
  429. stack_max = 2,
  430. sounds = default.node_sound_sand_defaults(),
  431. })
  432. minetest.register_node("default:desert_sand", {
  433. description = "Desert Sand",
  434. tiles = {"default_desert_sand.png"},
  435. groups = {crumbly = 3, falling_node = 1, sand = 1},
  436. stack_max = 2,
  437. sounds = default.node_sound_sand_defaults(),
  438. })
  439. minetest.register_node("default:silver_sand", {
  440. description = "Silver Sand",
  441. tiles = {"default_silver_sand.png"},
  442. groups = {crumbly = 3, falling_node = 1, sand = 1},
  443. stack_max = 2,
  444. sounds = default.node_sound_sand_defaults(),
  445. })
  446. minetest.register_node("default:gravel", {
  447. description = "Gravel",
  448. tiles = {"default_gravel.png"},
  449. groups = {crumbly = 2, falling_node = 1},
  450. sounds = default.node_sound_gravel_defaults(),
  451. stack_max = 2,
  452. drop = {
  453. max_items = 1,
  454. items = {
  455. {items = {'default:flint'}, rarity = 16},
  456. {items = {'default:gravel'}}
  457. }
  458. }
  459. })
  460. minetest.register_node("default:clay", {
  461. description = "Clay",
  462. tiles = {"default_clay.png"},
  463. groups = {crumbly = 3},
  464. stack_max = 4,
  465. drop = 'default:clay_lump 4',
  466. sounds = default.node_sound_dirt_defaults(),
  467. })
  468. minetest.register_node("default:snow", {
  469. description = "Snow",
  470. tiles = {"default_snow.png"},
  471. inventory_image = "default_snowball.png",
  472. wield_image = "default_snowball.png",
  473. paramtype = "light",
  474. buildable_to = true,
  475. floodable = true,
  476. stack_max = 32,
  477. drawtype = "nodebox",
  478. node_box = {
  479. type = "fixed",
  480. fixed = {
  481. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  482. },
  483. },
  484. groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1, snowy = 1},
  485. sounds = default.node_sound_snow_defaults(),
  486. on_construct = function(pos)
  487. pos.y = pos.y - 1
  488. if minetest.get_node(pos).name == "default:dirt_with_grass" then
  489. minetest.set_node(pos, {name = "default:dirt_with_snow"})
  490. end
  491. end,
  492. })
  493. minetest.register_node("default:snowblock", {
  494. description = "Snow Block",
  495. tiles = {"default_snow.png"},
  496. groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1},
  497. sounds = default.node_sound_snow_defaults(),
  498. stack_max = 4,
  499. on_construct = function(pos)
  500. pos.y = pos.y - 1
  501. if minetest.get_node(pos).name == "default:dirt_with_grass" then
  502. minetest.set_node(pos, {name = "default:dirt_with_snow"})
  503. end
  504. end,
  505. })
  506. minetest.register_node("default:ice", {
  507. description = "Ice",
  508. tiles = {"default_ice.png"},
  509. is_ground_content = false,
  510. paramtype = "light",
  511. stack_max = 1,
  512. groups = {cracky = 3, puts_out_fire = 1, cools_lava = 1, slippery = 3},
  513. sounds = default.node_sound_glass_defaults(),
  514. })
  515. --
  516. -- Trees
  517. --
  518. minetest.register_node("default:tree", {
  519. description = "Apple Tree",
  520. tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
  521. paramtype2 = "facedir",
  522. is_ground_content = false,
  523. stack_max = 1,
  524. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  525. sounds = default.node_sound_wood_defaults(),
  526. on_place = minetest.rotate_node
  527. })
  528. minetest.register_node("default:live_tree", {
  529. description = "Apple Tree",
  530. tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
  531. paramtype2 = "facedir",
  532. is_ground_content = false,
  533. stack_max = 1,
  534. groups = {tree = 1, live_tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  535. sounds = default.node_sound_wood_defaults(),
  536. drop = "default:tree",
  537. on_place = minetest.rotate_node
  538. })
  539. minetest.register_node("default:wood", {
  540. description = "Apple Wood Planks",
  541. paramtype2 = "facedir",
  542. place_param2 = 0,
  543. tiles = {"default_wood.png"},
  544. is_ground_content = false,
  545. stack_max = 4,
  546. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
  547. sounds = default.node_sound_wood_defaults(),
  548. })
  549. minetest.register_node("default:sapling", {
  550. description = "Apple Tree Sapling",
  551. drawtype = "plantlike",
  552. tiles = {"default_sapling.png"},
  553. inventory_image = "default_sapling.png",
  554. wield_image = "default_sapling.png",
  555. paramtype = "light",
  556. sunlight_propagates = true,
  557. walkable = false,
  558. stack_max = 24,
  559. on_timer = default.grow_sapling,
  560. selection_box = {
  561. type = "fixed",
  562. fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
  563. },
  564. groups = {snappy = 2, dig_immediate = 3, flammable = 2,
  565. attached_node = 1, sapling = 1},
  566. sounds = default.node_sound_leaves_defaults(),
  567. on_construct = function(pos)
  568. minetest.get_node_timer(pos):start(math.random(300, 1500))
  569. end,
  570. on_place = function(itemstack, placer, pointed_thing)
  571. itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
  572. "default:sapling",
  573. -- minp, maxp to be checked, relative to sapling pos
  574. -- minp_relative.y = 1 because sapling pos has been checked
  575. {x = -2, y = 1, z = -2},
  576. {x = 2, y = 6, z = 2},
  577. -- maximum interval of interior volume check
  578. 4)
  579. return itemstack
  580. end,
  581. })
  582. minetest.register_node("default:leaves", {
  583. description = "Apple Tree Leaves",
  584. drawtype = "allfaces_optional",
  585. waving = 1,
  586. tiles = {"default_leaves.png"},
  587. special_tiles = {"default_leaves_simple.png"},
  588. paramtype = "light",
  589. stack_max = 30,
  590. is_ground_content = false,
  591. groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
  592. drop = {
  593. max_items = 1,
  594. items = {
  595. {
  596. -- player will get sapling with 1/20 chance
  597. items = {'default:sapling'},
  598. rarity = 20,
  599. },
  600. {
  601. -- player will get leaves only if he get no saplings,
  602. -- this is because max_items is 1
  603. items = {'default:leaves'},
  604. }
  605. }
  606. },
  607. sounds = default.node_sound_leaves_defaults(),
  608. after_place_node = default.after_place_leaves,
  609. })
  610. minetest.register_node("default:apple", {
  611. description = "Apple",
  612. drawtype = "plantlike",
  613. tiles = {"default_apple.png"},
  614. inventory_image = "default_apple.png",
  615. paramtype = "light",
  616. sunlight_propagates = true,
  617. walkable = false,
  618. stack_max = 20,
  619. is_ground_content = false,
  620. selection_box = {
  621. type = "fixed",
  622. fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16}
  623. },
  624. groups = {fleshy = 3, dig_immediate = 3, flammable = 2,
  625. leafdecay = 3, leafdecay_drop = 1},
  626. on_use = minetest.item_eat(2),
  627. sounds = default.node_sound_leaves_defaults(),
  628. after_place_node = function(pos, placer, itemstack)
  629. minetest.set_node(pos, {name = "default:apple", param2 = 1})
  630. end,
  631. })
  632. minetest.register_node("default:jungletree", {
  633. description = "Jungle Tree",
  634. tiles = {"default_jungletree_top.png", "default_jungletree_top.png",
  635. "default_jungletree.png"},
  636. paramtype2 = "facedir",
  637. is_ground_content = false,
  638. stack_max = 1,
  639. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  640. sounds = default.node_sound_wood_defaults(),
  641. on_place = minetest.rotate_node
  642. })
  643. minetest.register_node("default:live_jungletree", {
  644. description = "Jungle Tree",
  645. tiles = {"default_jungletree_top.png", "default_jungletree_top.png",
  646. "default_jungletree.png"},
  647. paramtype2 = "facedir",
  648. is_ground_content = false,
  649. stack_max = 1,
  650. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  651. sounds = default.node_sound_wood_defaults(),
  652. drop = "default:jungletree",
  653. on_place = minetest.rotate_node
  654. })
  655. minetest.register_node("default:junglewood", {
  656. description = "Jungle Wood Planks",
  657. paramtype2 = "facedir",
  658. place_param2 = 0,
  659. tiles = {"default_junglewood.png"},
  660. stack_max = 4,
  661. is_ground_content = false,
  662. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
  663. sounds = default.node_sound_wood_defaults(),
  664. })
  665. minetest.register_node("default:jungleleaves", {
  666. description = "Jungle Tree Leaves",
  667. drawtype = "allfaces_optional",
  668. waving = 1,
  669. tiles = {"default_jungleleaves.png"},
  670. special_tiles = {"default_jungleleaves_simple.png"},
  671. paramtype = "light",
  672. is_ground_content = false,
  673. stack_max = 30,
  674. groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
  675. drop = {
  676. max_items = 1,
  677. items = {
  678. {items = {'default:junglesapling'}, rarity = 20},
  679. {items = {'default:jungleleaves'}}
  680. }
  681. },
  682. sounds = default.node_sound_leaves_defaults(),
  683. after_place_node = default.after_place_leaves,
  684. })
  685. minetest.register_node("default:junglesapling", {
  686. description = "Jungle Tree Sapling",
  687. drawtype = "plantlike",
  688. tiles = {"default_junglesapling.png"},
  689. inventory_image = "default_junglesapling.png",
  690. wield_image = "default_junglesapling.png",
  691. paramtype = "light",
  692. sunlight_propagates = true,
  693. walkable = false,
  694. stack_max = 30,
  695. on_timer = default.grow_sapling,
  696. selection_box = {
  697. type = "fixed",
  698. fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
  699. },
  700. groups = {snappy = 2, dig_immediate = 3, flammable = 2,
  701. attached_node = 1, sapling = 1},
  702. sounds = default.node_sound_leaves_defaults(),
  703. on_construct = function(pos)
  704. minetest.get_node_timer(pos):start(math.random(300, 1500))
  705. end,
  706. on_place = function(itemstack, placer, pointed_thing)
  707. itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
  708. "default:junglesapling",
  709. -- minp, maxp to be checked, relative to sapling pos
  710. -- minp_relative.y = 1 because sapling pos has been checked
  711. {x = -2, y = 1, z = -2},
  712. {x = 2, y = 15, z = 2},
  713. -- maximum interval of interior volume check
  714. 4)
  715. return itemstack
  716. end,
  717. })
  718. minetest.register_node("default:pine_tree", {
  719. description = "Pine Tree",
  720. tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png",
  721. "default_pine_tree.png"},
  722. paramtype2 = "facedir",
  723. stack_max = 1,
  724. is_ground_content = false,
  725. groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
  726. sounds = default.node_sound_wood_defaults(),
  727. on_place = minetest.rotate_node
  728. })
  729. minetest.register_node("default:live_pine_tree", {
  730. description = "Pine Tree",
  731. tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png",
  732. "default_pine_tree.png"},
  733. paramtype2 = "facedir",
  734. stack_max = 1,
  735. is_ground_content = false,
  736. groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
  737. sounds = default.node_sound_wood_defaults(),
  738. drop = "default:pine_tree",
  739. on_place = minetest.rotate_node
  740. })
  741. minetest.register_node("default:pine_wood", {
  742. description = "Pine Wood Planks",
  743. paramtype2 = "facedir",
  744. place_param2 = 0,
  745. tiles = {"default_pine_wood.png"},
  746. is_ground_content = false,
  747. stack_max = 4,
  748. groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
  749. sounds = default.node_sound_wood_defaults(),
  750. })
  751. minetest.register_node("default:pine_needles",{
  752. description = "Pine Needles",
  753. drawtype = "allfaces_optional",
  754. tiles = {"default_pine_needles.png"},
  755. waving = 1,
  756. paramtype = "light",
  757. is_ground_content = false,
  758. stack_max = 30,
  759. groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
  760. drop = {
  761. max_items = 1,
  762. items = {
  763. {items = {"default:pine_sapling"}, rarity = 20},
  764. {items = {"default:pine_needles"}}
  765. }
  766. },
  767. sounds = default.node_sound_leaves_defaults(),
  768. after_place_node = default.after_place_leaves,
  769. })
  770. minetest.register_node("default:pine_sapling", {
  771. description = "Pine Tree Sapling",
  772. drawtype = "plantlike",
  773. tiles = {"default_pine_sapling.png"},
  774. inventory_image = "default_pine_sapling.png",
  775. wield_image = "default_pine_sapling.png",
  776. paramtype = "light",
  777. sunlight_propagates = true,
  778. walkable = false,
  779. stack_max = 30,
  780. on_timer = default.grow_sapling,
  781. selection_box = {
  782. type = "fixed",
  783. fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
  784. },
  785. groups = {snappy = 2, dig_immediate = 3, flammable = 3,
  786. attached_node = 1, sapling = 1},
  787. sounds = default.node_sound_leaves_defaults(),
  788. on_construct = function(pos)
  789. minetest.get_node_timer(pos):start(math.random(300, 1500))
  790. end,
  791. on_place = function(itemstack, placer, pointed_thing)
  792. itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
  793. "default:pine_sapling",
  794. -- minp, maxp to be checked, relative to sapling pos
  795. -- minp_relative.y = 1 because sapling pos has been checked
  796. {x = -2, y = 1, z = -2},
  797. {x = 2, y = 12, z = 2},
  798. -- maximum interval of interior volume check
  799. 4)
  800. return itemstack
  801. end,
  802. })
  803. minetest.register_node("default:acacia_tree", {
  804. description = "Acacia Tree",
  805. tiles = {"default_acacia_tree_top.png", "default_acacia_tree_top.png",
  806. "default_acacia_tree.png"},
  807. paramtype2 = "facedir",
  808. is_ground_content = false,
  809. stack_max = 1,
  810. groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  811. sounds = default.node_sound_wood_defaults(),
  812. on_place = minetest.rotate_node
  813. })
  814. minetest.register_node("default:acacia_wood", {
  815. description = "Acacia Wood Planks",
  816. paramtype2 = "facedir",
  817. place_param2 = 0,
  818. tiles = {"default_acacia_wood.png"},
  819. is_ground_content = false,
  820. stack_max = 4,
  821. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
  822. sounds = default.node_sound_wood_defaults(),
  823. })
  824. minetest.register_node("default:acacia_leaves", {
  825. description = "Acacia Tree Leaves",
  826. drawtype = "allfaces_optional",
  827. tiles = {"default_acacia_leaves.png"},
  828. special_tiles = {"default_acacia_leaves_simple.png"},
  829. waving = 1,
  830. paramtype = "light",
  831. stack_max = 30,
  832. is_ground_content = false,
  833. groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
  834. drop = {
  835. max_items = 1,
  836. items = {
  837. {items = {"default:acacia_sapling"}, rarity = 20},
  838. {items = {"default:acacia_leaves"}}
  839. }
  840. },
  841. sounds = default.node_sound_leaves_defaults(),
  842. after_place_node = default.after_place_leaves,
  843. })
  844. minetest.register_node("default:acacia_sapling", {
  845. description = "Acacia Tree Sapling",
  846. drawtype = "plantlike",
  847. stack_max = 30,
  848. tiles = {"default_acacia_sapling.png"},
  849. inventory_image = "default_acacia_sapling.png",
  850. wield_image = "default_acacia_sapling.png",
  851. paramtype = "light",
  852. sunlight_propagates = true,
  853. walkable = false,
  854. on_timer = default.grow_sapling,
  855. selection_box = {
  856. type = "fixed",
  857. fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
  858. },
  859. groups = {snappy = 2, dig_immediate = 3, flammable = 2,
  860. attached_node = 1, sapling = 1},
  861. sounds = default.node_sound_leaves_defaults(),
  862. on_construct = function(pos)
  863. minetest.get_node_timer(pos):start(math.random(300, 1500))
  864. end,
  865. on_place = function(itemstack, placer, pointed_thing)
  866. itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
  867. "default:acacia_sapling",
  868. -- minp, maxp to be checked, relative to sapling pos
  869. -- minp_relative.y = 1 because sapling pos has been checked
  870. {x = -4, y = 1, z = -4},
  871. {x = 4, y = 6, z = 4},
  872. -- maximum interval of interior volume check
  873. 4)
  874. return itemstack
  875. end,
  876. })
  877. minetest.register_node("default:aspen_tree", {
  878. description = "Aspen Tree",
  879. tiles = {"default_aspen_tree_top.png", "default_aspen_tree_top.png",
  880. "default_aspen_tree.png"},
  881. paramtype2 = "facedir",
  882. is_ground_content = false,
  883. stack_max = 1,
  884. groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3},
  885. sounds = default.node_sound_wood_defaults(),
  886. on_place = minetest.rotate_node
  887. })
  888. minetest.register_node("default:aspen_wood", {
  889. description = "Aspen Wood Planks",
  890. paramtype2 = "facedir",
  891. place_param2 = 0,
  892. stack_max = 4,
  893. tiles = {"default_aspen_wood.png"},
  894. is_ground_content = false,
  895. groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
  896. sounds = default.node_sound_wood_defaults(),
  897. })
  898. minetest.register_node("default:aspen_leaves", {
  899. description = "Aspen Tree Leaves",
  900. drawtype = "allfaces_optional",
  901. tiles = {"default_aspen_leaves.png"},
  902. waving = 1,
  903. paramtype = "light",
  904. stack_max = 30,
  905. is_ground_content = false,
  906. groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
  907. drop = {
  908. max_items = 1,
  909. items = {
  910. {items = {"default:aspen_sapling"}, rarity = 20},
  911. {items = {"default:aspen_leaves"}}
  912. }
  913. },
  914. sounds = default.node_sound_leaves_defaults(),
  915. after_place_node = default.after_place_leaves,
  916. })
  917. minetest.register_node("default:aspen_sapling", {
  918. description = "Aspen Tree Sapling",
  919. drawtype = "plantlike",
  920. tiles = {"default_aspen_sapling.png"},
  921. inventory_image = "default_aspen_sapling.png",
  922. wield_image = "default_aspen_sapling.png",
  923. paramtype = "light",
  924. sunlight_propagates = true,
  925. stack_max = 30,
  926. walkable = false,
  927. on_timer = default.grow_sapling,
  928. selection_box = {
  929. type = "fixed",
  930. fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 0.5, 3 / 16}
  931. },
  932. groups = {snappy = 2, dig_immediate = 3, flammable = 3,
  933. attached_node = 1, sapling = 1},
  934. sounds = default.node_sound_leaves_defaults(),
  935. on_construct = function(pos)
  936. minetest.get_node_timer(pos):start(math.random(300, 1500))
  937. end,
  938. on_place = function(itemstack, placer, pointed_thing)
  939. itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
  940. "default:aspen_sapling",
  941. -- minp, maxp to be checked, relative to sapling pos
  942. -- minp_relative.y = 1 because sapling pos has been checked
  943. {x = -2, y = 1, z = -2},
  944. {x = 2, y = 12, z = 2},
  945. -- maximum interval of interior volume check
  946. 4)
  947. return itemstack
  948. end,
  949. })
  950. --
  951. -- Ores
  952. --
  953. minetest.register_node("default:stone_with_coal", {
  954. description = "Coal Ore",
  955. tiles = {"default_stone.png^default_mineral_coal.png"},
  956. groups = {cracky = 3},
  957. stack_max = 1,
  958. drop = 'default:coal_lump',
  959. sounds = default.node_sound_stone_defaults(),
  960. })
  961. minetest.register_node("default:coalblock", {
  962. description = "Coal Block",
  963. tiles = {"default_coal_block.png"},
  964. is_ground_content = false,
  965. stack_max = 1,
  966. groups = {cracky = 3},
  967. sounds = default.node_sound_stone_defaults(),
  968. })
  969. minetest.register_node("default:stone_with_iron", {
  970. description = "Iron Ore",
  971. tiles = {"default_stone.png^default_mineral_iron.png"},
  972. groups = {cracky = 2},
  973. stack_max = 1,
  974. drop = 'default:iron_lump',
  975. sounds = default.node_sound_stone_defaults(),
  976. })
  977. minetest.register_node("default:steelblock", {
  978. description = "Steel Block",
  979. tiles = {"default_steel_block.png"},
  980. is_ground_content = false,
  981. stack_max = 1,
  982. groups = {cracky = 1, level = 2},
  983. sounds = default.node_sound_metal_defaults(),
  984. })
  985. minetest.register_node("default:stone_with_copper", {
  986. description = "Copper Ore",
  987. tiles = {"default_stone.png^default_mineral_copper.png"},
  988. groups = {cracky = 2},
  989. stack_max = 1,
  990. drop = 'default:copper_lump',
  991. sounds = default.node_sound_stone_defaults(),
  992. })
  993. minetest.register_node("default:copperblock", {
  994. description = "Copper Block",
  995. tiles = {"default_copper_block.png"},
  996. is_ground_content = false,
  997. groups = {cracky = 1, level = 2},
  998. stack_max = 1,
  999. sounds = default.node_sound_metal_defaults(),
  1000. })
  1001. minetest.register_node("default:stone_with_tin", {
  1002. description = "Tin Ore",
  1003. tiles = {"default_stone.png^default_mineral_tin.png"},
  1004. groups = {cracky = 2},
  1005. stack_max = 1,
  1006. drop = "default:tin_lump",
  1007. sounds = default.node_sound_stone_defaults(),
  1008. })
  1009. minetest.register_node("default:tinblock", {
  1010. description = "Tin Block",
  1011. tiles = {"default_tin_block.png"},
  1012. is_ground_content = false,
  1013. stack_max = 1,
  1014. groups = {cracky = 1, level = 2},
  1015. sounds = default.node_sound_metal_defaults(),
  1016. })
  1017. minetest.register_node("default:bronzeblock", {
  1018. description = "Bronze Block",
  1019. tiles = {"default_bronze_block.png"},
  1020. is_ground_content = false,
  1021. stack_max = 1,
  1022. groups = {cracky = 1, level = 2},
  1023. sounds = default.node_sound_metal_defaults(),
  1024. })
  1025. minetest.register_node("default:stone_with_mese", {
  1026. description = "Mese Ore",
  1027. tiles = {"default_stone.png^default_mineral_mese.png"},
  1028. groups = {cracky = 1},
  1029. drop = "default:mese_crystal",
  1030. stack_max = 1,
  1031. sounds = default.node_sound_stone_defaults(),
  1032. })
  1033. minetest.register_node("default:mese", {
  1034. description = "Mese Block",
  1035. tiles = {"default_mese_block.png"},
  1036. paramtype = "light",
  1037. groups = {cracky = 1, level = 2},
  1038. stack_max = 1,
  1039. sounds = default.node_sound_stone_defaults(),
  1040. light_source = 3,
  1041. })
  1042. minetest.register_node("default:stone_with_gold", {
  1043. description = "Gold Ore",
  1044. tiles = {"default_stone.png^default_mineral_gold.png"},
  1045. groups = {cracky = 2},
  1046. drop = "default:gold_lump",
  1047. stack_max = 1,
  1048. sounds = default.node_sound_stone_defaults(),
  1049. })
  1050. minetest.register_node("default:goldblock", {
  1051. description = "Gold Block",
  1052. tiles = {"default_gold_block.png"},
  1053. is_ground_content = false,
  1054. groups = {cracky = 1},
  1055. stack_max = 1,
  1056. sounds = default.node_sound_metal_defaults(),
  1057. })
  1058. minetest.register_node("default:stone_with_diamond", {
  1059. description = "Diamond Ore",
  1060. tiles = {"default_stone.png^default_mineral_diamond.png"},
  1061. groups = {cracky = 1},
  1062. stack_max = 1,
  1063. drop = "default:diamond",
  1064. sounds = default.node_sound_stone_defaults(),
  1065. })
  1066. minetest.register_node("default:diamondblock", {
  1067. description = "Diamond Block",
  1068. tiles = {"default_diamond_block.png"},
  1069. is_ground_content = false,
  1070. groups = {cracky = 1, level = 3},
  1071. stack_max = 1,
  1072. sounds = default.node_sound_stone_defaults(),
  1073. })
  1074. --
  1075. -- Plantlife (non-cubic)
  1076. --
  1077. minetest.register_node("default:cactus", {
  1078. description = "Cactus",
  1079. tiles = {"default_cactus_top.png", "default_cactus_top.png",
  1080. "default_cactus_side.png"},
  1081. paramtype2 = "facedir",
  1082. groups = {choppy = 3},
  1083. stack_max = 2,
  1084. sounds = default.node_sound_wood_defaults(),
  1085. on_place = minetest.rotate_node,
  1086. })
  1087. minetest.register_node("default:papyrus", {
  1088. description = "Papyrus",
  1089. drawtype = "plantlike",
  1090. tiles = {"default_papyrus.png"},
  1091. inventory_image = "default_papyrus.png",
  1092. wield_image = "default_papyrus.png",
  1093. paramtype = "light",
  1094. stack_max = 10,
  1095. sunlight_propagates = true,
  1096. walkable = false,
  1097. selection_box = {
  1098. type = "fixed",
  1099. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
  1100. },
  1101. groups = {snappy = 3, flammable = 2},
  1102. sounds = default.node_sound_leaves_defaults(),
  1103. after_dig_node = function(pos, node, metadata, digger)
  1104. default.dig_up(pos, node, digger)
  1105. end,
  1106. })
  1107. minetest.register_node("default:dry_shrub", {
  1108. description = "Dry Shrub",
  1109. drawtype = "plantlike",
  1110. waving = 1,
  1111. stack_max = 20,
  1112. tiles = {"default_dry_shrub.png"},
  1113. inventory_image = "default_dry_shrub.png",
  1114. wield_image = "default_dry_shrub.png",
  1115. paramtype = "light",
  1116. paramtype2 = "meshoptions",
  1117. place_param2 = 4,
  1118. sunlight_propagates = true,
  1119. walkable = false,
  1120. buildable_to = true,
  1121. groups = {snappy = 3, flammable = 3, attached_node = 1},
  1122. sounds = default.node_sound_leaves_defaults(),
  1123. selection_box = {
  1124. type = "fixed",
  1125. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 4 / 16, 6 / 16},
  1126. },
  1127. })
  1128. -- for t = 0,5 do
  1129. for l = 1,5 do
  1130. local items = {
  1131. {items = {'default:cattail_5'}}
  1132. }
  1133. if l == 5 then
  1134. table.insert(items, {items = {'default:cattail_seed_pod'}, rarity = 7})
  1135. end
  1136. minetest.register_node("default:cattail_"..l, {
  1137. description = "Cattail",
  1138. drawtype = "plantlike",
  1139. waving = 1,
  1140. stack_max = 20,
  1141. visual_scale = 1.69,
  1142. tiles = {"default_cattail_"..l..".png"},
  1143. inventory_image = "default_cattail_"..l..".png",
  1144. wield_image = "default_cattail_"..l..".png",
  1145. paramtype = "light",
  1146. sunlight_propagates = true,
  1147. paramtype2 = "meshoptions",
  1148. walkable = false,
  1149. drop = {
  1150. max_items = 2,
  1151. items = items,
  1152. },
  1153. buildable_to = true,
  1154. groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1},
  1155. sounds = default.node_sound_leaves_defaults(),
  1156. selection_box = {
  1157. type = "fixed",
  1158. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.25 * l, 6 / 16},
  1159. },
  1160. place_param2 = 4,
  1161. on_place = function(itemstack, placer, pointed_thing)
  1162. -- place a random grass node
  1163. t = math.random(0,4)
  1164. minetest.set_node(pointed_thing.above, {name = "default:cattail_"..l, param2 = t})
  1165. end,
  1166. })
  1167. end
  1168. -- end
  1169. minetest.register_node("default:junglegrass", {
  1170. description = "Jungle Grass",
  1171. drawtype = "plantlike",
  1172. waving = 1,
  1173. stack_max = 20,
  1174. visual_scale = 1.69,
  1175. tiles = {"default_junglegrass.png"},
  1176. inventory_image = "default_junglegrass.png",
  1177. wield_image = "default_junglegrass.png",
  1178. paramtype = "light",
  1179. sunlight_propagates = true,
  1180. walkable = false,
  1181. buildable_to = true,
  1182. groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1},
  1183. sounds = default.node_sound_leaves_defaults(),
  1184. selection_box = {
  1185. type = "fixed",
  1186. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16},
  1187. },
  1188. })
  1189. minetest.register_node("default:grass_1", {
  1190. description = "Grass",
  1191. drawtype = "plantlike",
  1192. waving = 1,
  1193. tiles = {"default_grass_1.png"},
  1194. -- Use texture of a taller grass stage in inventory
  1195. inventory_image = "default_grass_3.png",
  1196. wield_image = "default_grass_3.png",
  1197. stack_max = 20,
  1198. paramtype = "light",
  1199. sunlight_propagates = true,
  1200. walkable = false,
  1201. buildable_to = true,
  1202. groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1},
  1203. sounds = default.node_sound_leaves_defaults(),
  1204. selection_box = {
  1205. type = "fixed",
  1206. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -5 / 16, 6 / 16},
  1207. },
  1208. on_place = function(itemstack, placer, pointed_thing)
  1209. -- place a random grass node
  1210. local stack = ItemStack("default:grass_" .. math.random(1,5))
  1211. local ret = minetest.item_place(stack, placer, pointed_thing)
  1212. return ItemStack("default:grass_1 " ..
  1213. itemstack:get_count() - (1 - ret:get_count()))
  1214. end,
  1215. })
  1216. for i = 2, 5 do
  1217. minetest.register_node("default:grass_" .. i, {
  1218. description = "Grass",
  1219. drawtype = "plantlike",
  1220. waving = 1,
  1221. tiles = {"default_grass_" .. i .. ".png"},
  1222. inventory_image = "default_grass_" .. i .. ".png",
  1223. wield_image = "default_grass_" .. i .. ".png",
  1224. paramtype = "light",
  1225. stack_max = 20,
  1226. sunlight_propagates = true,
  1227. walkable = false,
  1228. buildable_to = true,
  1229. drop = "default:grass_1",
  1230. groups = {snappy = 3, flora = 1, attached_node = 1,
  1231. not_in_creative_inventory = 1, grass = 1, flammable = 1},
  1232. sounds = default.node_sound_leaves_defaults(),
  1233. selection_box = {
  1234. type = "fixed",
  1235. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
  1236. },
  1237. })
  1238. end
  1239. minetest.register_node("default:dry_grass_1", {
  1240. description = "Dry Grass",
  1241. drawtype = "plantlike",
  1242. waving = 1,
  1243. tiles = {"default_dry_grass_1.png"},
  1244. inventory_image = "default_dry_grass_3.png",
  1245. wield_image = "default_dry_grass_3.png",
  1246. paramtype = "light",
  1247. sunlight_propagates = true,
  1248. walkable = false,
  1249. stack_max = 20,
  1250. buildable_to = true,
  1251. groups = {snappy = 3, flammable = 3, flora = 1,
  1252. attached_node = 1, dry_grass = 1},
  1253. sounds = default.node_sound_leaves_defaults(),
  1254. selection_box = {
  1255. type = "fixed",
  1256. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16},
  1257. },
  1258. on_place = function(itemstack, placer, pointed_thing)
  1259. -- place a random dry grass node
  1260. local stack = ItemStack("default:dry_grass_" .. math.random(1, 5))
  1261. local ret = minetest.item_place(stack, placer, pointed_thing)
  1262. return ItemStack("default:dry_grass_1 " ..
  1263. itemstack:get_count() - (1 - ret:get_count()))
  1264. end,
  1265. })
  1266. for i = 2, 5 do
  1267. minetest.register_node("default:dry_grass_" .. i, {
  1268. description = "Dry Grass",
  1269. drawtype = "plantlike",
  1270. waving = 1,
  1271. tiles = {"default_dry_grass_" .. i .. ".png"},
  1272. inventory_image = "default_dry_grass_" .. i .. ".png",
  1273. wield_image = "default_dry_grass_" .. i .. ".png",
  1274. paramtype = "light",
  1275. sunlight_propagates = true,
  1276. stack_max = 20,
  1277. walkable = false,
  1278. buildable_to = true,
  1279. groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1,
  1280. not_in_creative_inventory=1, dry_grass = 1},
  1281. drop = "default:dry_grass_1",
  1282. sounds = default.node_sound_leaves_defaults(),
  1283. selection_box = {
  1284. type = "fixed",
  1285. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -1 / 16, 6 / 16},
  1286. },
  1287. })
  1288. end
  1289. minetest.register_node("default:fern_1", {
  1290. description = "Fern",
  1291. drawtype = "plantlike",
  1292. waving = 1,
  1293. tiles = {"default_fern_1.png"},
  1294. inventory_image = "default_fern_1.png",
  1295. wield_image = "default_fern_1.png",
  1296. paramtype = "light",
  1297. sunlight_propagates = true,
  1298. stack_max = 20,
  1299. walkable = false,
  1300. buildable_to = true,
  1301. groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1},
  1302. sounds = default.node_sound_leaves_defaults(),
  1303. drop = {
  1304. max_items = 1,
  1305. items = {
  1306. {items = {'default:fiddlehead'}, rarity = 7},
  1307. {items = {'default:fern_1'}}
  1308. }
  1309. },
  1310. selection_box = {
  1311. type = "fixed",
  1312. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -0.25, 6 / 16},
  1313. },
  1314. on_place = function(itemstack, placer, pointed_thing)
  1315. -- place a random fern node
  1316. local stack = ItemStack("default:fern_" .. math.random(1, 3))
  1317. local ret = minetest.item_place(stack, placer, pointed_thing)
  1318. return ItemStack("default:fern_1 " ..
  1319. itemstack:get_count() - (1 - ret:get_count()))
  1320. end,
  1321. })
  1322. for i = 2, 3 do
  1323. minetest.register_node("default:fern_" .. i, {
  1324. description = "Fern",
  1325. drawtype = "plantlike",
  1326. waving = 1,
  1327. visual_scale = 2,
  1328. tiles = {"default_fern_" .. i .. ".png"},
  1329. inventory_image = "default_fern_" .. i .. ".png",
  1330. wield_image = "default_fern_" .. i .. ".png",
  1331. paramtype = "light",
  1332. sunlight_propagates = true,
  1333. stack_max = 20,
  1334. walkable = false,
  1335. buildable_to = true,
  1336. groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1,
  1337. not_in_creative_inventory=1},
  1338. drop = {
  1339. max_items = 1,
  1340. items = {
  1341. {items = {'default:fiddlehead'}, rarity = 7 * i},
  1342. {items = {'default:fern_1'}}
  1343. }
  1344. },
  1345. sounds = default.node_sound_leaves_defaults(),
  1346. selection_box = {
  1347. type = "fixed",
  1348. fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -0.25, 6 / 16},
  1349. },
  1350. })
  1351. end
  1352. minetest.register_node("default:bush_stem", {
  1353. description = "Bush Stem",
  1354. drawtype = "plantlike",
  1355. visual_scale = 1.41,
  1356. tiles = {"default_bush_stem.png"},
  1357. inventory_image = "default_bush_stem.png",
  1358. wield_image = "default_bush_stem.png",
  1359. paramtype = "light",
  1360. stack_max = 4,
  1361. sunlight_propagates = true,
  1362. groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  1363. sounds = default.node_sound_wood_defaults(),
  1364. selection_box = {
  1365. type = "fixed",
  1366. fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
  1367. },
  1368. })
  1369. minetest.register_node("default:bush_leaves", {
  1370. description = "Bush Leaves",
  1371. drawtype = "allfaces_optional",
  1372. waving = 1,
  1373. tiles = {"default_leaves_simple.png"},
  1374. stack_max = 30,
  1375. paramtype = "light",
  1376. groups = {snappy = 3, flammable = 2, leaves = 1},
  1377. drop = {
  1378. max_items = 1,
  1379. items = {
  1380. {items = {"default:bush_sapling"}, rarity = 5},
  1381. {items = {"default:bush_leaves"}}
  1382. }
  1383. },
  1384. sounds = default.node_sound_leaves_defaults(),
  1385. after_place_node = default.after_place_leaves,
  1386. })
  1387. local function register_bush_leaves_berries(opts)
  1388. local base = ""
  1389. if opts.base ~= "" then
  1390. base = opts.base .. "_"
  1391. end
  1392. opts.Desc = opts.Desc or ""
  1393. minetest.register_node("default:"..base.."bush_leaves_with_"..opts.name, {
  1394. description = opts.Desc .. "Bush Leaves",
  1395. drawtype = "allfaces_optional",
  1396. waving = 1,
  1397. tiles = {"default_"..base.."leaves_simple.png^"..(opts.tex or "")},
  1398. stack_max = 30,
  1399. paramtype = "light",
  1400. groups = {snappy = 3, flammable = 2, leaves = 1},
  1401. sounds = default.node_sound_leaves_defaults(),
  1402. after_place_node = default.after_place_leaves,
  1403. on_dig = function(pos, node, player)
  1404. local inv = player:get_inventory()
  1405. local item = "default:"..opts.name.." "..math.random(1,3)
  1406. if inv:room_for_item("main", item) then
  1407. inv:add_item("main", item)
  1408. end
  1409. minetest.set_node(pos, {name="default:"..base.."bush_leaves"})
  1410. end,
  1411. })
  1412. end
  1413. register_bush_leaves_berries({base="", name="red_berries", tex="default_berries_red.png"})
  1414. register_bush_leaves_berries({base="", name="blue_berries", tex="default_berries_blue.png"})
  1415. register_bush_leaves_berries({base="", name="orange_berries", tex="default_berries_orange.png"})
  1416. register_bush_leaves_berries({base="", name="purple_berries", tex="default_berries_purple.png"})
  1417. minetest.register_node("default:bush_sapling", {
  1418. description = "Bush Sapling",
  1419. drawtype = "plantlike",
  1420. tiles = {"default_bush_sapling.png"},
  1421. inventory_image = "default_bush_sapling.png",
  1422. wield_image = "default_bush_sapling.png",
  1423. paramtype = "light",
  1424. sunlight_propagates = true,
  1425. stack_max = 30,
  1426. walkable = false,
  1427. on_timer = default.grow_sapling,
  1428. selection_box = {
  1429. type = "fixed",
  1430. fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16}
  1431. },
  1432. groups = {snappy = 2, dig_immediate = 3, flammable = 2,
  1433. attached_node = 1, sapling = 1},
  1434. sounds = default.node_sound_leaves_defaults(),
  1435. on_construct = function(pos)
  1436. minetest.get_node_timer(pos):start(math.random(300, 1500))
  1437. end,
  1438. on_place = function(itemstack, placer, pointed_thing)
  1439. itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
  1440. "default:bush_sapling",
  1441. -- minp, maxp to be checked, relative to sapling pos
  1442. {x = -1, y = 0, z = -1},
  1443. {x = 1, y = 1, z = 1},
  1444. -- maximum interval of interior volume check
  1445. 2)
  1446. return itemstack
  1447. end,
  1448. })
  1449. minetest.register_node("default:acacia_bush_stem", {
  1450. description = "Acacia Bush Stem",
  1451. drawtype = "plantlike",
  1452. visual_scale = 1.41,
  1453. tiles = {"default_acacia_bush_stem.png"},
  1454. inventory_image = "default_acacia_bush_stem.png",
  1455. wield_image = "default_acacia_bush_stem.png",
  1456. stack_max = 4,
  1457. paramtype = "light",
  1458. sunlight_propagates = true,
  1459. groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
  1460. sounds = default.node_sound_wood_defaults(),
  1461. selection_box = {
  1462. type = "fixed",
  1463. fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16},
  1464. },
  1465. })
  1466. minetest.register_node("default:acacia_bush_leaves", {
  1467. description = "Acacia Bush Leaves",
  1468. drawtype = "allfaces_optional",
  1469. waving = 1,
  1470. tiles = {"default_acacia_leaves_simple.png"},
  1471. stack_max = 30,
  1472. paramtype = "light",
  1473. groups = {snappy = 3, flammable = 2, leaves = 1},
  1474. drop = {
  1475. max_items = 1,
  1476. items = {
  1477. {items = {"default:acacia_bush_sapling"}, rarity = 5},
  1478. {items = {"default:acacia_bush_leaves"}}
  1479. }
  1480. },
  1481. sounds = default.node_sound_leaves_defaults(),
  1482. after_place_node = default.after_place_leaves,
  1483. })
  1484. register_bush_leaves_berries({Desc="Acacia ", base="acacia", name="red_berries", tex="default_berries_red.png"})
  1485. register_bush_leaves_berries({Desc="Acacia ", base="acacia", name="orange_berries", tex="default_berries_orange.png"})
  1486. minetest.register_node("default:acacia_bush_sapling", {
  1487. description = "Acacia Bush Sapling",
  1488. drawtype = "plantlike",
  1489. tiles = {"default_acacia_bush_sapling.png"},
  1490. inventory_image = "default_acacia_bush_sapling.png",
  1491. wield_image = "default_acacia_bush_sapling.png",
  1492. paramtype = "light",
  1493. stack_max = 30,
  1494. sunlight_propagates = true,
  1495. walkable = false,
  1496. on_timer = default.grow_sapling,
  1497. selection_box = {
  1498. type = "fixed",
  1499. fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 2 / 16, 3 / 16}
  1500. },
  1501. groups = {snappy = 2, dig_immediate = 3, flammable = 2,
  1502. attached_node = 1, sapling = 1},
  1503. sounds = default.node_sound_leaves_defaults(),
  1504. on_construct = function(pos)
  1505. minetest.get_node_timer(pos):start(math.random(300, 1500))
  1506. end,
  1507. on_place = function(itemstack, placer, pointed_thing)
  1508. itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
  1509. "default:acacia_bush_sapling",
  1510. -- minp, maxp to be checked, relative to sapling pos
  1511. {x = -1, y = 0, z = -1},
  1512. {x = 1, y = 1, z = 1},
  1513. -- maximum interval of interior volume check
  1514. 2)
  1515. return itemstack
  1516. end,
  1517. })
  1518. -- cattails
  1519. minetest.register_node("default:dirt_with_cattail", {
  1520. description = "Cattail On Mud",
  1521. drawtype = "plantlike_rooted",
  1522. tiles = {"default_dirt.png"},
  1523. special_tiles = {
  1524. {name = "default_cattail_9.png", tileable_vertical = false},
  1525. },
  1526. inventory_image = "default_cattail_5.png",
  1527. stack_max = 2,
  1528. paramtype2 = "leveled",
  1529. --param2 = 1,
  1530. groups = {snappy = 3},
  1531. node_placement_prediction = "",
  1532. on_place = function(itemstack, placer, pointed_thing)
  1533. -- Call on_rightclick if the pointed node defines it
  1534. if pointed_thing.type == "node" and placer and
  1535. not placer:get_player_control().sneak then
  1536. local node_ptu = minetest.get_node(pointed_thing.under)
  1537. local def_ptu = minetest.registered_nodes[node_ptu.name]
  1538. if def_ptu and def_ptu.on_rightclick then
  1539. return def_ptu.on_rightclick(pointed_thing.under, node_ptu, placer,
  1540. itemstack, pointed_thing)
  1541. end
  1542. end
  1543. local pos = pointed_thing.above
  1544. local height = 2 --math.random(4, 6)
  1545. local pos_top = {x = pos.x, y = pos.y + height, z = pos.z}
  1546. local node_top = minetest.get_node(pos_top)
  1547. local def_top = minetest.registered_nodes[node_top.name]
  1548. local player_name = placer:get_player_name()
  1549. if def_top and def_top.liquidtype == "source" and
  1550. minetest.get_item_group(node_top.name, "water") > 0 then
  1551. if not minetest.is_protected(pos, player_name) and
  1552. not minetest.is_protected(pos_top, player_name) then
  1553. minetest.set_node(pos, {name = "default:dirt_with_cattail",
  1554. param2 = height * 16})
  1555. if not (creative and creative.is_enabled_for
  1556. and creative.is_enabled_for(player_name)) then
  1557. itemstack:take_item()
  1558. end
  1559. else
  1560. minetest.chat_send_player(player_name, "Node is protected")
  1561. minetest.record_protection_violation(pos, player_name)
  1562. end
  1563. end
  1564. return itemstack
  1565. end
  1566. })
  1567. minetest.register_node("default:sand_with_kelp", {
  1568. description = "Kelp On Sand",
  1569. drawtype = "plantlike_rooted",
  1570. tiles = {"default_sand.png"},
  1571. special_tiles = {{name = "default_kelp.png", tileable_vertical = true}},
  1572. inventory_image = "default_kelp.png",
  1573. stack_max = 2,
  1574. paramtype2 = "leveled",
  1575. groups = {snappy = 3},
  1576. node_placement_prediction = "",
  1577. on_place = function(itemstack, placer, pointed_thing)
  1578. -- Call on_rightclick if the pointed node defines it
  1579. if pointed_thing.type == "node" and placer and
  1580. not placer:get_player_control().sneak then
  1581. local node_ptu = minetest.get_node(pointed_thing.under)
  1582. local def_ptu = minetest.registered_nodes[node_ptu.name]
  1583. if def_ptu and def_ptu.on_rightclick then
  1584. return def_ptu.on_rightclick(pointed_thing.under, node_ptu, placer,
  1585. itemstack, pointed_thing)
  1586. end
  1587. end
  1588. local pos = pointed_thing.above
  1589. local height = math.random(4, 6)
  1590. local pos_top = {x = pos.x, y = pos.y + height, z = pos.z}
  1591. local node_top = minetest.get_node(pos_top)
  1592. local def_top = minetest.registered_nodes[node_top.name]
  1593. local player_name = placer:get_player_name()
  1594. if def_top and def_top.liquidtype == "source" and
  1595. minetest.get_item_group(node_top.name, "water") > 0 then
  1596. if not minetest.is_protected(pos, player_name) and
  1597. not minetest.is_protected(pos_top, player_name) then
  1598. minetest.set_node(pos, {name = "default:sand_with_kelp",
  1599. param2 = height * 16})
  1600. if not (creative and creative.is_enabled_for
  1601. and creative.is_enabled_for(player_name)) then
  1602. itemstack:take_item()
  1603. end
  1604. else
  1605. minetest.chat_send_player(player_name, "Node is protected")
  1606. minetest.record_protection_violation(pos, player_name)
  1607. end
  1608. end
  1609. return itemstack
  1610. end
  1611. })
  1612. --
  1613. -- Corals
  1614. --
  1615. minetest.register_node("default:coral_brown", {
  1616. description = "Brown Coral",
  1617. tiles = {"default_coral_brown.png"},
  1618. groups = {cracky = 3},
  1619. stack_max = 1,
  1620. drop = "default:coral_skeleton",
  1621. sounds = default.node_sound_stone_defaults(),
  1622. })
  1623. minetest.register_node("default:coral_orange", {
  1624. description = "Orange Coral",
  1625. tiles = {"default_coral_orange.png"},
  1626. groups = {cracky = 3},
  1627. stack_max = 1,
  1628. drop = "default:coral_skeleton",
  1629. sounds = default.node_sound_stone_defaults(),
  1630. })
  1631. minetest.register_node("default:coral_skeleton", {
  1632. description = "Coral Skeleton",
  1633. tiles = {"default_coral_skeleton.png"},
  1634. stack_max = 1,
  1635. groups = {cracky = 3},
  1636. sounds = default.node_sound_stone_defaults(),
  1637. })
  1638. --
  1639. -- Liquids
  1640. --
  1641. minetest.register_node("default:water_source", {
  1642. description = "Water Source",
  1643. drawtype = "liquid",
  1644. tiles = {
  1645. {
  1646. name = "default_water_source_animated.png",
  1647. animation = {
  1648. type = "vertical_frames",
  1649. aspect_w = 16,
  1650. aspect_h = 16,
  1651. length = 2.0,
  1652. },
  1653. },
  1654. },
  1655. special_tiles = {
  1656. -- New-style water source material (mostly unused)
  1657. {
  1658. name = "default_water_source_animated.png",
  1659. animation = {
  1660. type = "vertical_frames",
  1661. aspect_w = 16,
  1662. aspect_h = 16,
  1663. length = 2.0,
  1664. },
  1665. backface_culling = false,
  1666. },
  1667. },
  1668. alpha = 160,
  1669. paramtype = "light",
  1670. walkable = false,
  1671. pointable = false,
  1672. diggable = false,
  1673. buildable_to = true,
  1674. is_ground_content = false,
  1675. drop = "",
  1676. drowning = 1,
  1677. liquidtype = "source",
  1678. liquid_alternative_flowing = "default:water_flowing",
  1679. liquid_alternative_source = "default:water_source",
  1680. liquid_viscosity = 1,
  1681. post_effect_color = {a = 103, r = 30, g = 60, b = 90},
  1682. groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
  1683. sounds = default.node_sound_water_defaults(),
  1684. })
  1685. minetest.register_node("default:water_flowing", {
  1686. description = "Flowing Water",
  1687. drawtype = "flowingliquid",
  1688. tiles = {"default_water.png"},
  1689. special_tiles = {
  1690. {
  1691. name = "default_water_flowing_animated.png",
  1692. backface_culling = false,
  1693. animation = {
  1694. type = "vertical_frames",
  1695. aspect_w = 16,
  1696. aspect_h = 16,
  1697. length = 0.8,
  1698. },
  1699. },
  1700. {
  1701. name = "default_water_flowing_animated.png",
  1702. backface_culling = true,
  1703. animation = {
  1704. type = "vertical_frames",
  1705. aspect_w = 16,
  1706. aspect_h = 16,
  1707. length = 0.8,
  1708. },
  1709. },
  1710. },
  1711. alpha = 160,
  1712. paramtype = "light",
  1713. paramtype2 = "flowingliquid",
  1714. walkable = false,
  1715. pointable = false,
  1716. diggable = false,
  1717. buildable_to = true,
  1718. is_ground_content = false,
  1719. drop = "",
  1720. drowning = 1,
  1721. liquidtype = "flowing",
  1722. liquid_alternative_flowing = "default:water_flowing",
  1723. liquid_alternative_source = "default:water_source",
  1724. liquid_viscosity = 1,
  1725. post_effect_color = {a = 103, r = 30, g = 60, b = 90},
  1726. groups = {water = 3, liquid = 3, puts_out_fire = 1,
  1727. not_in_creative_inventory = 1, cools_lava = 1},
  1728. sounds = default.node_sound_water_defaults(),
  1729. })
  1730. minetest.register_node("default:river_water_source", {
  1731. description = "River Water Source",
  1732. drawtype = "liquid",
  1733. tiles = {
  1734. {
  1735. name = "default_river_water_source_animated.png",
  1736. animation = {
  1737. type = "vertical_frames",
  1738. aspect_w = 16,
  1739. aspect_h = 16,
  1740. length = 2.0,
  1741. },
  1742. },
  1743. },
  1744. special_tiles = {
  1745. {
  1746. name = "default_river_water_source_animated.png",
  1747. animation = {
  1748. type = "vertical_frames",
  1749. aspect_w = 16,
  1750. aspect_h = 16,
  1751. length = 2.0,
  1752. },
  1753. backface_culling = false,
  1754. },
  1755. },
  1756. alpha = 160,
  1757. paramtype = "light",
  1758. walkable = false,
  1759. pointable = false,
  1760. diggable = false,
  1761. buildable_to = true,
  1762. is_ground_content = false,
  1763. drop = "",
  1764. drowning = 1,
  1765. liquidtype = "source",
  1766. liquid_alternative_flowing = "default:river_water_flowing",
  1767. liquid_alternative_source = "default:river_water_source",
  1768. liquid_viscosity = 1,
  1769. -- Not renewable to avoid horizontal spread of water sources in sloping
  1770. -- rivers that can cause water to overflow riverbanks and cause floods.
  1771. -- River water source is instead made renewable by the 'force renew'
  1772. -- option used in the 'bucket' mod by the river water bucket.
  1773. liquid_renewable = false,
  1774. liquid_range = 2,
  1775. post_effect_color = {a = 103, r = 30, g = 76, b = 90},
  1776. groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
  1777. sounds = default.node_sound_water_defaults(),
  1778. })
  1779. minetest.register_node("default:river_water_flowing", {
  1780. description = "Flowing River Water",
  1781. drawtype = "flowingliquid",
  1782. tiles = {"default_river_water.png"},
  1783. special_tiles = {
  1784. {
  1785. name = "default_river_water_flowing_animated.png",
  1786. backface_culling = false,
  1787. animation = {
  1788. type = "vertical_frames",
  1789. aspect_w = 16,
  1790. aspect_h = 16,
  1791. length = 0.8,
  1792. },
  1793. },
  1794. {
  1795. name = "default_river_water_flowing_animated.png",
  1796. backface_culling = true,
  1797. animation = {
  1798. type = "vertical_frames",
  1799. aspect_w = 16,
  1800. aspect_h = 16,
  1801. length = 0.8,
  1802. },
  1803. },
  1804. },
  1805. alpha = 160,
  1806. paramtype = "light",
  1807. paramtype2 = "flowingliquid",
  1808. walkable = false,
  1809. pointable = false,
  1810. diggable = false,
  1811. buildable_to = true,
  1812. is_ground_content = false,
  1813. drop = "",
  1814. drowning = 1,
  1815. liquidtype = "flowing",
  1816. liquid_alternative_flowing = "default:river_water_flowing",
  1817. liquid_alternative_source = "default:river_water_source",
  1818. liquid_viscosity = 1,
  1819. liquid_renewable = false,
  1820. liquid_range = 2,
  1821. post_effect_color = {a = 103, r = 30, g = 76, b = 90},
  1822. groups = {water = 3, liquid = 3, puts_out_fire = 1,
  1823. not_in_creative_inventory = 1, cools_lava = 1},
  1824. sounds = default.node_sound_water_defaults(),
  1825. })
  1826. minetest.register_node("default:lava_source", {
  1827. description = "Lava Source",
  1828. drawtype = "liquid",
  1829. tiles = {
  1830. {
  1831. name = "default_lava_source_animated.png",
  1832. animation = {
  1833. type = "vertical_frames",
  1834. aspect_w = 16,
  1835. aspect_h = 16,
  1836. length = 3.0,
  1837. },
  1838. },
  1839. },
  1840. special_tiles = {
  1841. -- New-style lava source material (mostly unused)
  1842. {
  1843. name = "default_lava_source_animated.png",
  1844. animation = {
  1845. type = "vertical_frames",
  1846. aspect_w = 16,
  1847. aspect_h = 16,
  1848. length = 3.0,
  1849. },
  1850. backface_culling = false,
  1851. },
  1852. },
  1853. paramtype = "light",
  1854. light_source = default.LIGHT_MAX - 1,
  1855. walkable = false,
  1856. pointable = false,
  1857. diggable = false,
  1858. buildable_to = true,
  1859. is_ground_content = false,
  1860. drop = "",
  1861. drowning = 1,
  1862. liquidtype = "source",
  1863. liquid_alternative_flowing = "default:lava_flowing",
  1864. liquid_alternative_source = "default:lava_source",
  1865. liquid_viscosity = 7,
  1866. liquid_renewable = false,
  1867. damage_per_second = 4 * 2,
  1868. post_effect_color = {a = 191, r = 255, g = 64, b = 0},
  1869. groups = {lava = 3, liquid = 2, igniter = 1},
  1870. })
  1871. minetest.register_node("default:lava_flowing", {
  1872. description = "Flowing Lava",
  1873. drawtype = "flowingliquid",
  1874. tiles = {"default_lava.png"},
  1875. special_tiles = {
  1876. {
  1877. name = "default_lava_flowing_animated.png",
  1878. backface_culling = false,
  1879. animation = {
  1880. type = "vertical_frames",
  1881. aspect_w = 16,
  1882. aspect_h = 16,
  1883. length = 3.3,
  1884. },
  1885. },
  1886. {
  1887. name = "default_lava_flowing_animated.png",
  1888. backface_culling = true,
  1889. animation = {
  1890. type = "vertical_frames",
  1891. aspect_w = 16,
  1892. aspect_h = 16,
  1893. length = 3.3,
  1894. },
  1895. },
  1896. },
  1897. paramtype = "light",
  1898. paramtype2 = "flowingliquid",
  1899. light_source = default.LIGHT_MAX - 1,
  1900. walkable = false,
  1901. pointable = false,
  1902. diggable = false,
  1903. buildable_to = true,
  1904. is_ground_content = false,
  1905. drop = "",
  1906. drowning = 1,
  1907. liquidtype = "flowing",
  1908. liquid_alternative_flowing = "default:lava_flowing",
  1909. liquid_alternative_source = "default:lava_source",
  1910. liquid_viscosity = 7,
  1911. liquid_renewable = false,
  1912. damage_per_second = 4 * 2,
  1913. post_effect_color = {a = 191, r = 255, g = 64, b = 0},
  1914. groups = {lava = 3, liquid = 2, igniter = 1,
  1915. not_in_creative_inventory = 1},
  1916. })
  1917. --
  1918. -- Tools / "Advanced" crafting / Non-"natural"
  1919. --
  1920. default.chest = {}
  1921. function default.chest.get_chest_formspec(pos)
  1922. local spos = pos.x .. "," .. pos.y .. "," .. pos.z
  1923. local formspec =
  1924. "size[8,9]" ..
  1925. default.gui_bg ..
  1926. default.gui_bg_img ..
  1927. default.gui_slots ..
  1928. "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
  1929. "list[current_player;main;0,4.85;8,1;]" ..
  1930. "list[current_player;main;0,6.08;8,3;8]" ..
  1931. "listring[nodemeta:" .. spos .. ";main]" ..
  1932. "listring[current_player;main]" ..
  1933. default.get_hotbar_bg(0,4.85)
  1934. return formspec
  1935. end
  1936. function default.chest.chest_lid_obstructed(pos)
  1937. local above = {x = pos.x, y = pos.y + 1, z = pos.z}
  1938. local def = minetest.registered_nodes[minetest.get_node(above).name]
  1939. -- allow ladders, signs, wallmounted things and torches to not obstruct
  1940. if def and
  1941. (def.drawtype == "airlike" or
  1942. def.drawtype == "signlike" or
  1943. def.drawtype == "torchlike" or
  1944. (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then
  1945. return false
  1946. end
  1947. return true
  1948. end
  1949. function default.chest.chest_lid_close(pn)
  1950. local chest_open_info = default.chest.open_chests[pn]
  1951. local pos = chest_open_info.pos
  1952. local sound = chest_open_info.sound
  1953. local swap = chest_open_info.swap
  1954. default.chest.open_chests[pn] = nil
  1955. for k, v in pairs(default.chest.open_chests) do
  1956. if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
  1957. return true
  1958. end
  1959. end
  1960. local node = minetest.get_node(pos)
  1961. minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
  1962. param2 = node.param2 })
  1963. minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
  1964. end
  1965. default.chest.open_chests = {}
  1966. minetest.register_on_player_receive_fields(function(player, formname, fields)
  1967. if formname ~= "default:chest" then
  1968. return
  1969. end
  1970. if not player or not fields.quit then
  1971. return
  1972. end
  1973. local pn = player:get_player_name()
  1974. if not default.chest.open_chests[pn] then
  1975. return
  1976. end
  1977. default.chest.chest_lid_close(pn)
  1978. return true
  1979. end)
  1980. minetest.register_on_leaveplayer(function(player)
  1981. local pn = player:get_player_name()
  1982. if default.chest.open_chests[pn] then
  1983. default.chest.chest_lid_close(pn)
  1984. end
  1985. end)
  1986. function default.chest.register_chest(name, d)
  1987. local def = table.copy(d)
  1988. def.drawtype = "mesh"
  1989. def.visual = "mesh"
  1990. def.paramtype = "light"
  1991. def.paramtype2 = "facedir"
  1992. def.legacy_facedir_simple = true
  1993. def.is_ground_content = false
  1994. def.stack_max = 2
  1995. if def.protected then
  1996. def.on_construct = function(pos)
  1997. local meta = minetest.get_meta(pos)
  1998. meta:set_string("infotext", "Locked Chest")
  1999. meta:set_string("owner", "")
  2000. local inv = meta:get_inventory()
  2001. inv:set_size("main", 8*4)
  2002. end
  2003. def.after_place_node = function(pos, placer)
  2004. local meta = minetest.get_meta(pos)
  2005. meta:set_string("owner", placer:get_player_name() or "")
  2006. meta:set_string("infotext", "Locked Chest (owned by " ..
  2007. meta:get_string("owner") .. ")")
  2008. end
  2009. def.can_dig = function(pos,player)
  2010. local meta = minetest.get_meta(pos);
  2011. local inv = meta:get_inventory()
  2012. return inv:is_empty("main") and
  2013. default.can_interact_with_node(player, pos)
  2014. end
  2015. def.allow_metadata_inventory_move = function(pos, from_list, from_index,
  2016. to_list, to_index, count, player)
  2017. if not default.can_interact_with_node(player, pos) then
  2018. return 0
  2019. end
  2020. return count
  2021. end
  2022. def.allow_metadata_inventory_put = function(pos, listname, index, stack, player)
  2023. if not default.can_interact_with_node(player, pos) then
  2024. return 0
  2025. end
  2026. return stack:get_count()
  2027. end
  2028. def.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
  2029. if not default.can_interact_with_node(player, pos) then
  2030. return 0
  2031. end
  2032. return stack:get_count()
  2033. end
  2034. def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  2035. if not default.can_interact_with_node(clicker, pos) then
  2036. return itemstack
  2037. end
  2038. minetest.sound_play(def.sound_open, {gain = 0.3,
  2039. pos = pos, max_hear_distance = 10})
  2040. if not default.chest.chest_lid_obstructed(pos) then
  2041. minetest.swap_node(pos,
  2042. { name = "default:" .. name .. "_open",
  2043. param2 = node.param2 })
  2044. end
  2045. minetest.after(0.2, minetest.show_formspec,
  2046. clicker:get_player_name(),
  2047. "default:chest", default.chest.get_chest_formspec(pos))
  2048. default.chest.open_chests[clicker:get_player_name()] = { pos = pos,
  2049. sound = def.sound_close, swap = name }
  2050. end
  2051. def.on_blast = function() end
  2052. def.on_key_use = function(pos, player)
  2053. local secret = minetest.get_meta(pos):get_string("key_lock_secret")
  2054. local itemstack = player:get_wielded_item()
  2055. local key_meta = itemstack:get_meta()
  2056. if key_meta:get_string("secret") == "" then
  2057. key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret)
  2058. itemstack:set_metadata("")
  2059. end
  2060. if secret ~= key_meta:get_string("secret") then
  2061. return
  2062. end
  2063. minetest.show_formspec(
  2064. player:get_player_name(),
  2065. "default:chest_locked",
  2066. default.chest.get_chest_formspec(pos)
  2067. )
  2068. end
  2069. def.on_skeleton_key_use = function(pos, player, newsecret)
  2070. local meta = minetest.get_meta(pos)
  2071. local owner = meta:get_string("owner")
  2072. local pn = player:get_player_name()
  2073. -- verify placer is owner of lockable chest
  2074. if owner ~= pn then
  2075. minetest.record_protection_violation(pos, pn)
  2076. minetest.chat_send_player(pn, "You do not own this chest.")
  2077. return nil
  2078. end
  2079. local secret = meta:get_string("key_lock_secret")
  2080. if secret == "" then
  2081. secret = newsecret
  2082. meta:set_string("key_lock_secret", secret)
  2083. end
  2084. return secret, "a locked chest", owner
  2085. end
  2086. else
  2087. def.on_construct = function(pos)
  2088. local meta = minetest.get_meta(pos)
  2089. meta:set_string("infotext", "Chest")
  2090. local inv = meta:get_inventory()
  2091. inv:set_size("main", 8*4)
  2092. end
  2093. def.can_dig = function(pos,player)
  2094. local meta = minetest.get_meta(pos);
  2095. local inv = meta:get_inventory()
  2096. return inv:is_empty("main")
  2097. end
  2098. def.on_rightclick = function(pos, node, clicker)
  2099. minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
  2100. max_hear_distance = 10})
  2101. if not default.chest.chest_lid_obstructed(pos) then
  2102. minetest.swap_node(pos, {
  2103. name = "default:" .. name .. "_open",
  2104. param2 = node.param2 })
  2105. end
  2106. minetest.after(0.2, minetest.show_formspec,
  2107. clicker:get_player_name(),
  2108. "default:chest", default.chest.get_chest_formspec(pos))
  2109. default.chest.open_chests[clicker:get_player_name()] = { pos = pos,
  2110. sound = def.sound_close, swap = name }
  2111. end
  2112. def.on_blast = function(pos)
  2113. local drops = {}
  2114. default.get_inventory_drops(pos, "main", drops)
  2115. drops[#drops+1] = "default:" .. name
  2116. minetest.remove_node(pos)
  2117. return drops
  2118. end
  2119. end
  2120. def.on_metadata_inventory_move = function(pos, from_list, from_index,
  2121. to_list, to_index, count, player)
  2122. minetest.log("action", player:get_player_name() ..
  2123. " moves stuff in chest at " .. minetest.pos_to_string(pos))
  2124. end
  2125. def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
  2126. minetest.log("action", player:get_player_name() ..
  2127. " moves " .. stack:get_name() ..
  2128. " to chest at " .. minetest.pos_to_string(pos))
  2129. end
  2130. def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
  2131. minetest.log("action", player:get_player_name() ..
  2132. " takes " .. stack:get_name() ..
  2133. " from chest at " .. minetest.pos_to_string(pos))
  2134. end
  2135. local def_opened = table.copy(def)
  2136. local def_closed = table.copy(def)
  2137. def_opened.mesh = "chest_open.obj"
  2138. for i = 1, #def_opened.tiles do
  2139. if type(def_opened.tiles[i]) == "string" then
  2140. def_opened.tiles[i] = {name = def_opened.tiles[i], backface_culling = true}
  2141. elseif def_opened.tiles[i].backface_culling == nil then
  2142. def_opened.tiles[i].backface_culling = true
  2143. end
  2144. end
  2145. def_opened.drop = "default:" .. name
  2146. def_opened.groups.not_in_creative_inventory = 1
  2147. def_opened.selection_box = {
  2148. type = "fixed",
  2149. fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
  2150. }
  2151. def_opened.can_dig = function()
  2152. return false
  2153. end
  2154. def_opened.on_blast = function() end
  2155. def_closed.mesh = nil
  2156. def_closed.drawtype = nil
  2157. def_closed.tiles[6] = def.tiles[5] -- swap textures around for "normal"
  2158. def_closed.tiles[5] = def.tiles[3] -- drawtype to make them match the mesh
  2159. def_closed.tiles[3] = def.tiles[3].."^[transformFX"
  2160. minetest.register_node("default:" .. name, def_closed)
  2161. minetest.register_node("default:" .. name .. "_open", def_opened)
  2162. -- convert old chests to this new variant
  2163. minetest.register_lbm({
  2164. label = "update chests to opening chests",
  2165. name = "default:upgrade_" .. name .. "_v2",
  2166. nodenames = {"default:" .. name},
  2167. action = function(pos, node)
  2168. local meta = minetest.get_meta(pos)
  2169. meta:set_string("formspec", nil)
  2170. local inv = meta:get_inventory()
  2171. local list = inv:get_list("default:chest")
  2172. if list then
  2173. inv:set_size("main", 8*4)
  2174. inv:set_list("main", list)
  2175. inv:set_list("default:chest", nil)
  2176. end
  2177. end
  2178. })
  2179. end
  2180. default.chest.register_chest("chest", {
  2181. description = "Chest",
  2182. tiles = {
  2183. "default_chest_top.png",
  2184. "default_chest_top.png",
  2185. "default_chest_side.png",
  2186. "default_chest_side.png",
  2187. "default_chest_front.png",
  2188. "default_chest_inside.png"
  2189. },
  2190. sounds = default.node_sound_wood_defaults(),
  2191. sound_open = "default_chest_open",
  2192. sound_close = "default_chest_close",
  2193. groups = {choppy = 2, oddly_breakable_by_hand = 2},
  2194. })
  2195. default.chest.register_chest("chest_locked", {
  2196. description = "Locked Chest",
  2197. tiles = {
  2198. "default_chest_top.png",
  2199. "default_chest_top.png",
  2200. "default_chest_side.png",
  2201. "default_chest_side.png",
  2202. "default_chest_lock.png",
  2203. "default_chest_inside.png"
  2204. },
  2205. sounds = default.node_sound_wood_defaults(),
  2206. sound_open = "default_chest_open",
  2207. sound_close = "default_chest_close",
  2208. groups = {choppy = 2, oddly_breakable_by_hand = 2},
  2209. protected = true,
  2210. })
  2211. local bookshelf_formspec =
  2212. "size[8,7;]" ..
  2213. default.gui_bg ..
  2214. default.gui_bg_img ..
  2215. default.gui_slots ..
  2216. "list[context;books;0,0.3;8,2;]" ..
  2217. "list[current_player;main;0,2.85;8,1;]" ..
  2218. "list[current_player;main;0,4.08;8,3;8]" ..
  2219. "listring[context;books]" ..
  2220. "listring[current_player;main]" ..
  2221. default.get_hotbar_bg(0,2.85)
  2222. local function update_bookshelf(pos)
  2223. local meta = minetest.get_meta(pos)
  2224. local inv = meta:get_inventory()
  2225. local invlist = inv:get_list("books")
  2226. local formspec = bookshelf_formspec
  2227. -- Inventory slots overlay
  2228. local bx, by = 0, 0.3
  2229. local n_written, n_empty = 0, 0
  2230. for i = 1, 16 do
  2231. if i == 9 then
  2232. bx = 0
  2233. by = by + 1
  2234. end
  2235. local stack = invlist[i]
  2236. if stack:is_empty() then
  2237. formspec = formspec ..
  2238. "image[" .. bx .. "," .. by .. ";1,1;default_bookshelf_slot.png]"
  2239. else
  2240. local metatable = stack:get_meta():to_table() or {}
  2241. if metatable.fields and metatable.fields.text then
  2242. n_written = n_written + stack:get_count()
  2243. else
  2244. n_empty = n_empty + stack:get_count()
  2245. end
  2246. end
  2247. bx = bx + 1
  2248. end
  2249. meta:set_string("formspec", formspec)
  2250. if n_written + n_empty == 0 then
  2251. meta:set_string("infotext", "Empty Bookshelf")
  2252. else
  2253. meta:set_string("infotext", "Bookshelf (" .. n_written ..
  2254. " written, " .. n_empty .. " empty books)")
  2255. end
  2256. end
  2257. minetest.register_node("default:bookshelf", {
  2258. description = "Bookshelf",
  2259. tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
  2260. "default_wood.png", "default_bookshelf.png", "default_bookshelf.png"},
  2261. paramtype2 = "facedir",
  2262. is_ground_content = false,
  2263. groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
  2264. sounds = default.node_sound_wood_defaults(),
  2265. stack_max = 2,
  2266. on_construct = function(pos)
  2267. local meta = minetest.get_meta(pos)
  2268. local inv = meta:get_inventory()
  2269. inv:set_size("books", 8 * 2)
  2270. update_bookshelf(pos)
  2271. end,
  2272. can_dig = function(pos,player)
  2273. local inv = minetest.get_meta(pos):get_inventory()
  2274. return inv:is_empty("books")
  2275. end,
  2276. allow_metadata_inventory_put = function(pos, listname, index, stack)
  2277. if minetest.get_item_group(stack:get_name(), "book") ~= 0 then
  2278. return stack:get_count()
  2279. end
  2280. return 0
  2281. end,
  2282. on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
  2283. minetest.log("action", player:get_player_name() ..
  2284. " moves stuff in bookshelf at " .. minetest.pos_to_string(pos))
  2285. update_bookshelf(pos)
  2286. end,
  2287. on_metadata_inventory_put = function(pos, listname, index, stack, player)
  2288. minetest.log("action", player:get_player_name() ..
  2289. " puts stuff to bookshelf at " .. minetest.pos_to_string(pos))
  2290. update_bookshelf(pos)
  2291. end,
  2292. on_metadata_inventory_take = function(pos, listname, index, stack, player)
  2293. minetest.log("action", player:get_player_name() ..
  2294. " takes stuff from bookshelf at " .. minetest.pos_to_string(pos))
  2295. update_bookshelf(pos)
  2296. end,
  2297. on_blast = function(pos)
  2298. local drops = {}
  2299. default.get_inventory_drops(pos, "books", drops)
  2300. drops[#drops+1] = "default:bookshelf"
  2301. minetest.remove_node(pos)
  2302. return drops
  2303. end,
  2304. })
  2305. local function register_sign(material, desc, def)
  2306. minetest.register_node("default:sign_wall_" .. material, {
  2307. description = desc .. " Sign",
  2308. drawtype = "nodebox",
  2309. tiles = {"default_sign_wall_" .. material .. ".png"},
  2310. inventory_image = "default_sign_" .. material .. ".png",
  2311. wield_image = "default_sign_" .. material .. ".png",
  2312. paramtype = "light",
  2313. paramtype2 = "wallmounted",
  2314. sunlight_propagates = true,
  2315. stack_max = 12,
  2316. is_ground_content = false,
  2317. walkable = false,
  2318. node_box = {
  2319. type = "wallmounted",
  2320. wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
  2321. wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
  2322. wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
  2323. },
  2324. groups = def.groups,
  2325. legacy_wallmounted = true,
  2326. sounds = def.sounds,
  2327. on_construct = function(pos)
  2328. --local n = minetest.get_node(pos)
  2329. local meta = minetest.get_meta(pos)
  2330. meta:set_string("formspec", "field[text;;${text}]")
  2331. end,
  2332. on_receive_fields = function(pos, formname, fields, sender)
  2333. --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
  2334. local player_name = sender:get_player_name()
  2335. if minetest.is_protected(pos, player_name) then
  2336. minetest.record_protection_violation(pos, player_name)
  2337. return
  2338. end
  2339. local meta = minetest.get_meta(pos)
  2340. if not fields.text then return end
  2341. minetest.log("action", (player_name or "") .. " wrote \"" ..
  2342. fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
  2343. meta:set_string("text", fields.text)
  2344. meta:set_string("infotext", '"' .. fields.text .. '"')
  2345. end,
  2346. })
  2347. end
  2348. register_sign("wood", "Wooden", {
  2349. sounds = default.node_sound_wood_defaults(),
  2350. groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3}
  2351. })
  2352. register_sign("steel", "Steel", {
  2353. sounds = default.node_sound_metal_defaults(),
  2354. groups = {cracky = 2, attached_node = 1}
  2355. })
  2356. minetest.register_node("default:ladder_wood", {
  2357. description = "Wooden Ladder",
  2358. drawtype = "signlike",
  2359. tiles = {"default_ladder_wood.png"},
  2360. inventory_image = "default_ladder_wood.png",
  2361. wield_image = "default_ladder_wood.png",
  2362. paramtype = "light",
  2363. paramtype2 = "wallmounted",
  2364. sunlight_propagates = true,
  2365. walkable = false,
  2366. stack_max = 24,
  2367. climbable = true,
  2368. is_ground_content = false,
  2369. selection_box = {
  2370. type = "wallmounted",
  2371. --wall_top = = <default>
  2372. --wall_bottom = = <default>
  2373. --wall_side = = <default>
  2374. },
  2375. groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2},
  2376. legacy_wallmounted = true,
  2377. sounds = default.node_sound_wood_defaults(),
  2378. })
  2379. minetest.register_node("default:ladder_steel", {
  2380. description = "Steel Ladder",
  2381. drawtype = "signlike",
  2382. tiles = {"default_ladder_steel.png"},
  2383. inventory_image = "default_ladder_steel.png",
  2384. wield_image = "default_ladder_steel.png",
  2385. paramtype = "light",
  2386. paramtype2 = "wallmounted",
  2387. sunlight_propagates = true,
  2388. walkable = false,
  2389. climbable = true,
  2390. stack_max = 15,
  2391. is_ground_content = false,
  2392. selection_box = {
  2393. type = "wallmounted",
  2394. --wall_top = = <default>
  2395. --wall_bottom = = <default>
  2396. --wall_side = = <default>
  2397. },
  2398. groups = {cracky = 2},
  2399. sounds = default.node_sound_metal_defaults(),
  2400. })
  2401. default.register_fence("default:fence_wood", {
  2402. description = "Apple Wood Fence",
  2403. texture = "default_fence_wood.png",
  2404. inventory_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2405. wield_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2406. material = "default:wood",
  2407. stack_max = 4,
  2408. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
  2409. sounds = default.node_sound_wood_defaults()
  2410. })
  2411. default.register_fence("default:fence_acacia_wood", {
  2412. description = "Acacia Wood Fence",
  2413. texture = "default_fence_acacia_wood.png",
  2414. inventory_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2415. wield_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2416. material = "default:acacia_wood",
  2417. stack_max = 4,
  2418. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
  2419. sounds = default.node_sound_wood_defaults()
  2420. })
  2421. default.register_fence("default:fence_junglewood", {
  2422. description = "Jungle Wood Fence",
  2423. texture = "default_fence_junglewood.png",
  2424. inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2425. wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2426. material = "default:junglewood",
  2427. stack_max = 4,
  2428. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
  2429. sounds = default.node_sound_wood_defaults()
  2430. })
  2431. default.register_fence("default:fence_pine_wood", {
  2432. description = "Pine Wood Fence",
  2433. texture = "default_fence_pine_wood.png",
  2434. inventory_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2435. wield_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2436. material = "default:pine_wood",
  2437. stack_max = 4,
  2438. groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
  2439. sounds = default.node_sound_wood_defaults()
  2440. })
  2441. default.register_fence("default:fence_aspen_wood", {
  2442. description = "Aspen Wood Fence",
  2443. texture = "default_fence_aspen_wood.png",
  2444. inventory_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2445. wield_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126",
  2446. material = "default:aspen_wood",
  2447. stack_max = 4,
  2448. groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
  2449. sounds = default.node_sound_wood_defaults()
  2450. })
  2451. minetest.register_node("default:glass", {
  2452. description = "Glass",
  2453. drawtype = "glasslike_framed_optional",
  2454. tiles = {"default_glass.png", "default_glass_detail.png"},
  2455. paramtype = "light",
  2456. paramtype2 = "glasslikeliquidlevel",
  2457. sunlight_propagates = true,
  2458. stack_max = 2,
  2459. is_ground_content = false,
  2460. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  2461. sounds = default.node_sound_glass_defaults(),
  2462. })
  2463. minetest.register_node("default:obsidian_glass", {
  2464. description = "Obsidian Glass",
  2465. drawtype = "glasslike_framed_optional",
  2466. tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
  2467. paramtype = "light",
  2468. paramtype2 = "glasslikeliquidlevel",
  2469. stack_max = 2,
  2470. is_ground_content = false,
  2471. sunlight_propagates = true,
  2472. sounds = default.node_sound_glass_defaults(),
  2473. groups = {cracky = 3},
  2474. })
  2475. minetest.register_node("default:brick", {
  2476. description = "Brick Block",
  2477. paramtype2 = "facedir",
  2478. place_param2 = 0,
  2479. tiles = {"default_brick.png"},
  2480. stack_max = 1,
  2481. is_ground_content = false,
  2482. groups = {cracky = 3},
  2483. sounds = default.node_sound_stone_defaults(),
  2484. })
  2485. minetest.register_node("default:meselamp", {
  2486. description = "Mese Lamp",
  2487. drawtype = "glasslike",
  2488. tiles = {"default_meselamp.png"},
  2489. paramtype = "light",
  2490. sunlight_propagates = true,
  2491. stack_max = 8,
  2492. is_ground_content = false,
  2493. groups = {cracky = 3, oddly_breakable_by_hand = 3},
  2494. sounds = default.node_sound_glass_defaults(),
  2495. light_source = default.LIGHT_MAX,
  2496. })
  2497. minetest.register_node("default:mese_post_light", {
  2498. description = "Mese Post Light",
  2499. tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png",
  2500. "default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png",
  2501. "default_mese_post_light_side.png", "default_mese_post_light_side.png"},
  2502. wield_image = "default_mese_post_light_side.png",
  2503. drawtype = "nodebox",
  2504. node_box = {
  2505. type = "fixed",
  2506. fixed = {
  2507. {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16},
  2508. },
  2509. },
  2510. paramtype = "light",
  2511. stack_max = 4,
  2512. light_source = default.LIGHT_MAX,
  2513. sunlight_propagates = true,
  2514. is_ground_content = false,
  2515. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
  2516. sounds = default.node_sound_wood_defaults(),
  2517. })
  2518. --
  2519. -- Misc
  2520. --
  2521. minetest.register_node("default:cloud", {
  2522. description = "Cloud",
  2523. tiles = {"default_cloud.png"},
  2524. is_ground_content = false,
  2525. sounds = default.node_sound_defaults(),
  2526. groups = {not_in_creative_inventory = 1},
  2527. })
  2528. --
  2529. -- register trees for leafdecay
  2530. --
  2531. if minetest.get_mapgen_setting("mg_name") == "v6" then
  2532. default.register_leafdecay({
  2533. trunks = {"default:live_tree"},
  2534. leaves = {"default:apple", "default:leaves"},
  2535. radius = 2,
  2536. })
  2537. default.register_leafdecay({
  2538. trunks = {"default:jungletree"},
  2539. leaves = {"default:jungleleaves"},
  2540. radius = 3,
  2541. })
  2542. default.register_leafdecay({
  2543. trunks = {"default:pine_tree"},
  2544. leaves = {"default:pine_needles"},
  2545. radius = 3,
  2546. })
  2547. else
  2548. default.register_leafdecay({
  2549. trunks = {"default:tree"},
  2550. leaves = {"default:apple", "default:leaves"},
  2551. radius = 3,
  2552. })
  2553. default.register_leafdecay({
  2554. trunks = {"default:jungletree"},
  2555. leaves = {"default:jungleleaves"},
  2556. radius = 2,
  2557. })
  2558. default.register_leafdecay({
  2559. trunks = {"default:pine_tree"},
  2560. leaves = {"default:pine_needles"},
  2561. radius = 2,
  2562. })
  2563. end
  2564. default.register_leafdecay({
  2565. trunks = {"default:acacia_tree"},
  2566. leaves = {"default:acacia_leaves"},
  2567. radius = 2,
  2568. })
  2569. default.register_leafdecay({
  2570. trunks = {"default:aspen_tree"},
  2571. leaves = {"default:aspen_leaves"},
  2572. radius = 3,
  2573. })
  2574. default.register_leafdecay({
  2575. trunks = {"default:bush_stem"},
  2576. leaves = {"default:bush_leaves"},
  2577. radius = 1,
  2578. })
  2579. default.register_leafdecay({
  2580. trunks = {"default:acacia_bush_stem"},
  2581. leaves = {"default:acacia_bush_leaves"},
  2582. radius = 1,
  2583. })