Remove after decimal before saving positions
Adds helper function, spawnpoint.pos_clean, to strip off everything past the decimal point when saving a new spawnpoint position.master
parent
fb42e1c504
commit
faf9e2824f
11
init.lua
11
init.lua
|
@ -15,6 +15,15 @@ end
|
||||||
-- HELPER FUNCTIONS --
|
-- HELPER FUNCTIONS --
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
-- [function] Clean Position
|
||||||
|
function spawnpoint.pos_clean(pos)
|
||||||
|
pos.x = math.floor(pos.x)
|
||||||
|
pos.y = math.floor(pos.y)
|
||||||
|
pos.z = math.floor(pos.z)
|
||||||
|
|
||||||
|
return pos
|
||||||
|
end
|
||||||
|
|
||||||
-- [function] Load
|
-- [function] Load
|
||||||
function spawnpoint.load()
|
function spawnpoint.load()
|
||||||
local res = io.open(path, "r"):read("*all")
|
local res = io.open(path, "r"):read("*all")
|
||||||
|
@ -35,7 +44,7 @@ function spawnpoint.set(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(pos) == "table" then
|
if type(pos) == "table" then
|
||||||
spawnpoint.pos = pos
|
spawnpoint.pos = spawnpoint.pos_clean(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue