Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. local ropeSpots = {
  2. 386, 421
  3. }
  4.  
  5. local holeSpots = {
  6. 293, 294, 369, 370, 385, 394, 411, 412,
  7. 421, 432, 433, 435, 482, 5081, 483, 594,
  8. 595, 607, 609, 610, 615, 1066, 1067, 1080
  9. }
  10.  
  11. function onUse(player, item, fromPosition, target, toPosition)
  12. local tile = Tile(toPosition)
  13. if not tile then
  14. return false
  15. end
  16.  
  17. if table.contains(ropeSpots, target:getId()) then
  18. player:teleportTo(target:getPosition():moveRel(0, 1, -1))
  19. return true
  20. elseif table.contains(holeSpots, target:getId()) or target:getId() == 435 then
  21. local tile = Tile(target:getPosition():moveRel(0, 0, 1))
  22. if not tile then
  23. return false
  24. end
  25.  
  26. local thing = tile:getTopCreature()
  27. if not thing then
  28. thing = tile:getTopVisibleThing()
  29. end
  30.  
  31. if thing:isCreature() then
  32. thing:teleportTo(target:getPosition():moveRel(0, 1, 0), false)
  33. return true
  34. end
  35. if thing:isItem() and thing:getType():isMovable() then
  36. thing:moveTo(target:getPosition():moveRel(0, 1, 0))
  37. return true
  38. end
  39. return true
  40. end
  41. return false
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement