add more beds as fuel, add mini-game respawn flag.
This commit is contained in:
parent
9e403b5e02
commit
d3605f8e80
@ -77,6 +77,14 @@ Crafting are same as original default mod, but colored uses a white plus the oth
|
||||
| beds:bed_top_red | beds:bed_top |
|
||||
| beds:bed_bottom_red | beds:bed_bottom |
|
||||
|
||||
#### Mini-Game Support
|
||||
|
||||
If enable_bed_respawn is set to true and a player dies when playing a mini-game then this
|
||||
can interrupt the game, so a special beds.respawn[player_name] flag has been added which
|
||||
is set to 'true' by default to always respawn player at their bed, but can be set to
|
||||
'false' during a mini-game to stop this behaviour.
|
||||
|
||||
|
||||
License
|
||||
------
|
||||
|
||||
|
18
beds.lua
18
beds.lua
@ -89,8 +89,26 @@ minetest.register_craft({
|
||||
burntime = 13
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "beds:fancy_bed_pink",
|
||||
burntime = 13
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "beds:bed",
|
||||
burntime = 12
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "beds:bed_blue",
|
||||
burntime = 12
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "beds:bed_white",
|
||||
burntime = 12
|
||||
})
|
||||
|
@ -318,6 +318,15 @@ end
|
||||
-- Only register respawn callback if respawn enabled
|
||||
if enable_respawn then
|
||||
|
||||
-- set respawn flag to true by default
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
|
||||
if not player then return end
|
||||
|
||||
local name = player:get_player_name()
|
||||
beds.respawn[name] = true
|
||||
end)
|
||||
|
||||
-- respawn player at bed if enabled and valid position is found
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
|
||||
@ -326,7 +335,8 @@ if enable_respawn then
|
||||
local name = player:get_player_name()
|
||||
local pos = beds.spawn[name]
|
||||
|
||||
if pos then
|
||||
-- check if respawn flag is true (for mini-game support, can be set to false)
|
||||
if pos and beds.respawn[name] then
|
||||
player:set_pos(pos)
|
||||
return true
|
||||
end
|
||||
|
1
init.lua
1
init.lua
@ -27,6 +27,7 @@ beds = {
|
||||
bed_position = {},
|
||||
pos = {},
|
||||
spawn = {},
|
||||
respawn = {},
|
||||
get_translator = S,
|
||||
formspec = "size[8,11;true]"
|
||||
.. "no_prepend[]"
|
||||
|
@ -50,6 +50,7 @@ function beds.read_spawns()
|
||||
end
|
||||
|
||||
|
||||
-- load player spawn positions
|
||||
beds.read_spawns()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user