configurable send notificaicon about spawn point privatelly
This commit is contained in:
parent
7af1f6fb1b
commit
42624f02fe
18
init.lua
18
init.lua
@ -13,6 +13,8 @@ if beds == nil then
|
|||||||
bed_respawn = false
|
bed_respawn = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local notice_pos = minetest.settings:get_bool("spawnrand.notification_position") or true
|
||||||
|
|
||||||
-- spawnrand function invocation, it uses internat "find_ground" to fid valid position from initial one
|
-- spawnrand function invocation, it uses internat "find_ground" to fid valid position from initial one
|
||||||
function spawnrand(player)
|
function spawnrand(player)
|
||||||
local elevation = 20
|
local elevation = 20
|
||||||
@ -51,7 +53,9 @@ function find_ground(pos, player)
|
|||||||
finished = true
|
finished = true
|
||||||
name = player:get_player_name()
|
name = player:get_player_name()
|
||||||
pos = player:getpos()
|
pos = player:getpos()
|
||||||
minetest.chat_send_player(name, "spawnrand: "..pos.x..","..pos.y..","..pos.z )
|
if notice_pos then
|
||||||
|
minetest.chat_send_player(name, "spawnrand: "..pos.x..","..pos.y..","..pos.z )
|
||||||
|
end
|
||||||
minetest.log("action", "[spawnrand] position for "..name.. ", "..pos.x..","..pos.y..","..pos.z)
|
minetest.log("action", "[spawnrand] position for "..name.. ", "..pos.x..","..pos.y..","..pos.z)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -74,7 +78,9 @@ function find_ground(pos, player)
|
|||||||
i = 25
|
i = 25
|
||||||
name = player:get_player_name()
|
name = player:get_player_name()
|
||||||
pos = player:getpos()
|
pos = player:getpos()
|
||||||
minetest.chat_send_player(name, "spawnrand: "..pos.x..","..pos.y..","..pos.z )
|
if notice_pos then
|
||||||
|
minetest.chat_send_player(name, "spawnrand: "..pos.x..","..pos.y..","..pos.z )
|
||||||
|
end
|
||||||
minetest.log("action", "[spawnrand] position for "..name.. ", "..pos.x..","..pos.y..","..pos.z)
|
minetest.log("action", "[spawnrand] position for "..name.. ", "..pos.x..","..pos.y..","..pos.z)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -103,7 +109,9 @@ minetest.register_on_newplayer(function(player)
|
|||||||
local pos
|
local pos
|
||||||
if player ~= nil then
|
if player ~= nil then
|
||||||
pos = player:getpos()
|
pos = player:getpos()
|
||||||
minetest.chat_send_player(player:get_player_name( ), "...awaiting new spawn from : ".. pos.x ..","..pos.y..","..pos.z )
|
if notice_pos then
|
||||||
|
minetest.chat_send_player(player:get_player_name( ), "...awaiting new spawn from : ".. pos.x ..","..pos.y..","..pos.z )
|
||||||
|
end
|
||||||
spawnrand(player)
|
spawnrand(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -117,7 +125,9 @@ minetest.register_on_respawnplayer(function(player)
|
|||||||
if player ~= nil then
|
if player ~= nil then
|
||||||
name = player:get_player_name()
|
name = player:get_player_name()
|
||||||
pos = player:getpos()
|
pos = player:getpos()
|
||||||
minetest.chat_send_player(player:get_player_name( ), "...awaiting new spawn from : ".. pos.x ..","..pos.y..","..pos.z )
|
if notice_pos then
|
||||||
|
minetest.chat_send_player(player:get_player_name( ), "...awaiting new spawn from : ".. pos.x ..","..pos.y..","..pos.z )
|
||||||
|
end
|
||||||
if bed_respawn then
|
if bed_respawn then
|
||||||
pos = beds.spawn[name]
|
pos = beds.spawn[name]
|
||||||
if pos then
|
if pos then
|
||||||
|
2
settingtypes.txt
Normal file
2
settingtypes.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# will send a chat notificatin private message to the player about new spawn position
|
||||||
|
spawnrand.notification_position (Send a private notification about new pos to player) bool true
|
Loading…
x
Reference in New Issue
Block a user