Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gml = require("gml")
- com = require("component")
- event = require("event")
- gpu = com.gpu
- internet = com.tunnel
- send = function(msg) status.text="_offline_" status:draw() internet.send(msg) end
- screen = {x=26,y=18}
- gui = gml.create(1,1,screen.x,screen.y)
- status = gui:addLabel(14,14,9,"_offline_")
- option = {random_speed=true,random_pos_radius=0,coord={"0.5","0.5","0.5"}}
- particle_N = 0
- sender = true
- particle_N_label=gui:addLabel(14,16,11,"0")
- gpu.setResolution(screen.x,screen.y)
- gui:addLabel(14,13,10,"сообщение:")
- function redraw_N()
- particle_N_label.text=tostring(particle_N)
- particle_N_label:draw()
- end
- redraw_N()
- function but_up()
- send("up()")
- end
- gui:addButton(2,1,3,1,"U",but_up)
- function but_go()
- send("go()")
- end
- gui:addButton(5,1,4,1," ▲",but_go)
- function but_down()
- send("down()")
- end
- gui:addButton(9,1,3,1,"D",but_down)
- function but_left()
- send("left()")
- end
- gui:addButton(2,2,3,1,"◄",but_left)
- function but_back()
- send("back()")
- end
- gui:addButton(5,2,4,1," ▼",but_back)
- function but_right()
- send("right()")
- end
- gui:addButton(9,2,3,1,"►",but_right)
- function create(...)
- if sender then
- particle_N=particle_N+1
- redraw_N()
- local arg={...}
- local block=arg[2]
- local x,y,z=block.posX,block.posY,block.posZ
- if tonumber(option.coord.x.text) then x=block.posX+tonumber(option.coord.x.text)-1 end
- if tonumber(option.coord.y.text) then y=block.posY+tonumber(option.coord.y.text) end
- if tonumber(option.coord.z.text) then z=block.posZ+tonumber(option.coord.z.text)-1 end
- send("add("..(x)..","..(y)..","..(z)..",'"..listbox:getSelected().."',"..tostring(option.random_speed)..","..(tonumber(option.random_pos_radius.text) or 0)..")")
- end
- end
- gui:addHandler("tablet_use",create)
- function del()
- send("del()")
- particle_N=math.max(particle_N-1,0)
- redraw_N()
- end
- stop_button=gui:addButton(1,6,12,1,"почистить",del)
- function modem_msg(_,_,_,_,_,msg)
- status.text=msg
- particle_N=tonumber(msg) or particle_N
- status:draw()
- end
- gui:addHandler("modem_message",modem_msg)
- list={"explode","largeexplode","hugeexplosion","fireworksSpark","splash","depthsuspend","crit","magicCrit","smoke","largesmoke","spell","instantSpell","mobSpell","witchMagic","dripWater","dripLava","angryVillager","happyVillager","note","portal","enchantmenttable","flame","lava","reddust","slime","heart","cloud","snowshovel","blockcrack_11"}
- listbox=gui:addListBox(1,8,12,9,list)
- function edit_coord()
- gpu.setBackground(0xFF0000) --костыль
- gpu.setForeground(0xFFFFFF)
- gpu.set(2,5,"[изм. коорд]")
- edit_cord_button:draw()
- sender=false
- local _,block=event.pull("tablet_use")
- send("editpos("..block.posX..","..block.posY..","..block.posZ..")")
- sender=true
- end
- edit_cord_button=gui:addButton(1,4,12,1,"изм. коорд.",edit_coord)
- function start_robot()
- com.modem.setStrength(16)
- com.modem.broadcast(1,"ROBOTSTART")
- end
- gui:addButton(1,5,12,1,"запустить",start_robot)
- gui:addLabel(14,8,7,"радиус:")
- option.random_pos_radius=gui:addTextField(15,9,11)
- random_speed_label=gui:addLabel(14,11,3,"СС:")
- function rand_switch(self)
- if option.random_speed then self.text="выкл" option.random_speed=false else random_speed.text="вкл" option.random_speed=true end
- self:draw()
- end
- random_speed=gui:addButton(18,11,6,1,"вкл",rand_switch)
- gui:addLabel(14,4,2,"X:")
- option.coord.x=gui:addTextField(16,4,9)
- option.coord.x.text="0.5"
- gui:addLabel(14,5,2,"Y:")
- option.coord.y=gui:addTextField(16,5,9)
- option.coord.y.text="0.5"
- gui:addLabel(14,6,2,"Z:")
- option.coord.z=gui:addTextField(16,6,9)
- option.coord.z.text="0.5"
- gui:addLabel(14,1,12,"динамические")
- gui:addLabel(14,2,12," координаты")
- gui:addLabel(14,15,11,"колво част:")
- gui:run()
Add Comment
Please, Sign In to add comment