Fix dimension off-by-one error
parent
0664e2387d
commit
2041a6d133
|
@ -123,7 +123,7 @@ function create_role(self)
|
|||
end
|
||||
|
||||
function new(min, max, meta)
|
||||
local obj = create_base(min, vector.subtract(max, 1))
|
||||
local obj = create_base(min, max)
|
||||
if not obj then
|
||||
return obj
|
||||
end
|
||||
|
@ -160,7 +160,7 @@ function owner_info(self)
|
|||
end
|
||||
|
||||
function info(self)
|
||||
local dim = get_dim(self)
|
||||
local dim = vector.add(get_dim(self), 1)
|
||||
return ('Arena #%s "%s" by %s from (%s, %s, %s) to (%s, %s, %s) - %s wide, %s tall and %s long'):format(
|
||||
self.id,
|
||||
self.meta.name,
|
||||
|
@ -178,7 +178,7 @@ function info(self)
|
|||
end
|
||||
|
||||
function formspec_table_info(self)
|
||||
local dim = get_dim(self)
|
||||
local dim = vector.add(get_dim(self), 1)
|
||||
return table.concat(modlib.table.map({
|
||||
cellestial.colors.cell.fill,
|
||||
"#" .. self.id,
|
||||
|
@ -661,7 +661,6 @@ else
|
|||
new_data[index] = c_id
|
||||
end
|
||||
self.area = new_data
|
||||
local min, max = self.min, self.max
|
||||
for index in iter_content(self) do
|
||||
local c_id = data[index]
|
||||
local amount = 0
|
||||
|
|
|
@ -133,7 +133,7 @@ register_chatcommand(
|
|||
dim[assign[name]] = new_dim
|
||||
end
|
||||
if arena:resize(dim) then
|
||||
return true, "Arena resized to " .. dim.x .. ", " .. dim.y .. ", " .. dim.z
|
||||
return true, "Arena resized to " .. (dim.x + 1) .. ", " .. (dim.y + 1) .. ", " .. (dim.z + 1)
|
||||
end
|
||||
return false, "Arena would collide with other arenas if resized"
|
||||
end,
|
||||
|
@ -490,7 +490,7 @@ function create_arena(sendername, params, nums)
|
|||
if arena.overlaps(min, max) then
|
||||
return false, "Selected area intersects with existing arenas"
|
||||
end
|
||||
local arena = arena.new(min, max, { name = name, owners = owners })
|
||||
local arena = arena.new(min, vector.subtract(max, 1), { name = name, owners = owners })
|
||||
arena:teleport(minetest.get_player_by_name(owners[1]))
|
||||
if arena then
|
||||
return true, "Arena created"
|
||||
|
|
Loading…
Reference in New Issue