mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-25 02:00:37 +01:00
Updated beds' mod to hide warning messages
- Global variable `writing` removed - License update
This commit is contained in:
parent
f9ebbc93dc
commit
a0a7485ae4
@ -12,32 +12,16 @@ players are in bed too. If all players are sleeping the night gets skipped aswel
|
|||||||
if more than 50% of the players are lying in bed and use this option.
|
if more than 50% of the players are lying in bed and use this option.
|
||||||
|
|
||||||
Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point
|
Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point
|
||||||
is set to the beds location. If dying you will respawn there.
|
is set to the beds location and you will respawn there after death.
|
||||||
|
You can disable the respawn at beds by setting "enable_bed_respawn = false" in minetest.conf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
You can craft two types of beds:
|
|
||||||
|
|
||||||
|
|
||||||
Simple shaped bed:
|
|
||||||
|
|
||||||
wool wool wool
|
|
||||||
wood wood wood
|
|
||||||
|
|
||||||
Fancy shaped bed:
|
|
||||||
|
|
||||||
wool wool stick
|
|
||||||
wood wood wood
|
|
||||||
|
|
||||||
Notice: You can use any color of wood or wool, mixing different is also possible.
|
|
||||||
|
|
||||||
|
|
||||||
License of source code, textures: WTFPL
|
License of source code, textures: WTFPL
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
(c) Copyright BlockMen (2014-2015)
|
(c) Copyright BlockMen (2014-2015)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
This program is free software. It comes without any warranty, to
|
This program is free software. It comes without any warranty, to
|
||||||
the extent permitted by applicable law. You can redistribute it
|
the extent permitted by applicable law. You can redistribute it
|
||||||
and/or modify it under the terms of the Do What The Fuck You Want
|
and/or modify it under the terms of the Do What The Fuck You Want
|
||||||
|
@ -42,7 +42,8 @@ beds.register_bed("beds:fancy_bed", {
|
|||||||
},
|
},
|
||||||
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
||||||
recipe = {
|
recipe = {
|
||||||
{"wool:red", "wool:white", "group:stick"},
|
{"", "", "group:stick"},
|
||||||
|
{"wool:red", "wool:red", "wool:white"},
|
||||||
{"group:wood", "group:wood", "group:wood"},
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
local player_in_bed = 0
|
local player_in_bed = 0
|
||||||
local is_sp = minetest.is_singleplayer()
|
local is_sp = minetest.is_singleplayer()
|
||||||
|
local enable_respawn = minetest.setting_getbool("enable_bed_respawn")
|
||||||
|
if enable_respawn == nil then
|
||||||
|
enable_respawn = true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- helper functions
|
-- helper functions
|
||||||
@ -166,7 +170,11 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
beds.read_spawns()
|
beds.read_spawns()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- respawn player at bed if enabled and valid position is found
|
||||||
minetest.register_on_respawnplayer(function(player)
|
minetest.register_on_respawnplayer(function(player)
|
||||||
|
if not enable_respawn then
|
||||||
|
return false
|
||||||
|
end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local pos = beds.spawn[name] or nil
|
local pos = beds.spawn[name] or nil
|
||||||
if pos then
|
if pos then
|
||||||
|
@ -41,13 +41,11 @@ function beds.save_spawns()
|
|||||||
if not beds.spawn then
|
if not beds.spawn then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
writing = true
|
|
||||||
local output = io.open(org_file, "w")
|
local output = io.open(org_file, "w")
|
||||||
for i, v in pairs(beds.spawn) do
|
for i, v in pairs(beds.spawn) do
|
||||||
output:write(v.x.." "..v.y.." "..v.z.." "..i.."\n")
|
output:write(v.x.." "..v.y.." "..v.z.." "..i.."\n")
|
||||||
end
|
end
|
||||||
io.close(output)
|
io.close(output)
|
||||||
writing = false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function beds.set_spawns()
|
function beds.set_spawns()
|
||||||
|
Loading…
Reference in New Issue
Block a user