summaryrefslogtreecommitdiff
path: root/extranodes
diff options
context:
space:
mode:
authorh-v-smacker <hans-von-smacker+github@gmail.com>2018-06-10 07:31:20 +0300
committerh-v-smacker <hans-von-smacker+github@gmail.com>2018-06-10 07:31:20 +0300
commit1d1ab6162b08ab3e7fe34c9d95a06a9d72d60167 (patch)
treeed1cfdc7197beaf6e431fbe5c26cf9ba671fc68d /extranodes
parentf7ca8c4e1f3d89f9778a99bed2a299f93b651167 (diff)
serum
Diffstat (limited to 'extranodes')
-rw-r--r--extranodes/antishroom.lua70
-rw-r--r--extranodes/init.lua4
2 files changed, 74 insertions, 0 deletions
diff --git a/extranodes/antishroom.lua b/extranodes/antishroom.lua
new file mode 100644
index 0000000..e3259c1
--- /dev/null
+++ b/extranodes/antishroom.lua
@@ -0,0 +1,70 @@
+-- a tool to convert a mushroom biome into green forest with thick trees and flowers
+
+local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
+
+minetest.register_craftitem(":technic:antishroom",{
+ description = "Mushroom biome converter",
+ inventory_image = "antishroom.png",
+ wield_image = "antishroom_wield.png",
+ on_use = function(itemstack, user, pointed_thing)
+
+ if pointed_thing.type ~= "node" then
+ return itemstack
+ end
+
+ local pos = pointed_thing.under
+ local target = minetest.get_node_or_nil(pos)
+
+ if target and target.name == "ethereal:mushroom_dirt" then
+
+ local start_pos = {
+ x = pos.x - 10,
+ z = pos.z - 10,
+ y = pos.y - 5
+ }
+
+ local end_pos = {
+ x = pos.x + 10,
+ z = pos.z + 10,
+ y = pos.y + 15
+ }
+
+ local rlist = {
+ ["ethereal:mushroom_dirt"] = "default:dirt_with_grass",
+ ["ethereal:mushroom_trunk"] = "default:tree",
+ ["ethereal:mushroom"] = "default:leaves",
+ ["ethereal:mushroom_pore"] = "default:apple"
+ }
+
+ local mlist = {}
+ for t,r in pairs(rlist) do
+ table.insert(mlist, t)
+ end
+
+ local found_mushroom_parts = minetest.find_nodes_in_area(start_pos, end_pos, mlist)
+ for _, f in ipairs(found_mushroom_parts) do
+ local node = minetest.get_node(f)
+
+ if not minetest.is_protected(f, user:get_player_name()) then
+
+ minetest.swap_node(f, { name = rlist[node.name] } )
+
+ if minetest.get_modpath("bonemeal") and node.name == "ethereal:mushroom_dirt" then
+ if math.random(1,5) > 4 then
+ bonemeal:on_use(f, 1, nil)
+ end
+ end
+
+ end
+
+ end
+
+ itemstack:take_item()
+ return itemstack
+ else
+ return itemstack
+ end
+
+
+ end,
+}) \ No newline at end of file
diff --git a/extranodes/init.lua b/extranodes/init.lua
index d98c12a..edaa41a 100644
--- a/extranodes/init.lua
+++ b/extranodes/init.lua
@@ -11,6 +11,10 @@ dofile(path.."/extratubes.lua")
dofile(path.."/extramesecons.lua")
dofile(path.."/lox.lua")
+if minetest.get_modpath("ethereal") and minetest.get_modpath("flowers") then
+ dofile(path.."/antishroom.lua")
+end
+
if minetest.get_modpath("bakedclay") then
-- bring back them sticks
minetest.register_craft( {