Advertisement
JaMaNi133

canon payload

Feb 27th, 2024 (edited)
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.05 KB | None | 0 0
  1. bundleAlignX = 32
  2. bundleAlignZ = 16
  3. bundleDupe1 = 12
  4. bundleDupe8 = 8
  5. bundleAlignTrig = 64
  6. bundlePush = 1
  7. BundleSafety = 2
  8. bundleFire = 128
  9. BundleAccelReady = 256
  10. bundleAccelX = 512
  11. bundleAccelZ = 1024
  12. bundleSendOff = 2048
  13. local DCHook = require("DiscordHook")
  14. local connected, dc = DCHook.createWebhook("https://discord.com/api/webhooks/1212096041914994729/eIYujNw0wgywygp_EoQ8JB7SL5_bOWNxCKMoNoj_Ab39U-GYmJfSUE0r8efoWLiULo-e")
  15.  
  16. -- ye ye i know this is public but i don't care tbh
  17.  
  18. function duper(val)
  19.     redstone.setBundledOutput("back",val)
  20.     sleep(1/20)
  21.     redstone.setBundledOutput("back",0)
  22. end
  23.  
  24. function payload(amount,fuse,alignX,alignZ)
  25.     if fuse > 79 then
  26.         fuse = 79
  27.     end
  28.     --if fuse < 1 then
  29.     --    fuse = 1
  30.     --end
  31.     while amount > 0 do
  32.         print("duping")
  33.         if amount >= 8 then
  34.             duper(bundleDupe8)
  35.             amount = amount -8
  36.         else
  37.             duper(bundleDupe1)
  38.             amount = amount -1
  39.         end
  40.         sleep(0.5)
  41.     end
  42.     print("done duping")
  43.     sleep(1)
  44.     print("aligning")
  45.  
  46.  
  47.     duperCMD = bundleAlignTrig
  48.     if alignX then
  49.         duperCMD = duperCMD+bundleAlignX
  50.     end
  51.     if alignZ then
  52.         duperCMD = duperCMD+bundleAlignZ
  53.     end
  54.     duper(duperCMD)
  55.     print("done, now waiting for fuse")
  56.     sleep((98-fuse) * 0.05)
  57.     duper(bundlePush)
  58.     print("done")
  59.     sleep(3)
  60. end
  61.  
  62. function accelerate(accx,accz)
  63.     print("accelerating")
  64.     max = accx
  65.     if accz > accx then
  66.         max = accz
  67.     end
  68.     looped = 0
  69.     dc.send(string.format("accelerating with %d tnt",max))
  70.     while accx > 0 or accz > 0 do
  71.         looped = looped + 1
  72.         duperCMD = 0
  73.        
  74.         if math.floor((looped-1)/100) ~= math.floor((looped-2)/100) then
  75.             dc.send(string.format("%d/%d",looped-1,max))
  76.         end
  77.         if accx > 0 then
  78.             print("x")
  79.             duperCMD = duperCMD+bundleAccelX
  80.             accx = accx - 1
  81.         end
  82.         if accz > 0 then
  83.             print("z")
  84.             duperCMD = duperCMD+bundleAccelZ
  85.             accz = accz - 1
  86.         end
  87.         duper(duperCMD)
  88.         sleep(5 * 0.05)
  89.     end
  90.     sleep(6)
  91.     print("done")
  92. end
  93.  
  94.  
  95. dc.send("----------------------------------------\n\nfire sequence started ,waiting to be unloaded")
  96. while bit.band(redstone.getBundledInput("back"),BundleSafety) > 0 do
  97.     sleep(2)
  98.     print(".")
  99. end
  100. sleep(2)
  101.  
  102.  
  103.  
  104. --dc.send("creating payload 1")
  105. --payload(512,79,false,false)
  106. --dc.send("creating payload 2")
  107. --payload(8,1,true,true)
  108. --dc.send("done")
  109.  
  110. dc.send("creating payload")
  111. payload(8,0,true,true)
  112. payload(512,79,false,false)
  113. dc.send("done")
  114.  
  115. duper(bundleFire)
  116. while bit.band(redstone.getBundledInput("back"),BundleAccelReady) == 0 do
  117.     sleep(0.1)
  118. end
  119. dc.send("accelerating")
  120. accelerate(206,221)
  121. --accelerate(40,40)
  122. dc.send("done")
  123. sleep(5)
  124. duper(bundleSendOff)
  125. dc.send("sent off")
  126. sleep(45)
  127. dc.send("done, ready to fire now")
  128.  
  129.  
  130. --wait for send off
  131. while redstone.getInput("right") == false do
  132.     sleep(1)
  133. end
  134.  
  135.  
  136. redstone.setOutput("bottom",true)
  137. sleep(1/20)
  138. redstone.setOutput("bottom",false)
  139. dc.send("fired....\nor selfdestructed")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement