function RoomPackager.RegionFromBasePlate(O,A)local V=O:TopCornersOfBasePlate(A)local p=V[1]local c=p.X local Q=p.Z local Z=p.X local x=p.Z for A,O in pairs(V)do c=math.min(c,O.X)Q=math.min(Q,O.Z)Z=math.max(Z,O.X)x=math.max(x,O.Z)end local M=V[1].Y local Y=Vector3.new(c,M,Q)local l=M+64 local C=Vector3.new(Z,l,x)local X=Region3.new(Y,C)return X end
--this returns a region3 that lines up on top of the baseplate to capture
--whatever room has been constructed on top of it, it is smart enough
--to capture a room that has been less-than-ideally set up
function RoomPackager:RegionFromBasePlate(basePlate)
	local topCorners = self:TopCornersOfBasePlate(basePlate)

	--we farm the min and max x's and z's from the top corners
	--to get x and z coordinates for the region3 that will contain the room
	--we choose an arbitrary corner so that the initial values are in the data set
	local arbitraryCorner = topCorners[1]
	local minX = arbitraryCorner.X
	local minZ = arbitraryCorner.Z
	local maxX = arbitraryCorner.X
	local maxZ = arbitraryCorner.Z
	for _, corner in pairs(topCorners) do
		minX = math.min(minX, corner.X)
		minZ = math.min(minZ, corner.Z)
		maxX = math.max(maxX, corner.X)
		maxZ = math.max(maxZ, corner.Z)
	end

	--construct the region using these new corners we have constructed
	--keeping in mind that all corners in topCorners *should* have the same y value
	local minY = topCorners[1].Y
	local lowerCorner = Vector3.new(minX, minY, minZ)
	local maxY = minY + 64
	local upperCorner = Vector3.new(maxX, maxY, maxZ)
	local region = Region3.new(lowerCorner, upperCorner)

	return region
end
