integrate bed respawning
This commit is contained in:
parent
a8b6568cbb
commit
448704f9c8
18
README.md
18
README.md
@ -1,18 +1,16 @@
|
||||
# r-Spawn for Minetest
|
||||
|
||||
A spawn command for Minetest without needing a fixed point
|
||||
A spawn command for Minetest without needing a fixed point -- singpleayer rejoice!
|
||||
|
||||
If no `static_spawnpoint` is defined in `minetest.conf`, each player is given a spawn location somewhere near 0,0,0.
|
||||
Players are each given their own randomized spawn point on first joining. If no `static_spawnpoint` is defined in `minetest.conf`, the origin is 0,0,0. If static spawn point is defined, that point is used as origin instead.
|
||||
|
||||
If static spawn point is defined, that point is used as origin instead.
|
||||
Considerations:
|
||||
|
||||
Players will not spawn in spaces that are protected by any other player than the Server Admin.
|
||||
|
||||
Players can request a new spawn point by typing `/newspawn` if they have the `newspawn` privilege.
|
||||
|
||||
Player will respawn at ths spawnpoint if they die.
|
||||
|
||||
TODO - integrate with beds API to allow bed to override the spawn.
|
||||
* Players will not spawn in spaces that are protected by any other player than the Server Admin.
|
||||
* Player will respawn at their spawnpoint if they die.
|
||||
* Players will respawn at their bed if this option is active
|
||||
* Their `/spawn` location will still be the randomized location.
|
||||
* Players can request a new spawn point by typing `/newspawn` if they have the `newspawn` privilege.
|
||||
|
||||
## License
|
||||
|
||||
|
10
init.lua
10
init.lua
@ -4,6 +4,8 @@ local adminname = minetest.setting_get("name") or "singleplayer"
|
||||
local playerspawns = {}
|
||||
local spawnsfile = minetest.get_worldpath().."/dynamicspawns.lua.ser"
|
||||
|
||||
local bedspawn = minetest.setting_getbool("enable_bed_respawn")
|
||||
|
||||
minetest.register_privilege("spawn", "Can teleport to spawn position.")
|
||||
|
||||
|
||||
@ -122,6 +124,14 @@ end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
if bedspawn == true then
|
||||
local pos = beds.spawn[name]
|
||||
if pos then
|
||||
player:setpos(pos)
|
||||
return true
|
||||
end
|
||||
end
|
||||
-- And if no bed, nor bed spwawning not active:
|
||||
player:setpos(playerspawns[name])
|
||||
return true
|
||||
end)
|
||||
|
Loading…
x
Reference in New Issue
Block a user