aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-12-11 17:11:42 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-12-11 17:11:42 +0100
commite136b8eb0e92b9cde2bbd94a5c017a5c4ea524e1 (patch)
treea287c7561efaf2c8f21cf8e3cdfea42d18d149e1
downloadautodupe-e136b8eb0e92b9cde2bbd94a5c017a5c4ea524e1.tar.xz
Initial Commit
-rw-r--r--README2
-rw-r--r--init.lua34
-rw-r--r--mod.conf4
-rw-r--r--settingtypes.txt1
4 files changed, 41 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..7c00efe
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
+# autodupe
+A dragonfire CSM to automatically dupe in MineClone2
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..d365af7
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,34 @@
+minetest.register_globalstep(function()
+ if not minetest.settings:get_bool("autodupe") then return end
+ local player = minetest.localplayer
+ if not player then return end
+ local airs = minetest.find_nodes_near(player:get_pos(), 5, "air")
+ for _, p in ipairs(airs) do
+ local invstr = "nodemeta:" .. p.x .. "," .. p.y .. "," .. p.z
+ if minetest.get_inventory(invstr) then
+ local invact = InventoryAction("drop")
+ invact:from(invstr, "src", 1)
+ invact:set_count(0)
+ invact:apply()
+ end
+ end
+ local furnaces = minetest.find_nodes_near(player:get_pos(), 5, "mcl_furnaces:furnace")
+ local dug_any = false
+ local index = player:get_wield_index()
+ for _, p in ipairs(furnaces) do
+ local inv = minetest.get_inventory("nodemeta:" .. p.x .. "," .. p.y .. "," .. p.z)
+ if inv and inv.src and inv.src[1]:get_name() ~= "" then
+ if not dug_any then
+ autotool.select_best_tool("mcl_furnaces:furnace")
+ dug_any = true
+ end
+ minetest.dig_node(p)
+ end
+ end
+ if dug_any then
+ player:set_wield_index(index)
+ minetest.close_formspec("")
+ end
+end)
+
+minetest.register_cheat("AutoDupe", "World", "autodupe")
diff --git a/mod.conf b/mod.conf
new file mode 100644
index 0000000..fd076e3
--- /dev/null
+++ b/mod.conf
@@ -0,0 +1,4 @@
+name = autodupe
+autor = Fleckenstein
+description = A dragonfire CSM to automatically dupe in MineClone2
+depends = autotool
diff --git a/settingtypes.txt b/settingtypes.txt
new file mode 100644
index 0000000..0ec7224
--- /dev/null
+++ b/settingtypes.txt
@@ -0,0 +1 @@
+autodupe (AutoDupe) bool false