Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Color table
- local ecolors = {}
- ecolors[elem.DEFAULT_PT_PSNS] = 0x200000 -- Red
- ecolors[elem.DEFAULT_PT_DTEC] = 0x201000 -- Yellow
- ecolors[elem.DEFAULT_PT_LDTC] = 0x001000 -- Green
- ecolors[elem.DEFAULT_PT_INVS] = 0x001001 -- Cyan
- ecolors[elem.DEFAULT_PT_LSNS] = 0x000001 -- Blue
- ecolors[elem.DEFAULT_PT_TSNS] = 0x200001 -- Magenta
- -- Anything not here is white
- -- Empty space is black
- -- Gather data
- local data, dp = {}, 1
- for i in sim.parts() do
- if tpt.get_property("type", i) == elem.DEFAULT_PT_FRME then
- local db, fx = {}, tpt.get_property("x", i)
- local fy = tpt.get_property("y", i)
- for px = 1, 8 do
- local value = 0x20000000
- for py = 1, 6 do
- local col = tpt.get_property("type", fx + px, fy + py)
- if col ~= 0 then
- if ecolors[col] then
- col = ecolors[col]
- else
- col = 0x201001
- end
- end
- value = bit.bor(value, bit.lshift(col, py - 1))
- end
- db[px] = 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 = dp - 1
- for i = dp, 1, -1 do
- for j = 8, 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("life", 0)
- tpt.set_property("vx", 0)
- tpt.set_property("vy", 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement