Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ecolors = {}
- ecolors[elem.DEFAULT_PT_PSNS] = 0x40000
- ecolors[elem.DEFAULT_PT_DTEC] = 0x40200
- ecolors[elem.DEFAULT_PT_LDTC] = 0x00200
- ecolors[elem.DEFAULT_PT_INVS] = 0x00201
- ecolors[elem.DEFAULT_PT_LSNS] = 0x00001
- ecolors[elem.DEFAULT_PT_TSNS] = 0x40001
- -- empty space is black
- -- anything else is white
- -- Gather data
- local data, dp = {}, 1
- for i in sim.parts() do
- if tpt.get_property("type", i) == elem.DEFAULT_PT_FRME then
- local fx = tpt.get_property("x", i)
- local fy = tpt.get_property("y", i)
- local db = {}
- for py = 1, 7 do
- local value = 0x20000000
- for px = 1, 9 do
- local col = tpt.get_property("type", fx+px, fy+py)
- if col ~= 0 then
- if ecolors[col] then
- col = ecolors[col]
- else
- col = 0x40201
- end
- end
- value = bit.bor(value, bit.lshift(col, px - 1))
- end
- db[py] = value
- end
- local tmp = tpt.get_property("tmp", i)
- if tmp == 0 then tmp = 1 end
- for i = 1, tmp do
- data[dp] = db
- dp = dp + 1
- end
- end
- end
- -- Write data
- sim.clearSim()
- tpt.set_pause(1)
- dp = 0
- while data[dp+1] do
- dp = dp + 1
- end
- for i = dp, 1, -1 do
- for j = 7, 1, -1 do
- local id = tpt.create(200, 100, "PHOT")
- tpt.set_property("ctype", data[i][j], id)
- tpt.set_property("x", 100, id)
- end
- end
- tpt.set_property("x", 100)
- tpt.set_property("vx", 0)
- tpt.set_property("vy", 0)
- tpt.set_property("life", 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement