add support for static_spawnpoint back

This commit is contained in:
chmodsayshello 2022-04-26 13:00:52 +00:00
parent 0c2562b88c
commit 1735343c5e
1 changed files with 36 additions and 29 deletions

View File

@ -44,6 +44,13 @@ function mcl_compass.get_compass_image(pos, dir, itemstack)
end
else --no lodestone meta, normal compass....
local spawn = {x = 0, y=0, z=0} --before you guys tell me that the normal compass no points to real spawn, it always pointed to 0 0
local ssp = minetest.setting_get_pos("static_spawnpoint")
if ssp then
spawn = ssp
if type(spawn) ~= "table" or type(spawn.x) ~= "number" or type(spawn.y) ~= "number" or type(spawn.z) ~= "number" then
spawn = {x=0,y=0,z=0}
end
end
if mcl_worlds.compass_works(pos) then --is the player in the overworld?
local angle_north = math.deg(math.atan2(spawn.x - pos.x, spawn.z - pos.z))