Guest User

RIDDLES INIT

a guest
Jul 7th, 2012
32
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Minetest 0.4 mod: mitchsmod
  2. -- See README.txt for stuff and other information.
  3.  
  4. --
  5.  
  6. MUD_ALPHA = 160
  7. MUD_VISC = 1
  8. LIGHT_MAX = 14
  9.  
  10.  
  11. default = {}
  12.  
  13. dofile(minetest.get_modpath("mitchsmod").."/mapgen.lua")
  14.  
  15.  
  16. --
  17. -- Tool definition
  18. --
  19.  
  20.  
  21.  
  22. minetest.register_tool("mitchsmod:pick_gold", {
  23. description = "Gold Pickaxe",
  24. inventory_image = "default_tool_goldpick.png",
  25. tool_capabilities = {
  26. full_punch_interval = 1.0,
  27. max_drop_level=3,
  28. groupcaps={
  29. cracky={times={[1]=2.0, [2]=1.10, [3]=1.0}, uses=20, maxlevel=3},
  30. crumbly={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3},
  31. }
  32. },
  33. })
  34. minetest.register_tool("mitchsmod:pick_obsidian", {
  35. description = "Obsidian Pickaxe",
  36. inventory_image = "default_tool_obsidianpick.png",
  37. tool_capabilities = {
  38. full_punch_interval = 1.0,
  39. max_drop_level=3,
  40. groupcaps={
  41. cracky={times={[1]=0.99, [2]=1.04, [3]=0.74, [4]=0.49}, uses=80, maxlevel=3},
  42. crumbly={times={[1]=1.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3},
  43. }
  44. },
  45. })
  46.  
  47. minetest.register_tool("mitchsmod:pick_diamond", {
  48. description = "Diamond Pickaxe",
  49. inventory_image = "default_tool_diamondpick.png",
  50. tool_capabilities = {
  51. full_punch_interval = 1.0,
  52. max_drop_level=3,
  53. groupcaps={
  54. cracky={times={[1]=1.0, [2]=1.05, [3]=0.75, [4]=0.5}, uses=30, maxlevel=3},
  55. crumbly={times={[1]=2.0, [2]=1.0, [3]=1.0}, uses=20, maxlevel=3},
  56. }
  57. },
  58. })
  59.  
  60. --
  61. minetest.register_tool("mitchsmod:shovel_gold", {
  62. description = "Gold Shovel",
  63. inventory_image = "default_tool_goldshovel.png",
  64. tool_capabilities = {
  65. max_drop_level=1,
  66. groupcaps={
  67. crumbly={times={[1]=1.50, [2]=0.70, [3]=0.60}, uses=30, maxlevel=2}
  68. }
  69. },
  70. })
  71.  
  72. minetest.register_tool("mitchsmod:shovel_diamond", {
  73. description = "Diamond Shovel",
  74. inventory_image = "default_tool_diamondshovel.png",
  75. tool_capabilities = {
  76. max_drop_level=1,
  77. groupcaps={
  78. crumbly={times={[1]=1.50, [2]=0.70, [3]=0.60}, uses=30, maxlevel=2}
  79. }
  80. },
  81. })
  82.  
  83. minetest.register_tool("mitchsmod:shovel_obsidian", {
  84. description = "Obsidian Shovel",
  85. inventory_image = "default_tool_obsidianshovel.png",
  86. tool_capabilities = {
  87. max_drop_level=1,
  88. groupcaps={
  89. crumbly={times={[1]=1.50, [2]=0.70, [3]=0.60}, uses=30, maxlevel=2}
  90. }
  91. },
  92. })
  93. --
  94.  
  95. minetest.register_tool("mitchsmod:axe_gold", {
  96. description = "Gold Axe",
  97. inventory_image = "default_tool_goldaxe.png",
  98. tool_capabilities = {
  99. max_drop_level=1,
  100. groupcaps={
  101. choppy={times={[1]=3.00, [2]=1.60, [3]=1.00}, uses=30, maxlevel=2},
  102. fleshy={times={[2]=1.10, [3]=0.60}, uses=40, maxlevel=1}
  103. }
  104. },
  105. })
  106. minetest.register_tool("mitchsmod:axe_diamond", {
  107. description = "Diamond Axe",
  108. inventory_image = "default_tool_diamondaxe.png",
  109. tool_capabilities = {
  110. max_drop_level=1,
  111. groupcaps={
  112. choppy={times={[1]=3.00, [2]=1.60, [3]=1.00}, uses=30, maxlevel=2},
  113. fleshy={times={[2]=1.10, [3]=0.60}, uses=40, maxlevel=1}
  114. }
  115. },
  116. })
  117. minetest.register_tool("mitchsmod:axe_obsidian", {
  118. description = "Obsidian Axe",
  119. inventory_image = "default_tool_obsidianaxe.png",
  120. tool_capabilities = {
  121. max_drop_level=1,
  122. groupcaps={
  123. choppy={times={[1]=3.00, [2]=1.60, [3]=1.00}, uses=30, maxlevel=2},
  124. fleshy={times={[2]=1.10, [3]=0.60}, uses=40, maxlevel=1}
  125. }
  126. },
  127. })
  128.  
  129. minetest.register_tool("mitchsmod:sword_gold", {
  130. description = "Gold Sword",
  131. inventory_image = "default_tool_goldsword.png",
  132. tool_capabilities = {
  133. full_punch_interval = 1.0,
  134. max_drop_level=1,
  135. groupcaps={
  136. fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
  137. snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
  138. choppy={times={[3]=0.70}, uses=40, maxlevel=0}
  139. }
  140. }
  141. })
  142. minetest.register_tool("mitchsmod:sword_diamond", {
  143. description = "Diamond Sword",
  144. inventory_image = "default_tool_diamondsword.png",
  145. tool_capabilities = {
  146. full_punch_interval = 1.0,
  147. max_drop_level=1,
  148. groupcaps={
  149. fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
  150. snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
  151. choppy={times={[3]=0.70}, uses=40, maxlevel=0}
  152. }
  153. }
  154. })
  155. minetest.register_tool("mitchsmod:sword_obsidian", {
  156. description = "Obsidian Sword",
  157. inventory_image = "default_tool_obsidiansword.png",
  158. tool_capabilities = {
  159. full_punch_interval = 1.0,
  160. max_drop_level=1,
  161. groupcaps={
  162. fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
  163. snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
  164. choppy={times={[3]=0.70}, uses=40, maxlevel=0}
  165. }
  166. }
  167. })
  168.  
  169.  
  170. --
  171. -- Crafting definition
  172. --
  173.  
  174.  
  175. minetest.register_craft({
  176. output = 'mitchsmod:FallenTree 2',
  177. recipe = {
  178. {'default:tree','',''},
  179. {'','default:tree',''},
  180. {'','',''},
  181. }
  182. })
  183.  
  184. minetest.register_craft({
  185. output = 'default:tree 2',
  186. recipe = {
  187. {'mitchsmod:FallenTree','',''},
  188. {'mitchsmod:FallenTree','',''},
  189.  
  190. }
  191. })
  192.  
  193. minetest.register_craft({
  194. output = 'mitchsmod:FallenTreeo 2',
  195. recipe = {
  196. {'','',''},
  197. {'','default:tree',''},
  198. {'default:tree','',''},
  199.  
  200. }
  201. })
  202.  
  203. minetest.register_craft({
  204. output = 'default:tree 2',
  205. recipe = {
  206. {'mitchsmod:FallenTreeo','',''},
  207. {'mitchsmod:FallenTreeo','',''},
  208.  
  209. }
  210. })
  211.  
  212. minetest.register_craft({
  213. output = 'mitchsmod:TreeSlab 6',
  214. recipe = {
  215. {'default:tree','default:tree','default:tree'},
  216.  
  217. }
  218. })
  219.  
  220. minetest.register_craft({
  221. output = 'mitchsmod:TreeSlabSlab 6',
  222. recipe = {
  223. {'mitchsmod:TreeSlab','mitchsmod:TreeSlab','mitchsmod:TreeSlab'},
  224.  
  225. }
  226. })
  227.  
  228. minetest.register_craft({
  229. output = 'mitchsmod:TreeSlabSlabSlab 3',
  230. recipe = {
  231. {'mitchsmod:TreeSlabSlab','mitchsmod:TreeSlabSlab','mitchsmod:TreeSlabSlab'},
  232. {'mitchsmod:TreeSlab','mitchsmod:TreeSlab','mitchsmod:TreeSlab'},
  233. }
  234. })
  235.  
  236. minetest.register_craft({
  237. output = 'mitchsmod:mud_source 3',
  238. recipe = {
  239. {'default:water_source'},
  240.  
  241. }
  242. })
  243. --""
  244. -------
  245. -------
  246. -------
  247. -------
  248. -------
  249.  
  250.  
  251.  
  252. minetest.register_craft({
  253. output = 'mitchsmod:pick_gold',
  254. recipe = {
  255. {'mitchsmod:gold_lump', 'mitchsmod:gold_lump', 'mitchsmod:gold_lump'},
  256. {'', 'default:stick', ''},
  257. {'', 'default:stick', ''},
  258. }
  259. })
  260.  
  261. minetest.register_craft({
  262. output = 'mitchsmod:pick_obsidian',
  263. recipe = {
  264. {'mitchsmod:obsidian_ingot', 'mitchsmod:obsidian_ingot', 'mitchsmod:obsidian_ingot'},
  265. {'', 'default:stick', ''},
  266. {'', 'default:stick', ''},
  267. }
  268. })
  269.  
  270. minetest.register_craft({
  271. output = 'mitchsmod:pick_diamond',
  272. recipe = {
  273. {'mitchsmod:diamond', 'mitchsmod:diamond', 'mitchsmod:diamond'},
  274. {'', 'default:stick', ''},
  275. {'', 'default:stick', ''},
  276. }
  277. })
  278.  
  279. -------
  280. -------
  281. -------
  282. -------
  283. -------
  284.  
  285.  
  286. minetest.register_craft({
  287. output = 'mitchsmod:shovel_gold',
  288. recipe = {
  289. {'', 'mitchsmod:gold_lump', ''},
  290. {'', 'default:stick', ''},
  291. {'', 'default:stick', ''},
  292. }
  293. })
  294.  
  295. minetest.register_craft({
  296. output = 'mitchsmod:shovel_diamond',
  297. recipe = {
  298. {'', 'mitchsmod:diamond', ''},
  299. {'', 'default:stick', ''},
  300. {'', 'default:stick', ''},
  301. }
  302. })
  303.  
  304. minetest.register_craft({
  305. output = 'mitchsmod:shovel_obsidian',
  306. recipe = {
  307. {'', 'mitchsmod:obsidian_ingot', ''},
  308. {'', 'default:stick', ''},
  309. {'', 'default:stick', ''},
  310. }
  311. })
  312.  
  313. -------
  314. -------
  315. -------
  316. -------
  317. -------
  318.  
  319.  
  320. minetest.register_craft({
  321. output = 'mitchsmod:axe_gold',
  322. recipe = {
  323. {'mitchsmod:gold_lump', 'mitchsmod:gold_lump'},
  324. {'mitchsmod:gold_lump', 'default:stick'},
  325. {'', 'default:stick'},
  326. }
  327. })
  328.  
  329. minetest.register_craft({
  330. output = 'mitchsmod:axe_diamond',
  331. recipe = {
  332. {'mitchsmod:diamond', 'mitchsmod:diamond'},
  333. {'mitchsmod:diamond', 'default:stick'},
  334. {'', 'default:stick'},
  335. }
  336. })
  337.  
  338. minetest.register_craft({
  339. output = 'mitchsmod:axe_obsidian',
  340. recipe = {
  341. {'mitchsmod:obsidian_ingot', 'mitchsmod:obsidian_ingot', ''},
  342. {'mitchsmod:obsidian_ingot', 'default:stick', ''},
  343. {'', 'default:stick', ''},
  344. }
  345. })
  346.  
  347. -------
  348. -------
  349. -------
  350. -------
  351. -------
  352.  
  353.  
  354.  
  355. minetest.register_craft({
  356. output = 'mitchsmod:sword_gold',
  357. recipe = {
  358. {'mitchsmod:gold_lump'},
  359. {'mitchsmod:gold_lump'},
  360. {'default:stick'},
  361. }
  362. })
  363.  
  364. minetest.register_craft({
  365. output = 'mitchsmod:sword_diamond',
  366. recipe = {
  367. {'mitchsmod:diamond'},
  368. {'mitchsmod:diamond'},
  369. {'default:stick'},
  370. }
  371. })
  372.  
  373. minetest.register_craft({
  374. output = 'mitchsmod:sword_obsidian',
  375. recipe = {
  376. {'', 'mitchsmod:obsidian', ''},
  377. {'', 'mitchsmod:obsidian', ''},
  378. {'', 'default:stick', ''},
  379. }
  380. })
  381.  
  382.  
  383. -------
  384. -------
  385. -------
  386. -------
  387. -------
  388. -------
  389. -------
  390. -------
  391. -------
  392. -------
  393.  
  394.  
  395. --
  396. -- Crafting (tool repair)
  397. --
  398. minetest.register_craft({
  399. type = "toolrepair",
  400. additional_wear = -0.02,
  401. })
  402.  
  403. --
  404. -- Cooking recipes
  405. --
  406.  
  407.  
  408. minetest.register_craft({
  409. type = "cooking",
  410. output = "mitchsmod:obsidian_ingot",
  411. recipe = "mitchsmod:obsidian_fragment",
  412. })
  413.  
  414.  
  415. --
  416. -- Fuels
  417. --
  418.  
  419.  
  420. --
  421. -- Node definitions
  422. --
  423.  
  424. -- Default node sounds
  425.  
  426. function default.node_sound_defaults(table)
  427. table = table or {}
  428. table.footstep = table.footstep or
  429. {name="", gain=1.0}
  430. table.dug = table.dug or
  431. {name="default_dug_node", gain=1.0}
  432. return table
  433. end
  434.  
  435. function default.node_sound_stone_defaults(table)
  436. table = table or {}
  437. table.footstep = table.footstep or
  438. {name="default_hard_footstep", gain=0.2}
  439. default.node_sound_defaults(table)
  440. return table
  441. end
  442.  
  443. function default.node_sound_dirt_defaults(table)
  444. table = table or {}
  445. table.footstep = table.footstep or
  446. {name="", gain=0.5}
  447. --table.dug = table.dug or
  448. -- {name="default_dirt_break", gain=0.5}
  449. default.node_sound_defaults(table)
  450. return table
  451. end
  452.  
  453. function default.node_sound_sand_defaults(table)
  454. table = table or {}
  455. table.footstep = table.footstep or
  456. {name="default_grass_footstep", gain=0.25}
  457. --table.dug = table.dug or
  458. -- {name="default_dirt_break", gain=0.25}
  459. table.dug = table.dug or
  460. {name="", gain=0.25}
  461. default.node_sound_defaults(table)
  462. return table
  463. end
  464.  
  465. function default.node_sound_wood_defaults(table)
  466. table = table or {}
  467. table.footstep = table.footstep or
  468. {name="default_hard_footstep", gain=0.3}
  469. default.node_sound_defaults(table)
  470. return table
  471. end
  472.  
  473. function default.node_sound_leaves_defaults(table)
  474. table = table or {}
  475. table.footstep = table.footstep or
  476. {name="default_grass_footstep", gain=0.25}
  477. table.dig = table.dig or
  478. {name="default_dig_crumbly", gain=0.4}
  479. table.dug = table.dug or
  480. {name="", gain=1.0}
  481. default.node_sound_defaults(table)
  482. return table
  483. end
  484.  
  485. function default.node_sound_glass_defaults(table)
  486. table = table or {}
  487. table.footstep = table.footstep or
  488. {name="default_stone_footstep", gain=0.25}
  489. table.dug = table.dug or
  490. {name="default_break_glass", gain=1.0}
  491. default.node_sound_defaults(table)
  492. return table
  493. end
  494.  
  495. ------------------------------------------------
  496.  
  497. --[[
  498. --
  499. -- node_box = {
  500. -- type = "fixed",
  501. -- fixed = {
  502. -- {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  503. -- {-0.5, 0, 0, 0.5, 0.5, 0.5},
  504. -- },
  505. -- },
  506. ]]
  507.  
  508. minetest.register_node("mitchsmod:stone_with_gold", {
  509. description = "Gold Ore",
  510. tile_images = {"default_stone.png^default_mineral_gold.png"},
  511. is_ground_content = true,
  512. groups = {cracky=3},
  513. drop = 'mitchsmod:gold_lump',
  514. sounds = default.node_sound_stone_defaults(),
  515. })
  516.  
  517. minetest.register_node("mitchsmod:stone_with_obsidian", {
  518. description = "Obsidian Ore",
  519. tile_images = {"default_stone.png^default_mineral_obsidian.png"},
  520. is_ground_content = true,
  521. paramtype = "light",
  522. light_source = LIGHT_MAX-8,
  523. groups = {cracky=3},
  524. drop = 'mitchsmod:obsidian_fragment 2',
  525. sounds = default.node_sound_stone_defaults(),
  526. })
  527.  
  528. minetest.register_node("mitchsmod:stone_with_uranium", {
  529. description = "Uranium Ore",
  530. tile_images = {"default_stone.png^default_mineral_uranium.png"},
  531. is_ground_content = true,
  532. paramtype = "light",
  533. light_source = LIGHT_MAX-3,
  534. damage_per_second = 2*.01,
  535. groups = {cracky=3},
  536. drop = 'mitchsmod:stone_with_uranium',
  537. sounds = default.node_sound_stone_defaults(),
  538. })
  539.  
  540. minetest.register_node("mitchsmod:stone_with_diamond", {
  541. description = "Diamond Ore",
  542. tile_images = {"default_stone.png^default_mineral_diamond.png"},
  543. is_ground_content = true,
  544. groups = {cracky=3},
  545. sounds = default.node_sound_stone_defaults(),
  546. drop = {
  547. max_items = 4,
  548. items = {
  549. {
  550. -- player will get sapling with 1/20 chance
  551. items = {'mitchsmod:diamond'},
  552. rarity = 5,
  553. },
  554. {
  555. -- player will get leaves only if he get no saplings,
  556. -- this is because max_items is 1
  557. items = {'default:cobble'},
  558. }
  559. }
  560. },
  561. })
  562.  
  563. minetest.register_node("mitchsmod:cobblestair", { --1/2 block
  564. description = "Cobble Stair",
  565. drawtype = "nodebox",
  566. tile_images = {"default_cobble.png"},
  567. is_ground_content = true,
  568. paramtype = "light",
  569. paramtype2 = "facedir",
  570. groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
  571. drop = 'mitchsmod:cobblestair',
  572. node_box = {
  573. type = "fixed",
  574. fixed = {{-0.5, -0.5, -0.5, 0.5, 0, 0.5},{-0.5, 0, 0, 0.5, 0.5, 0.5},},
  575. },
  576. selection_box = {
  577. type = "fixed",
  578. fixed = {{-0.5, -0.5, -0.5, 0.5, 0, 0.5},{-0.5, 0, 0, 0.5, 0.5, 0.5},},
  579. },
  580. sounds = default.node_sound_stone_defaults(),
  581. })
  582.  
  583. minetest.register_node("mitchsmod:FallenTree", {
  584. description = "Fallen Tree 1",
  585. tile_images = {"default_treeside.png", "default_treeside.png", "default_tree_top.png","default_tree_top.png", "default_treeside.png", "default_treeside.png"},
  586. is_ground_content = true,
  587. groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
  588. drop = 'mitchsmod:FallenTree 1',
  589. sounds = default.node_sound_wood_defaults(),
  590. })
  591.  
  592. minetest.register_node("mitchsmod:TreeSlab", { --1/2 block
  593. description = "Tree Stump",
  594. drawtype = "nodebox",
  595. tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
  596. is_ground_content = true,
  597. paramtype = "light",
  598. groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
  599. drop = 'mitchsmod:TreeSlab',
  600. node_box = {
  601. type = "fixed",
  602. fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  603. },
  604. selection_box = {
  605. type = "fixed",
  606. fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  607. },
  608. sounds = default.node_sound_wood_defaults(),
  609. })
  610.  
  611. minetest.register_node("mitchsmod:TreeSlabSlab", { --1/4 block
  612. description = "1/4 Thick Log",
  613. drawtype = "nodebox",
  614. tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
  615. is_ground_content = true,
  616. paramtype = "light",
  617. groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
  618. drop = 'mitchsmod:TreeSlabSlab',
  619. node_box = {
  620. type = "fixed",
  621. fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  622. },
  623. selection_box = {
  624. type = "fixed",
  625. fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  626. },
  627. sounds = default.node_sound_wood_defaults(),
  628. })
  629.  
  630. minetest.register_node("mitchsmod:TreeSlabSlabSlab", { --3/4 block
  631. description = "3/4 Thick Log",
  632. drawtype = "nodebox",
  633. tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
  634. is_ground_content = true,
  635. paramtype = "light",
  636. groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
  637. drop = 'mitchsmod:TreeSlabSlabSlab',
  638. node_box = {
  639. type = "fixed",
  640. fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5},
  641. },
  642. selection_box = {
  643. type = "fixed",
  644. fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5},
  645. },
  646. sounds = default.node_sound_wood_defaults(),
  647. })
  648.  
  649.  
  650. --[[
  651.  
  652.  
  653. drawtype = "nodebox",
  654. tiles = images,
  655. paramtype = "light",
  656. paramtype2 = "facedir",
  657. is_ground_content = true,
  658. node_box = {
  659. type = "fixed",
  660. fixed = {
  661. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  662. {-0.5, 0, 0, 0.5, 0.5, 0.5},
  663. },
  664. },
  665.  
  666.  
  667. ]]
  668.  
  669. minetest.register_node("mitchsmod:FallenTreeo", {
  670. description = "Fallen Tree 2",
  671. tile_images = {"default_tree.png","default_tree.png","default_treeside.png","default_treeside.png","default_tree_top.png","default_tree_top.png",},
  672. is_ground_content = true,
  673. groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
  674. drop = 'mitchsmod:FallenTreeo 1',
  675. sounds = default.node_sound_wood_defaults(),
  676. })
  677.  
  678.  
  679. minetest.register_node("mitchsmod:mud_flowing", {
  680. description = "Flowing Mud",
  681. inventory_image = minetest.inventorycube("default_mud.png"),
  682. drawtype = "flowingliquid",
  683. alpha = MUD_ALPHA,
  684. tiles = {
  685. {image="default_mud.png", backface_culling=false},
  686. },
  687. special_tiles = {
  688. {image="default_mud_flowing_animated.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=6.0}}
  689. },
  690. paramtype = "light",
  691. walkable = false,
  692. pointable = false,
  693. diggable = false,
  694. buildable_to = true,
  695.  
  696.  
  697. on_punch = minetest.item_eat(4), -- tryed to make heal, not working. fix l8r
  698. liquidtype = "flowing",
  699.  
  700.  
  701. liquid_alternative_flowing = "mitchsmod:mud_flowing",
  702. liquid_alternative_source = "mitchsmod:mud_source",
  703. liquid_viscosity = MUD_VISC,
  704. post_effect_color = {a=64, r=139, g=119, b=101},
  705. --[[
  706. --special_materials = {
  707. -- {image="default_mud.png", backface_culling=false},
  708. -- {image="default_mud.png", backface_culling=true},
  709. --},
  710. ]]
  711.  
  712. groups = {liquid=3, puts_out_fire=1},
  713. })
  714.  
  715. minetest.register_node("mitchsmod:mud_source", {
  716. description = "Mud Source",
  717. inventory_image = minetest.inventorycube("default_mud.png"),
  718. drawtype = "liquid",
  719. alpha = MUD_ALPHA,
  720. tiles = {
  721. {image="default_mud_source_animated.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=6.0}}
  722. },
  723. special_tiles = {
  724. {image="default_mud.png", backface_culling=false},
  725. },
  726. paramtype = "light",
  727. walkable = false,
  728. pointable = false,
  729. diggable = false,
  730. buildable_to = true,
  731. damage_per_second = 4,
  732. liquidtype = "source",
  733. liquid_alternative_flowing = "mitchsmod:mud_flowing",
  734. liquid_alternative_source = "mitchsmod:mud_source",
  735. liquid_viscosity = MUD_VISC,
  736. post_effect_color = {a=64, r=139, g=119, b=101},
  737. --[[
  738. --special_materials = {
  739. -- -- New-style water source material (mostly unused) default_mud_source_animated.png
  740. -- {image="default_mud.png", backface_culling=false},
  741. --},
  742. ]]
  743.  
  744. groups = {liquid=3, puts_out_fire=1},
  745. })
  746.  
  747.  
  748.  
  749.  
  750.  
  751. function hacky_swap_node(pos,name)
  752. local node = minetest.env:get_node(pos)
  753. local meta = minetest.env:get_meta(pos)
  754. local meta0 = meta:to_table()
  755. if node.name == name then
  756. return
  757. end
  758. node.name = name
  759. local meta0 = meta:to_table()
  760. minetest.env:set_node(pos,node)
  761. meta = minetest.env:get_meta(pos)
  762. meta:from_table(meta0)
  763. end
  764.  
  765.  
  766.  
  767. minetest.register_craftitem("mitchsmod:gold_lump", {
  768. description = "Gold Lump",
  769. inventory_image = "default_gold_lump.png",
  770. })
  771.  
  772. minetest.register_craftitem("mitchsmod:obsidian_fragment", {
  773. description = "Obsidian Fragment",
  774. inventory_image = "default_obsidian_fragment.png",
  775. })
  776.  
  777. minetest.register_craftitem("mitchsmod:diamond", {
  778. description = "Diamond",
  779. inventory_image = "default_diamond.png",
  780. })
  781.  
  782.  
  783. minetest.register_craftitem("mitchsmod:obsidian_ingot", {
  784. description = "Obsidian Ingot",
  785. inventory_image = "default_obsidian_ingot.png",
  786. })
  787.  
  788.  
  789.  
  790. --
  791. -- Creative inventory
  792. --
  793.  
  794. minetest.add_to_creative_inventory('mitchsmod:mud_source')
  795. minetest.add_to_creative_inventory('mitchsmod:cobblestair')
  796. --
  797. -- Falling stuff
  798. --
  799.  
  800. minetest.register_entity("mitchsmod:falling_node", {
  801. initial_properties = {
  802. physical = true,
  803. collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
  804. visual = "wielditem",
  805. textures = {},
  806. visual_size = {x=0.667, y=0.667},
  807. },
  808.  
  809. nodename = "",
  810.  
  811. set_node = function(self, nodename)
  812. self.nodename = nodename
  813. local stack = ItemStack(nodename)
  814. local itemtable = stack:to_table()
  815. local itemname = nil
  816. if itemtable then
  817. itemname = stack:to_table().name
  818. end
  819. local item_texture = nil
  820. local item_type = ""
  821. if minetest.registered_items[itemname] then
  822. item_texture = minetest.registered_items[itemname].inventory_image
  823. item_type = minetest.registered_items[itemname].type
  824. end
  825. prop = {
  826. is_visible = true,
  827. textures = {nodename},
  828. }
  829. self.object:set_properties(prop)
  830. end,
  831.  
  832. get_staticdata = function(self)
  833. return self.nodename
  834. end,
  835.  
  836. on_activate = function(self, staticdata)
  837. self.nodename = staticdata
  838. self.object:set_armor_groups({immortal=1})
  839. --self.object:setacceleration({x=0, y=-10, z=0})
  840. self:set_node(self.nodename)
  841. end,
  842.  
  843. on_step = function(self, dtime)
  844. -- Set gravity
  845. self.object:setacceleration({x=0, y=-10, z=0})
  846. -- Turn to actual sand when collides to ground or just move
  847. local pos = self.object:getpos()
  848. local bcp = {x=pos.x, y=pos.y-0.7, z=pos.z} -- Position of bottom center point
  849. local bcn = minetest.env:get_node(bcp)
  850. -- Note: walkable is in the node definition, not in item groups
  851. if minetest.registered_nodes[bcn.name] and
  852. minetest.registered_nodes[bcn.name].walkable then
  853. local np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
  854. -- Check what's here
  855. local n2 = minetest.env:get_node(np)
  856. -- If it's not air or liquid, remove node and replace it with
  857. -- it's drops
  858. if n2.name ~= "air" and (not minetest.registered_nodes[n2.name] or
  859. minetest.registered_nodes[n2.name].liquidtype == "none") then
  860. local drops = minetest.get_node_drops(n2.name, "")
  861. minetest.env:remove_node(np)
  862. -- Add dropped items
  863. local _, dropped_item
  864. for _, dropped_item in ipairs(drops) do
  865. minetest.env:add_item(np, dropped_item)
  866. end
  867. -- Run script hook
  868. local _, callback
  869. for _, callback in ipairs(minetest.registered_on_dignodes) do
  870. callback(np, n2, nil)
  871. end
  872. end
  873. -- Create node and remove entity
  874. minetest.env:add_node(np, {name=self.nodename})
  875. self.object:remove()
  876. else
  877. -- Do nothing
  878. end
  879. end
  880. })
  881.  
  882. function default.spawn_falling_node(p, nodename)
  883. obj = minetest.env:add_entity(p, "mitchsmod:falling_node")
  884. obj:get_luaentity():set_node(nodename)
  885. end
  886.  
  887. -- END
RAW Paste Data