init
This commit is contained in:
commit
12ffbdc45d
76 changed files with 79368 additions and 0 deletions
53
computer/3/removeemptychunks.lua
Normal file
53
computer/3/removeemptychunks.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
|
||||
function stringtovec(str)
|
||||
parts = {}
|
||||
for part in string.gmatch(str,"([^,])") do
|
||||
table.insert(parts,part)
|
||||
end
|
||||
return vector.new(unpack(parts))
|
||||
end
|
||||
sf = require("structure")
|
||||
|
||||
function removechunks()
|
||||
file = fs.open("tobuild","r")
|
||||
lines = {}
|
||||
line = file.readLine()
|
||||
|
||||
while line do
|
||||
i = math.mod((i or 0)+1,100)
|
||||
if i == 0 then sleep(0.05) end
|
||||
xyz = stringtovec(line)
|
||||
if not chunkisempty(xyz) then
|
||||
table.insert(lines,line)
|
||||
print(line)
|
||||
end
|
||||
line = file.readLine()
|
||||
end
|
||||
file.close()
|
||||
fs.delete("tobuildcopy")
|
||||
file = fs.open("tobuildcopy","w")
|
||||
for i,line in ipairs(lines) do
|
||||
file.writeLine(line)
|
||||
print(line)
|
||||
if math.mod(i,100) == 0 then sleep(0.05) end
|
||||
end
|
||||
file.close()
|
||||
end
|
||||
function chunkisempty(vec)
|
||||
x,y,z = vec.x,vec.y,vec.z
|
||||
for w = 1,8 do
|
||||
for h = 1,8 do
|
||||
for d = 1,8 do
|
||||
bool,block = sf.blockat(x+w,z+d,y+h)
|
||||
if bool then
|
||||
print(block)
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--print(chunkisempty(vector.new(-150,0,0)))
|
||||
removechunks()
|
Loading…
Add table
Add a link
Reference in a new issue