Restrict placement of villages to server op
This commit is contained in:
parent
d9a41681c1
commit
33234e0f48
@ -3,3 +3,4 @@ Village Entity Spawner=
|
|||||||
Village Spawner=
|
Village Spawner=
|
||||||
Mapgen Village Spawner=
|
Mapgen Village Spawner=
|
||||||
(Has chance of not spawning village)=
|
(Has chance of not spawning village)=
|
||||||
|
You need the “server” privilege to use this.=
|
||||||
|
@ -3,3 +3,4 @@ Village Entity Spawner=Dorf-Entity-Erzeuger
|
|||||||
Village Spawner=Dorf-Erzeuger
|
Village Spawner=Dorf-Erzeuger
|
||||||
Mapgen Village Spawner=Kartengenerator-Dorf-Erzeuger
|
Mapgen Village Spawner=Kartengenerator-Dorf-Erzeuger
|
||||||
(Has chance of not spawning village)=(Könnte das Dorf evtl. nicht erzeugen)
|
(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.
|
||||||
|
@ -21,6 +21,14 @@ local shortseed = bitwise_and(mapseed, 0xFFFFFF)
|
|||||||
|
|
||||||
-- Nodes
|
-- 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.")))
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
"village:entity_spawner",
|
"village:entity_spawner",
|
||||||
{
|
{
|
||||||
@ -39,6 +47,7 @@ minetest.register_node(
|
|||||||
drop = "",
|
drop = "",
|
||||||
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
|
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
|
||||||
sounds = default.node_sound_defaults(),
|
sounds = default.node_sound_defaults(),
|
||||||
|
on_place = place_priv,
|
||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
-- Wait until some objects are nearby ...
|
-- Wait until some objects are nearby ...
|
||||||
local objs_around = minetest.get_objects_inside_radius(pos, 12)
|
local objs_around = minetest.get_objects_inside_radius(pos, 12)
|
||||||
@ -79,6 +88,7 @@ minetest.register_node(
|
|||||||
sounds = default.node_sound_dirt_defaults(),
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
drop = "",
|
drop = "",
|
||||||
|
|
||||||
|
on_place = place_priv,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user