Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _G["mov"] = {}
- function mov.draw(image,x,y,mon1,mon2)
- local mon1 = tostring(mon1)
- local mon2 = tostring(mon2)
- if peripheral.isPresent(mon1) ~= true or peripheral.isPresent(mon2) ~= true then
- error("Peripheral is not on network")
- elseif peripheral.getType(mon1) ~= "monitor" or peripheral.getType(mon2) ~= "monitor" then
- error("Peripheral is not a monitor")
- end
- local x = math.floor(tonumber(x)) or 1
- local y = math.floor(tonumber(y)) or 1
- local image = tostring(image)
- local t1 = peripheral.wrap(mon1)
- local t2 = peripheral.wrap(mon2)
- local t1x, t1y = t1.getSize()
- local t2x, t2y = t2.getSize()
- local maX, maY = t1x + t2x, t1y + t2y
- local x2 = 1 - (t1x - x)
- if not t1.isColor() or not t2.isColor() then
- error("Monitor is not advanced")
- end
- if x > maX then
- error("x > max X")
- elseif y > maY then
- error("y > max Y")
- end
- if not term.restore then
- restore = term.current()
- end
- term.redirect(t1)
- paintutils.drawImage(paintutils.loadImage(image),x,y)
- term.redirect(restore)
- term.redirect(t2)
- paintutils.drawImage(paintutils.loadImage(image),x2,y)
- term.redirect(restore)
- end
Add Comment
Please, Sign In to add comment