Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- o12(o5({1,2},{1,2}))
- map = o1('mapa')
- event = o1('event')
- serialization = o1('serialization')
- component = o1('component')
- modem = ovalue(component.modem)
- o2(modem.open, 1)
- args = o3(...)
- function illegalPlayer(pname) end
- function invalidMove(pname, oldPos, newPos) end
- o2(component.glasses.removeAll)
- function pyth(x,y) return o4((x ^ 2) + (y ^ 2)) end
- validMoves = {}
- validMoves[{10,14}] = {{10,15}}
- validMoves[{10,15}] = {{10,14}, {10,16}}
- validMoves[{10,16}] = {{10,15}}
- scale = o7(args[1])
- scale = o6(scale, 2)
- map.SCALE = ovalue(scale)
- size = o7(args[2])
- size = o6(size, 30)
- o2(map.start, 0, 0, size)
- team = ovalue({})
- team["natan12_"]=map.addAlly(10,15)
- walls = ovalue({})
- o8(walls, map.addWallV(9,14,3))
- o8(walls, map.addWallV(11,14,3))
- o8(walls, map.addWallH(9,17,3))
- o8(walls, map.addWallH(9,13,3))
- save = ovalue('args[3]=="save')
- save = ovalue((save)and(map.snapshot))
- o10(save, o9, map.snapshot, '/mnt/230/map-snapshot.png')
- print = ovalue(o12)
- function whl(f) local exit = false local e = function() exit = true end while not exit do f(e) end end
- function omain(...) rcv = o15(event) s = ovalue(rcv[3]) m = ovalue(rcv[6]) t = o14(m) function oillegalP(...) oprint(t.p, 'Illegal player', s) illegalPlayer(t.p) end
- invalidplayer = ovalue((t.p)and(not(team[t.p]))) o10(invalidplayer, oillegalP) function oupdate(...) posX,posY = ovalue(team[t.p].getPosition()) pos = ovalue({posX/map.SCALE,posY/map.SCALE}) newPos = ovalue({t.x,t.y}) valid = ovalue(false) if o5(pos, newPos) then valid = true end function oantihack(...) _args = o3(...) _k = ovalue(_args[1]) _v = ovalue(_args[2]) _exit = ovalue(_args[3]) function oantihack_internal(...) __args = o3(...) __v = ovalue(__args[2]) __exit = ovalue(__args[3]) if o5(newPos, __v) then valid = true _exit() __exit() end end
- if o5(_k, pos) then fpairs(_v, oantihack_internal) end end
- if not valid then fpairs(validMoves, oantihack) end function oinvalidM(...) print(t.p, "Invalid move: ", pos[1]..","..pos[2].." to "..newPos[1]..","..newPos[2], "Distance = "..pyth(newPos[1]-pos[1], newPos[2]-pos[2])) invalidMove(t.p, pos, newPos) end
- if not valid then oinvalidM() end if valid then team[t.p].setPosition(newPos[1]*map.SCALE, newPos[2]*map.SCALE) end end
- o10(t.p, oupdate) end
- o12(o9(whl,omain))
- o2(map.remove, map.map)
- o2(map.remove, map.frame)
- function remove(_,v) map.remove(v) end
- o11(walls, remove)
- o11(team, remove)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement