Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions functions.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function landrush.get_chunk(pos)
local x = math.floor(pos.x/landrush.config:get("chunkSize"))
local x = math.floor((pos.x+.5)/landrush.config:get("chunkSize"))
-- 3 levels of vertical protection
local y = 0

Expand All @@ -14,12 +14,12 @@ function landrush.get_chunk(pos)
end


local z = math.floor(pos.z/landrush.config:get("chunkSize"))
local z = math.floor((pos.x+.5)/landrush.config:get("chunkSize"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in (pos.x+.5)

return x..","..y..","..z
end

function landrush.get_chunk_center(pos)
local x = math.floor(pos.x/landrush.config:get("chunkSize"))*landrush.config:get("chunkSize")+7.5
local x = math.floor(pos.x/landrush.config:get("chunkSize"))*landrush.config:get("chunkSize")+landrush.config:get("chunkSize")/2-.5
Copy link
Contributor

@SmallJoker SmallJoker Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caching the chunksize setting at this point wouldn't hurt ;)

local y = 0

if ( pos.y < -200 ) then
Expand All @@ -32,7 +32,7 @@ function landrush.get_chunk_center(pos)
y = 120
end

local z = math.floor(pos.z/landrush.config:get("chunkSize"))*landrush.config:get("chunkSize")+7.5
local z = math.floor(pos.z/landrush.config:get("chunkSize"))*landrush.config:get("chunkSize")+landrush.config:get("chunkSize")/2-.5
return {x=x,y=y,z=z}
end

Expand Down