Add "maphack" privilege for placing villages

This priv can later be re-used for other advanced map-changing tools
This commit is contained in:
Wuzzy 2019-09-26 13:58:13 +02:00
parent 33234e0f48
commit d4d7f710fc
8 changed files with 16 additions and 4 deletions

6
mods/privs/init.lua Normal file
View File

@ -0,0 +1,6 @@
local S = minetest.get_translator("privs")
minetest.register_privilege("maphack", {
description = S("Can make advanced changes to the map, like placing villages"),
give_to_singleplayer = false,
give_to_admin = false,
})

View File

@ -0,0 +1,2 @@
# textdomain:privs
Can make advanced changes to the map, like placing villages=Kann erweitere Änderungen an der Karte vornehmen, z.B. Dörfer platzieren

View File

@ -0,0 +1,2 @@
# textdomain:privs
Can make advanced changes to the map, like placing villages=

1
mods/privs/mod.conf Normal file
View File

@ -0,0 +1 @@
name=privs

View File

@ -3,4 +3,5 @@ util
mobs
goodies
nav
privs
locks?

View File

@ -3,4 +3,4 @@ Village Entity Spawner=
Village Spawner=
Mapgen Village Spawner=
(Has chance of not spawning village)=
You need the “server” privilege to use this.=
You need the “maphack” privilege to use this.=

View File

@ -3,4 +3,4 @@ Village Entity Spawner=Dorf-Entity-Erzeuger
Village Spawner=Dorf-Erzeuger
Mapgen Village Spawner=Kartengenerator-Dorf-Erzeuger
(Has chance of not spawning village)=(Könnte das Dorf evtl. nicht erzeugen)
You need the “server” privilege to use this.=Sie brauchen das „server“-Privileg, um dies benutzen zu können.
You need the “maphack” privilege to use this.=Sie brauchen das „maphack“-Privileg, um dies benutzen zu können.

View File

@ -22,8 +22,8 @@ local shortseed = bitwise_and(mapseed, 0xFFFFFF)
-- Nodes
local place_priv = function(itemstack, placer, pointed_thing)
if not minetest.get_player_privs(placer:get_player_name()).server then
minetest.chat_send_player(placer:get_player_name(), minetest.colorize("#FF0000", S("You need the “server” privilege to use this.")))
if not minetest.get_player_privs(placer:get_player_name()).maphack then
minetest.chat_send_player(placer:get_player_name(), minetest.colorize("#FF0000", S("You need the “maphack” privilege to use this.")))
return itemstack
end
return minetest.item_place(itemstack, placer, pointed_thing)