movable_spawnpoint = {}

local storage = minetest.get_mod_storage()

local spawnpoint =
	minetest.deserialize(storage:get_string("spawnpoint")) or
		{x = 0, y = -24, z = 0}

function movable_spawnpoint.set_spawnpoint(p)
	assert(type(p.x) == "number" and
		type(p.y) == "number" and
		type(p.z) == "number", "Can't set spawnpoint to non-vector")

	spawnpoint = p
	storage:set_string("spawnpoint", minetest.serialize(spawnpoint))
end
function movable_spawnpoint.spawn_player(player)
	player:set_pos(spawnpoint)
end
