Page 1 of 1

Liquid Guard

PostPosted: Sun Jul 10, 2016 15:02
by everamzah
Description: Require a priv named 'liquid' to use liquid source nodes. Lava, including its bucket, require a `lava` priv.
License: WTFPL
Depends: default, bucket
Git repo: https://github.com/everamzah/liquid_guard


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_privilege("liquid", "Can place liquid source nodes.")
minetest.register_privilege("lava", "Can use liquid igniters.")

local old_lava_bucket_place = minetest.registered_items["bucket:bucket_lava"].on_place

minetest.override_item("bucket:bucket_lava", {
   on_place = function(itemstack, placer, pointed_thing)
      if not minetest.check_player_privs(placer:get_player_name(),
            {lava = true}) then
         return itemstack
      else
         return old_lava_bucket_place(itemstack, placer, pointed_thing)
      end
   end,
})

minetest.override_item("default:lava_source", {
   after_place_node = function(pos, placer, itemstack, pointed_thing)
      if not minetest.check_player_privs(placer:get_player_name(),
            {liquid = true, lava = true}) then
         minetest.remove_node(pos)
      end
   end,
})

minetest.override_item("default:water_source", {
   after_place_node = function(pos, placer, itemstack, pointed_thing)
      if not minetest.check_player_privs(placer:get_player_name(),
            {liquid = true}) then
         minetest.remove_node(pos)
      end
   end,
})

minetest.override_item("default:river_water_source", {
   after_place_node = function(pos, placer, itemstack, pointed_thing)
      if not minetest.check_player_privs(placer:get_player_name(),
            {liquid = true}) then
         minetest.remove_node(pos)
      end
   end,
})

Re: Liquid Guard

PostPosted: Mon Jul 11, 2016 20:53
by MineYoshi
liquid privileges?

Re: Liquid Guard

PostPosted: Tue Jul 12, 2016 23:42
by azekill_DIABLO
Yes you can transform into slime with this

Re: Liquid Guard

PostPosted: Wed Jul 13, 2016 06:23
by D00Med
^lol
Nice mod though, it will be useful.

Re: Liquid Guard

PostPosted: Fri Jul 15, 2016 16:25
by DS-minetest
good against griefing with lava or corium (technic mod)

Re: Liquid Guard

PostPosted: Wed Nov 09, 2016 16:39
by Fixerol