omr__

Music Box

May 19th, 2022 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.25 KB | None | 0 0
  1. local clock = os.clock
  2. function sleep(n)  -- seconds
  3.     os.queueEvent("randomEvent")
  4.     os.pullEvent()
  5.  
  6.   local t0 = clock()
  7.   while clock() - t0 <= n do end
  8. end
  9.  
  10. local speaker = peripheral.find("speaker")
  11.  
  12. function portal()
  13.     speaker.playSound("minecraft:block.portal.travel", 1)
  14.     sleep(7)
  15. end
  16.  
  17. function walk()
  18.     print('walk')
  19.     speaker.playSound("minecraft:block.gravel.step", 1)
  20.     sleep(0.3)
  21.     speaker.playSound("minecraft:block.gravel.step", 1)
  22.     sleep(0.1)
  23.     speaker.playSound("minecraft:block.gravel.step", 1)
  24.     sleep(0.5)
  25.     speaker.playSound("minecraft:block.gravel.step", 1)
  26. end
  27.  
  28. function openShelf()
  29.     print('openShelf')
  30.     speaker.playSound("minecraft:block.piston.contract", 1)
  31.     sleep(2)
  32. end
  33.  
  34. function closeShelf()
  35.     print('closeShelf')
  36.     speaker.playSound("minecraft:block.piston.extend", 1)
  37.     sleep(2)
  38. end
  39.  
  40. function read()
  41.     print('read')
  42.     speaker.playSound("patchouli:book_flip", 1)
  43.     sleep(0.2)
  44.     speaker.playSound("patchouli:book_flip", 1)
  45.     sleep(0.3)
  46.     speaker.playSound("patchouli:book_flip", 1)
  47.     sleep(1)
  48. end
  49.  
  50. function placeBlock()
  51.     print('placeBlock')
  52.     speaker.playSound("minecraft:block.wood.place", 1)
  53.     sleep(0.1)
  54.     speaker.playSound("minecraft:block.wood.place", 1)
  55.     sleep(0.1)
  56.     speaker.playSound("minecraft:block.wood.place", 1)
  57.     sleep(0.2)
  58.     speaker.playSound("minecraft:block.wood.place", 1)
  59.     sleep(1)
  60. end
  61.  
  62. function arrow()
  63.     print('arrow')
  64.     sleep(1)
  65.     speaker.playSound("minecraft:entity.arrow.hit", 1)
  66.     sleep(0.5)
  67.     speaker.playSound("minecraft:entity.generic.death", 1)
  68.  
  69. end
  70.  
  71. function sword()
  72.     print('sword')
  73.     sleep(0.5)
  74.     speaker.playSound("minecraft:entity.player.attack.sweep", 1)
  75. end
  76.  
  77. function death()
  78.     print('death')
  79.     sleep(1)
  80.     speaker.playSound("botania:gaia_death", 1)
  81.     sleep(1)
  82.     speaker.playSound("minecraft:item.totem.use", 1)
  83. end
  84.  
  85. function levelup()
  86.     print('levelup')
  87.     speaker.playSound("minecraft:entity.player.levelup", 1)
  88.     sleep(1)
  89.     speaker.playSound("minecraft:entity.firework_rocket.launch", 1)
  90.     sleep(1)
  91.     speaker.playSound("minecraft:entity.firework_rocket.launch", 1)
  92.     sleep(1)
  93. end
  94.  
  95. function fight()
  96.     print('fight')
  97.     arrow()
  98.     arrow()
  99.     sword()
  100.     sword()
  101.     death()
  102.     levelup()
  103. end
  104.  
  105. portal()
  106. walk()
  107. openShelf()
  108. read()
  109. closeShelf()
  110. walk()
  111. placeBlock()
  112. walk()
  113. fight()
  114. walk()
  115. portal()
Add Comment
Please, Sign In to add comment