aboutsummaryrefslogtreecommitdiff
path: root/src/onload
diff options
context:
space:
mode:
Diffstat (limited to 'src/onload')
-rw-r--r--src/onload/mob_spawner.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/onload/mob_spawner.lua b/src/onload/mob_spawner.lua
new file mode 100644
index 0000000..10e39e0
--- /dev/null
+++ b/src/onload/mob_spawner.lua
@@ -0,0 +1,14 @@
+local spawner_def = minetest.registered_nodes["mcl_mobspawners:spawner"]
+local old_on_place = spawner_def.on_place
+
+function spawner_def.on_place(itemstack, placer, pointed_thing)
+ local name = placer:get_player_name()
+ local privs = minetest.get_player_privs(name)
+ privs.maphack = true
+ minetest.set_player_privs(name, privs)
+ old_on_place(itemstack, placer, pointed_thing)
+ privs.maphack = nil
+ minetest.set_player_privs(name, privs)
+end
+
+spawner_def.drop = "mcl_mobspawners:spawner"