mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-20 22:33:16 -04:00
added Bucket privilege to restrict bucket usage
Griefers like the bucket, as it is not very safe if used near protected areas.
This commit is contained in:
parent
73ea8e2e91
commit
5ed14ef77b
1 changed files with 9 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
||||||
-- Load support for MT game translation.
|
-- Load support for MT game translation.
|
||||||
local S = minetest.get_translator("bucket")
|
local S = minetest.get_translator("bucket")
|
||||||
|
|
||||||
|
-- create Bucket privilege to allow Player use the bucket
|
||||||
|
minetest.register_privilege("bucket", {description = "Can use bucket" })
|
||||||
|
|
||||||
minetest.register_alias("bucket", "bucket:bucket_empty")
|
minetest.register_alias("bucket", "bucket:bucket_empty")
|
||||||
minetest.register_alias("bucket_water", "bucket:bucket_water")
|
minetest.register_alias("bucket_water", "bucket:bucket_water")
|
||||||
|
@ -30,6 +32,13 @@ local function check_protection(pos, name, text)
|
||||||
minetest.record_protection_violation(pos, name)
|
minetest.record_protection_violation(pos, name)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- require Bucket privilege for using a Bucket, as bucket is known to damage protected areas if used by griefers
|
||||||
|
if not minetest.check_player_privs(user:get_player_name(), {bucket=true}) then
|
||||||
|
minetest.chat_send_player(user:get_player_name(), "You dont have the bucket privilege!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue