redscript-mc 1.2.26 → 1.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/README.md +67 -9
  2. package/README.zh.md +61 -4
  3. package/dist/__tests__/stdlib-advanced.test.js +114 -0
  4. package/dist/__tests__/stdlib-bigint.test.d.ts +7 -0
  5. package/dist/__tests__/stdlib-bigint.test.js +428 -0
  6. package/dist/data/arena/function/__load.mcfunction +6 -0
  7. package/dist/data/arena/function/__tick.mcfunction +2 -0
  8. package/dist/data/arena/function/announce_leaders/else_1.mcfunction +3 -0
  9. package/dist/data/arena/function/announce_leaders/foreach_0/merge_2.mcfunction +1 -0
  10. package/dist/data/arena/function/announce_leaders/foreach_0/then_0.mcfunction +3 -0
  11. package/dist/data/arena/function/announce_leaders/foreach_0.mcfunction +7 -0
  12. package/dist/data/arena/function/announce_leaders/foreach_1/merge_2.mcfunction +1 -0
  13. package/dist/data/arena/function/announce_leaders/foreach_1/then_0.mcfunction +4 -0
  14. package/dist/data/arena/function/announce_leaders/foreach_1.mcfunction +6 -0
  15. package/dist/data/arena/function/announce_leaders/merge_2.mcfunction +1 -0
  16. package/dist/data/arena/function/announce_leaders/then_0.mcfunction +4 -0
  17. package/dist/data/arena/function/announce_leaders.mcfunction +6 -0
  18. package/dist/data/arena/function/arena_tick/merge_2.mcfunction +1 -0
  19. package/dist/data/arena/function/arena_tick/then_0.mcfunction +4 -0
  20. package/dist/data/arena/function/arena_tick.mcfunction +11 -0
  21. package/dist/data/counter/function/__load.mcfunction +5 -0
  22. package/dist/data/counter/function/__tick.mcfunction +2 -0
  23. package/dist/data/counter/function/counter_tick/merge_2.mcfunction +1 -0
  24. package/dist/data/counter/function/counter_tick/then_0.mcfunction +3 -0
  25. package/dist/data/counter/function/counter_tick.mcfunction +11 -0
  26. package/dist/data/gcd2/function/__load.mcfunction +3 -0
  27. package/dist/data/gcd2/function/abs/merge_2.mcfunction +3 -0
  28. package/dist/data/gcd2/function/abs/then_0.mcfunction +5 -0
  29. package/dist/data/gcd2/function/abs.mcfunction +7 -0
  30. package/dist/data/gcd2/function/gcd/loop_body_1.mcfunction +7 -0
  31. package/dist/data/gcd2/function/gcd/loop_check_0.mcfunction +5 -0
  32. package/dist/data/gcd2/function/gcd/loop_exit_2.mcfunction +3 -0
  33. package/dist/data/gcd2/function/gcd.mcfunction +14 -0
  34. package/dist/data/gcd3/function/__load.mcfunction +3 -0
  35. package/dist/data/gcd3/function/abs/merge_2.mcfunction +3 -0
  36. package/dist/data/gcd3/function/abs/then_0.mcfunction +5 -0
  37. package/dist/data/gcd3/function/abs.mcfunction +7 -0
  38. package/dist/data/gcd3/function/gcd/loop_body_1.mcfunction +7 -0
  39. package/dist/data/gcd3/function/gcd/loop_check_0.mcfunction +5 -0
  40. package/dist/data/gcd3/function/gcd/loop_exit_2.mcfunction +3 -0
  41. package/dist/data/gcd3/function/gcd.mcfunction +14 -0
  42. package/dist/data/gcd3/function/test.mcfunction +7 -0
  43. package/dist/data/gcd3nm/function/__load.mcfunction +3 -0
  44. package/dist/data/gcd3nm/function/abs/merge_2.mcfunction +3 -0
  45. package/dist/data/gcd3nm/function/abs/then_0.mcfunction +5 -0
  46. package/dist/data/gcd3nm/function/abs.mcfunction +7 -0
  47. package/dist/data/gcd3nm/function/gcd/loop_body_1.mcfunction +7 -0
  48. package/dist/data/gcd3nm/function/gcd/loop_check_0.mcfunction +5 -0
  49. package/dist/data/gcd3nm/function/gcd/loop_exit_2.mcfunction +3 -0
  50. package/dist/data/gcd3nm/function/gcd.mcfunction +14 -0
  51. package/dist/data/gcd3nm/function/test.mcfunction +7 -0
  52. package/dist/data/gcd_test/function/__load.mcfunction +3 -0
  53. package/dist/data/gcd_test/function/abs/merge_2.mcfunction +3 -0
  54. package/dist/data/gcd_test/function/abs/then_0.mcfunction +5 -0
  55. package/dist/data/gcd_test/function/abs.mcfunction +7 -0
  56. package/dist/data/gcd_test/function/gcd/loop_body_1.mcfunction +7 -0
  57. package/dist/data/gcd_test/function/gcd/loop_check_0.mcfunction +5 -0
  58. package/dist/data/gcd_test/function/gcd/loop_exit_2.mcfunction +3 -0
  59. package/dist/data/gcd_test/function/gcd.mcfunction +14 -0
  60. package/dist/data/isqrttest/function/__load.mcfunction +6 -0
  61. package/dist/data/isqrttest/function/isqrt/loop_body_4.mcfunction +12 -0
  62. package/dist/data/isqrttest/function/isqrt/loop_check_3.mcfunction +5 -0
  63. package/dist/data/isqrttest/function/isqrt/loop_exit_5.mcfunction +3 -0
  64. package/dist/data/isqrttest/function/isqrt/merge_2.mcfunction +4 -0
  65. package/dist/data/isqrttest/function/isqrt/merge_8.mcfunction +6 -0
  66. package/dist/data/isqrttest/function/isqrt/then_0.mcfunction +3 -0
  67. package/dist/data/isqrttest/function/isqrt/then_6.mcfunction +3 -0
  68. package/dist/data/isqrttest/function/isqrt.mcfunction +7 -0
  69. package/dist/data/isqrttest/function/test.mcfunction +6 -0
  70. package/dist/data/mathtest/function/__load.mcfunction +3 -0
  71. package/dist/data/mathtest/function/abs/merge_2.mcfunction +3 -0
  72. package/dist/data/mathtest/function/abs/then_0.mcfunction +5 -0
  73. package/dist/data/mathtest/function/abs.mcfunction +6 -0
  74. package/dist/data/mathtest/function/test.mcfunction +5 -0
  75. package/dist/data/minecraft/tags/function/load.json +5 -0
  76. package/dist/data/minecraft/tags/function/tick.json +5 -0
  77. package/dist/data/mypack/function/__load.mcfunction +13 -0
  78. package/dist/data/mypack/function/_atan_init.mcfunction +2 -0
  79. package/dist/data/mypack/function/abs/merge_2.mcfunction +3 -0
  80. package/dist/data/mypack/function/abs/then_0.mcfunction +5 -0
  81. package/dist/data/mypack/function/abs.mcfunction +6 -0
  82. package/dist/data/mypack/function/atan2_fixed/__sgi_1.mcfunction +2 -0
  83. package/dist/data/mypack/function/atan2_fixed/else_34.mcfunction +3 -0
  84. package/dist/data/mypack/function/atan2_fixed/loop_body_31.mcfunction +19 -0
  85. package/dist/data/mypack/function/atan2_fixed/loop_check_30.mcfunction +5 -0
  86. package/dist/data/mypack/function/atan2_fixed/loop_exit_32.mcfunction +6 -0
  87. package/dist/data/mypack/function/atan2_fixed/merge_11.mcfunction +6 -0
  88. package/dist/data/mypack/function/atan2_fixed/merge_14.mcfunction +3 -0
  89. package/dist/data/mypack/function/atan2_fixed/merge_17.mcfunction +6 -0
  90. package/dist/data/mypack/function/atan2_fixed/merge_2.mcfunction +5 -0
  91. package/dist/data/mypack/function/atan2_fixed/merge_20.mcfunction +5 -0
  92. package/dist/data/mypack/function/atan2_fixed/merge_23.mcfunction +5 -0
  93. package/dist/data/mypack/function/atan2_fixed/merge_26.mcfunction +6 -0
  94. package/dist/data/mypack/function/atan2_fixed/merge_29.mcfunction +4 -0
  95. package/dist/data/mypack/function/atan2_fixed/merge_38.mcfunction +5 -0
  96. package/dist/data/mypack/function/atan2_fixed/merge_41.mcfunction +5 -0
  97. package/dist/data/mypack/function/atan2_fixed/merge_44.mcfunction +5 -0
  98. package/dist/data/mypack/function/atan2_fixed/merge_47.mcfunction +5 -0
  99. package/dist/data/mypack/function/atan2_fixed/merge_5.mcfunction +5 -0
  100. package/dist/data/mypack/function/atan2_fixed/merge_8.mcfunction +3 -0
  101. package/dist/data/mypack/function/atan2_fixed/then_0.mcfunction +5 -0
  102. package/dist/data/mypack/function/atan2_fixed/then_12.mcfunction +3 -0
  103. package/dist/data/mypack/function/atan2_fixed/then_15.mcfunction +5 -0
  104. package/dist/data/mypack/function/atan2_fixed/then_18.mcfunction +5 -0
  105. package/dist/data/mypack/function/atan2_fixed/then_21.mcfunction +3 -0
  106. package/dist/data/mypack/function/atan2_fixed/then_24.mcfunction +3 -0
  107. package/dist/data/mypack/function/atan2_fixed/then_27.mcfunction +6 -0
  108. package/dist/data/mypack/function/atan2_fixed/then_3.mcfunction +3 -0
  109. package/dist/data/mypack/function/atan2_fixed/then_33.mcfunction +5 -0
  110. package/dist/data/mypack/function/atan2_fixed/then_36.mcfunction +5 -0
  111. package/dist/data/mypack/function/atan2_fixed/then_39.mcfunction +5 -0
  112. package/dist/data/mypack/function/atan2_fixed/then_42.mcfunction +3 -0
  113. package/dist/data/mypack/function/atan2_fixed/then_45.mcfunction +5 -0
  114. package/dist/data/mypack/function/atan2_fixed/then_6.mcfunction +3 -0
  115. package/dist/data/mypack/function/atan2_fixed/then_9.mcfunction +5 -0
  116. package/dist/data/mypack/function/atan2_fixed.mcfunction +7 -0
  117. package/dist/data/mypack/function/my_game.mcfunction +10 -0
  118. package/dist/data/quiz/function/__load.mcfunction +16 -0
  119. package/dist/data/quiz/function/__tick.mcfunction +6 -0
  120. package/dist/data/quiz/function/__trigger_quiz_a_dispatch.mcfunction +4 -0
  121. package/dist/data/quiz/function/__trigger_quiz_b_dispatch.mcfunction +4 -0
  122. package/dist/data/quiz/function/__trigger_quiz_c_dispatch.mcfunction +4 -0
  123. package/dist/data/quiz/function/__trigger_quiz_start_dispatch.mcfunction +4 -0
  124. package/dist/data/quiz/function/answer_a.mcfunction +4 -0
  125. package/dist/data/quiz/function/answer_b.mcfunction +4 -0
  126. package/dist/data/quiz/function/answer_c.mcfunction +4 -0
  127. package/dist/data/quiz/function/ask_question/else_1.mcfunction +5 -0
  128. package/dist/data/quiz/function/ask_question/else_4.mcfunction +5 -0
  129. package/dist/data/quiz/function/ask_question/else_7.mcfunction +4 -0
  130. package/dist/data/quiz/function/ask_question/merge_2.mcfunction +1 -0
  131. package/dist/data/quiz/function/ask_question/merge_5.mcfunction +2 -0
  132. package/dist/data/quiz/function/ask_question/merge_8.mcfunction +2 -0
  133. package/dist/data/quiz/function/ask_question/then_0.mcfunction +4 -0
  134. package/dist/data/quiz/function/ask_question/then_3.mcfunction +4 -0
  135. package/dist/data/quiz/function/ask_question/then_6.mcfunction +4 -0
  136. package/dist/data/quiz/function/ask_question.mcfunction +7 -0
  137. package/dist/data/quiz/function/finish_quiz.mcfunction +6 -0
  138. package/dist/data/quiz/function/handle_answer/else_1.mcfunction +5 -0
  139. package/dist/data/quiz/function/handle_answer/else_10.mcfunction +3 -0
  140. package/dist/data/quiz/function/handle_answer/else_16.mcfunction +3 -0
  141. package/dist/data/quiz/function/handle_answer/else_4.mcfunction +3 -0
  142. package/dist/data/quiz/function/handle_answer/else_7.mcfunction +5 -0
  143. package/dist/data/quiz/function/handle_answer/merge_11.mcfunction +2 -0
  144. package/dist/data/quiz/function/handle_answer/merge_14.mcfunction +2 -0
  145. package/dist/data/quiz/function/handle_answer/merge_17.mcfunction +2 -0
  146. package/dist/data/quiz/function/handle_answer/merge_2.mcfunction +8 -0
  147. package/dist/data/quiz/function/handle_answer/merge_5.mcfunction +2 -0
  148. package/dist/data/quiz/function/handle_answer/merge_8.mcfunction +2 -0
  149. package/dist/data/quiz/function/handle_answer/then_0.mcfunction +5 -0
  150. package/dist/data/quiz/function/handle_answer/then_12.mcfunction +5 -0
  151. package/dist/data/quiz/function/handle_answer/then_15.mcfunction +6 -0
  152. package/dist/data/quiz/function/handle_answer/then_3.mcfunction +6 -0
  153. package/dist/data/quiz/function/handle_answer/then_6.mcfunction +5 -0
  154. package/dist/data/quiz/function/handle_answer/then_9.mcfunction +6 -0
  155. package/dist/data/quiz/function/handle_answer.mcfunction +11 -0
  156. package/dist/data/quiz/function/start_quiz.mcfunction +5 -0
  157. package/dist/data/reqtest/function/__load.mcfunction +4 -0
  158. package/dist/data/reqtest/function/_table_init.mcfunction +2 -0
  159. package/dist/data/reqtest/function/no_trig.mcfunction +3 -0
  160. package/dist/data/reqtest/function/use_table.mcfunction +4 -0
  161. package/dist/data/reqtest2/function/__load.mcfunction +3 -0
  162. package/dist/data/reqtest2/function/no_trig.mcfunction +3 -0
  163. package/dist/data/runtime/function/__load.mcfunction +5 -0
  164. package/dist/data/runtime/function/__tick.mcfunction +2 -0
  165. package/dist/data/runtime/function/counter_tick/then_0.mcfunction +3 -0
  166. package/dist/data/runtime/function/counter_tick.mcfunction +13 -0
  167. package/dist/data/shop/function/__load.mcfunction +7 -0
  168. package/dist/data/shop/function/__tick.mcfunction +3 -0
  169. package/dist/data/shop/function/__trigger_shop_buy_dispatch.mcfunction +4 -0
  170. package/dist/data/shop/function/complete_purchase/else_1.mcfunction +5 -0
  171. package/dist/data/shop/function/complete_purchase/else_4.mcfunction +5 -0
  172. package/dist/data/shop/function/complete_purchase/else_7.mcfunction +3 -0
  173. package/dist/data/shop/function/complete_purchase/merge_2.mcfunction +2 -0
  174. package/dist/data/shop/function/complete_purchase/merge_5.mcfunction +2 -0
  175. package/dist/data/shop/function/complete_purchase/merge_8.mcfunction +2 -0
  176. package/dist/data/shop/function/complete_purchase/then_0.mcfunction +4 -0
  177. package/dist/data/shop/function/complete_purchase/then_3.mcfunction +4 -0
  178. package/dist/data/shop/function/complete_purchase/then_6.mcfunction +4 -0
  179. package/dist/data/shop/function/complete_purchase.mcfunction +7 -0
  180. package/dist/data/shop/function/handle_shop_trigger.mcfunction +3 -0
  181. package/dist/data/swap_test/function/__load.mcfunction +3 -0
  182. package/dist/data/swap_test/function/gcd_old/loop_body_1.mcfunction +7 -0
  183. package/dist/data/swap_test/function/gcd_old/loop_check_0.mcfunction +5 -0
  184. package/dist/data/swap_test/function/gcd_old/loop_exit_2.mcfunction +3 -0
  185. package/dist/data/swap_test/function/gcd_old.mcfunction +8 -0
  186. package/dist/data/turret/function/__load.mcfunction +5 -0
  187. package/dist/data/turret/function/__tick.mcfunction +4 -0
  188. package/dist/data/turret/function/__trigger_deploy_turret_dispatch.mcfunction +4 -0
  189. package/dist/data/turret/function/deploy_turret.mcfunction +8 -0
  190. package/dist/data/turret/function/turret_tick/at_1.mcfunction +2 -0
  191. package/dist/data/turret/function/turret_tick/foreach_0.mcfunction +2 -0
  192. package/dist/data/turret/function/turret_tick/foreach_2.mcfunction +2 -0
  193. package/dist/data/turret/function/turret_tick/tick_body.mcfunction +3 -0
  194. package/dist/data/turret/function/turret_tick/tick_skip.mcfunction +1 -0
  195. package/dist/data/turret/function/turret_tick.mcfunction +5 -0
  196. package/dist/gcd2.map.json +15 -0
  197. package/dist/gcd3.map.json +17 -0
  198. package/dist/gcd_test.map.json +15 -0
  199. package/dist/isqrttest.map.json +15 -0
  200. package/dist/lowering/index.js +71 -4
  201. package/dist/mathtest.map.json +6 -0
  202. package/dist/mypack.map.json +27 -0
  203. package/dist/pack.mcmeta +6 -0
  204. package/dist/reqtest.map.json +4 -0
  205. package/dist/reqtest2.map.json +4 -0
  206. package/dist/runtime/index.js +26 -5
  207. package/dist/runtime.map.json +7 -0
  208. package/dist/swap_test.map.json +14 -0
  209. package/editors/vscode/package-lock.json +2 -2
  210. package/editors/vscode/package.json +1 -1
  211. package/examples/showcase.mcrs +505 -0
  212. package/package.json +1 -1
  213. package/src/__tests__/stdlib-advanced.test.ts +120 -0
  214. package/src/__tests__/stdlib-bigint.test.ts +427 -0
  215. package/src/lowering/index.ts +75 -4
  216. package/src/runtime/index.ts +27 -5
  217. package/src/stdlib/advanced.mcrs +81 -0
  218. package/src/stdlib/bigint.mcrs +205 -0
  219. package/src/stdlib/math.mcrs +19 -6
@@ -0,0 +1,3 @@
1
+ # block: loop_exit_2
2
+ scoreboard players operation $h rs = $b rs
3
+ return run scoreboard players get $b rs
@@ -0,0 +1,14 @@
1
+ # block: entry
2
+ scoreboard players operation $i rs = $c rs
3
+ scoreboard players operation $j rs = $k rs
4
+ scoreboard players operation $i rs = $d rs
5
+ scoreboard players operation $j rs = $l rs
6
+ scoreboard players operation $m rs = $d rs
7
+ function gcd3:abs
8
+ scoreboard players operation $n rs = $g rs
9
+ scoreboard players operation $b rs = $n rs
10
+ scoreboard players operation $m rs = $l rs
11
+ function gcd3:abs
12
+ scoreboard players operation $o rs = $g rs
13
+ scoreboard players operation $p rs = $o rs
14
+ function gcd3:gcd/loop_check_0
@@ -0,0 +1,7 @@
1
+ # block: entry
2
+ scoreboard players set $m rs 12
3
+ scoreboard players set $t rs 8
4
+ function gcd3:gcd
5
+ scoreboard players operation $u rs = $g rs
6
+ scoreboard players operation $v rs = $u rs
7
+ execute store result score out gcd3.r run scoreboard players get $result rs
@@ -0,0 +1,3 @@
1
+ # RedScript runtime init
2
+ scoreboard objectives add rs dummy
3
+ scoreboard players set $const_0 rs 0
@@ -0,0 +1,3 @@
1
+ # block: merge_2
2
+ scoreboard players operation $ret rs = $x rs
3
+ return run scoreboard players get $x rs
@@ -0,0 +1,5 @@
1
+ # block: then_0
2
+ scoreboard players set $_1 rs 0
3
+ scoreboard players operation $_1 rs -= $x rs
4
+ scoreboard players operation $ret rs = $_1 rs
5
+ return run scoreboard players get $_1 rs
@@ -0,0 +1,7 @@
1
+ # block: entry
2
+ scoreboard players operation $x rs = $p0 rs
3
+ scoreboard players operation $x rs = $p0 rs
4
+ scoreboard players set $_0 rs 0
5
+ execute if score $p0 rs < $const_0 rs run scoreboard players set $_0 rs 1
6
+ execute if score $_0 rs matches 1.. run function gcd3nm:abs/then_0
7
+ execute if score $_0 rs matches ..0 run function gcd3nm:abs/merge_2
@@ -0,0 +1,7 @@
1
+ # block: loop_body_1
2
+ scoreboard players operation $_5 rs = $x rs
3
+ scoreboard players operation $_5 rs %= $y rs
4
+ scoreboard players operation $r rs = $_5 rs
5
+ scoreboard players operation $x rs = $y rs
6
+ scoreboard players operation $y rs = $_5 rs
7
+ function gcd3nm:gcd/loop_check_0
@@ -0,0 +1,5 @@
1
+ # block: loop_check_0
2
+ scoreboard players set $_4 rs 0
3
+ execute if score $y rs > $const_0 rs run scoreboard players set $_4 rs 1
4
+ execute if score $_4 rs matches 1.. run function gcd3nm:gcd/loop_body_1
5
+ execute if score $_4 rs matches ..0 run function gcd3nm:gcd/loop_exit_2
@@ -0,0 +1,3 @@
1
+ # block: loop_exit_2
2
+ scoreboard players operation $ret rs = $x rs
3
+ return run scoreboard players get $x rs
@@ -0,0 +1,14 @@
1
+ # block: entry
2
+ scoreboard players operation $a rs = $p0 rs
3
+ scoreboard players operation $b rs = $p1 rs
4
+ scoreboard players operation $a rs = $p0 rs
5
+ scoreboard players operation $b rs = $p1 rs
6
+ scoreboard players operation $p0 rs = $p0 rs
7
+ function gcd3nm:abs
8
+ scoreboard players operation $_2 rs = $ret rs
9
+ scoreboard players operation $x rs = $_2 rs
10
+ scoreboard players operation $p0 rs = $p1 rs
11
+ function gcd3nm:abs
12
+ scoreboard players operation $_3 rs = $ret rs
13
+ scoreboard players operation $y rs = $_3 rs
14
+ function gcd3nm:gcd/loop_check_0
@@ -0,0 +1,7 @@
1
+ # block: entry
2
+ scoreboard players set $p0 rs 12
3
+ scoreboard players set $p1 rs 8
4
+ function gcd3nm:gcd
5
+ scoreboard players operation $_6 rs = $ret rs
6
+ scoreboard players operation $result rs = $_6 rs
7
+ execute store result score out gcd3nm.r run scoreboard players get $result rs
@@ -0,0 +1,3 @@
1
+ # RedScript runtime init
2
+ scoreboard objectives add rs dummy
3
+ scoreboard players set $a rs 0
@@ -0,0 +1,3 @@
1
+ # block: merge_2
2
+ scoreboard players operation $q rs = $k rs
3
+ return run scoreboard players get $k rs
@@ -0,0 +1,5 @@
1
+ # block: then_0
2
+ scoreboard players set $s rs 0
3
+ scoreboard players operation $s rs -= $k rs
4
+ scoreboard players operation $q rs = $s rs
5
+ return run scoreboard players get $s rs
@@ -0,0 +1,7 @@
1
+ # block: entry
2
+ scoreboard players operation $k rs = $c rs
3
+ scoreboard players operation $k rs = $f rs
4
+ scoreboard players set $r rs 0
5
+ execute if score $f rs < $a rs run scoreboard players set $r rs 1
6
+ execute if score $r rs matches 1.. run function gcd_test:abs/then_0
7
+ execute if score $r rs matches ..0 run function gcd_test:abs/merge_2
@@ -0,0 +1,7 @@
1
+ # block: loop_body_1
2
+ scoreboard players operation $o rs = $m rs
3
+ scoreboard players operation $p rs = $k rs
4
+ scoreboard players operation $p rs %= $m rs
5
+ scoreboard players operation $m rs = $p rs
6
+ scoreboard players operation $k rs = $m rs
7
+ function gcd_test:gcd/loop_check_0
@@ -0,0 +1,5 @@
1
+ # block: loop_check_0
2
+ scoreboard players set $n rs 0
3
+ execute if score $m rs > $a rs run scoreboard players set $n rs 1
4
+ execute if score $n rs matches 1.. run function gcd_test:gcd/loop_body_1
5
+ execute if score $n rs matches ..0 run function gcd_test:gcd/loop_exit_2
@@ -0,0 +1,3 @@
1
+ # block: loop_exit_2
2
+ scoreboard players operation $q rs = $k rs
3
+ return run scoreboard players get $k rs
@@ -0,0 +1,14 @@
1
+ # block: entry
2
+ scoreboard players operation $b rs = $c rs
3
+ scoreboard players operation $d rs = $e rs
4
+ scoreboard players operation $b rs = $f rs
5
+ scoreboard players operation $d rs = $g rs
6
+ scoreboard players operation $h rs = $f rs
7
+ function gcd_test:abs
8
+ scoreboard players operation $j rs = $i rs
9
+ scoreboard players operation $k rs = $j rs
10
+ scoreboard players operation $h rs = $g rs
11
+ function gcd_test:abs
12
+ scoreboard players operation $l rs = $i rs
13
+ scoreboard players operation $m rs = $l rs
14
+ function gcd_test:gcd/loop_check_0
@@ -0,0 +1,6 @@
1
+ # RedScript runtime init
2
+ scoreboard objectives add rs dummy
3
+ scoreboard players set $a rs 0
4
+ scoreboard players set $b rs 1
5
+ scoreboard players set $c rs 2
6
+ scoreboard players set $d rs 16
@@ -0,0 +1,12 @@
1
+ # block: loop_body_4
2
+ scoreboard players operation $m rs = $e rs
3
+ scoreboard players operation $m rs /= $k rs
4
+ scoreboard players operation $n rs = $k rs
5
+ scoreboard players operation $n rs += $m rs
6
+ scoreboard players operation $o rs = $n rs
7
+ scoreboard players operation $o rs /= $c rs
8
+ scoreboard players operation $p rs = $o rs
9
+ scoreboard players set $q rs 0
10
+ execute if score $o rs >= $k rs run scoreboard players set $q rs 1
11
+ execute if score $q rs matches 1.. run function isqrttest:isqrt/then_6
12
+ execute if score $q rs matches ..0 run function isqrttest:isqrt/merge_8
@@ -0,0 +1,5 @@
1
+ # block: loop_check_3
2
+ scoreboard players set $l rs 0
3
+ execute if score $j rs < $d rs run scoreboard players set $l rs 1
4
+ execute if score $l rs matches 1.. run function isqrttest:isqrt/loop_body_4
5
+ execute if score $l rs matches ..0 run function isqrttest:isqrt/loop_exit_5
@@ -0,0 +1,3 @@
1
+ # block: loop_exit_5
2
+ scoreboard players operation $j rs = $k rs
3
+ return run scoreboard players get $k rs
@@ -0,0 +1,4 @@
1
+ # block: merge_2
2
+ scoreboard players operation $k rs = $e rs
3
+ scoreboard players set $j rs 0
4
+ function isqrttest:isqrt/loop_check_3
@@ -0,0 +1,6 @@
1
+ # block: merge_8
2
+ scoreboard players operation $k rs = $p rs
3
+ scoreboard players operation $r rs = $j rs
4
+ scoreboard players operation $r rs += $b rs
5
+ scoreboard players operation $j rs = $r rs
6
+ function isqrttest:isqrt/loop_check_3
@@ -0,0 +1,3 @@
1
+ # block: then_0
2
+ scoreboard players set $j rs 0
3
+ return 0
@@ -0,0 +1,3 @@
1
+ # block: then_6
2
+ scoreboard players operation $j rs = $k rs
3
+ return run scoreboard players get $k rs
@@ -0,0 +1,7 @@
1
+ # block: entry
2
+ scoreboard players operation $e rs = $f rs
3
+ scoreboard players operation $e rs = $g rs
4
+ scoreboard players set $h rs 0
5
+ execute if score $g rs <= $a rs run scoreboard players set $h rs 1
6
+ execute if score $h rs matches 1.. run function isqrttest:isqrt/then_0
7
+ execute if score $h rs matches ..0 run function isqrttest:isqrt/merge_2
@@ -0,0 +1,6 @@
1
+ # block: entry
2
+ scoreboard players set $s rs 9
3
+ function isqrttest:isqrt
4
+ scoreboard players operation $t rs = $i rs
5
+ scoreboard players operation $u rs = $t rs
6
+ execute store result score out isqrttest.r run scoreboard players get $result rs
@@ -0,0 +1,3 @@
1
+ # RedScript runtime init
2
+ scoreboard objectives add rs dummy
3
+ scoreboard players set $a rs 0
@@ -0,0 +1,3 @@
1
+ # block: merge_2
2
+ scoreboard players operation $f rs = $b rs
3
+ return run scoreboard players get $b rs
@@ -0,0 +1,5 @@
1
+ # block: then_0
2
+ scoreboard players set $e rs 0
3
+ scoreboard players operation $e rs -= $b rs
4
+ scoreboard players operation $f rs = $e rs
5
+ return run scoreboard players get $e rs
@@ -0,0 +1,6 @@
1
+ # block: entry
2
+ scoreboard players operation $b rs = $c rs
3
+ scoreboard players set $d rs 0
4
+ execute if score $b rs < $a rs run scoreboard players set $d rs 1
5
+ execute if score $d rs matches 1.. run function mathtest:abs/then_0
6
+ execute if score $d rs matches ..0 run function mathtest:abs/merge_2
@@ -0,0 +1,5 @@
1
+ # block: entry
2
+ scoreboard players set $c rs 42
3
+ function mathtest:abs
4
+ scoreboard players operation $g rs = $f rs
5
+ execute store result score out mathtest.r run scoreboard players get $g rs
@@ -0,0 +1,5 @@
1
+ {
2
+ "values": [
3
+ "mypack:__load"
4
+ ]
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "values": [
3
+ "runtime:__tick"
4
+ ]
5
+ }
@@ -0,0 +1,13 @@
1
+ # RedScript runtime init
2
+ scoreboard objectives add rs dummy
3
+ scoreboard players set $a rs 0
4
+ scoreboard players set $b rs 1
5
+ scoreboard players set $c rs 2
6
+ scoreboard players set $d rs 45
7
+ scoreboard players set $e rs 90
8
+ scoreboard players set $f rs 180
9
+ scoreboard players set $g rs 270
10
+ scoreboard players set $h rs 360
11
+ scoreboard players set $i rs 1000
12
+ scoreboard players set $j rs 46340
13
+ function mypack:_atan_init
@@ -0,0 +1,2 @@
1
+ # block: entry
2
+ data modify storage math:tables tan set value [0, 17, 35, 52, 70, 87, 105, 123, 141, 158, 176, 194, 213, 231, 249, 268, 287, 306, 325, 344, 364, 384, 404, 424, 445, 466, 488, 510, 532, 554, 577, 601, 625, 649, 675, 700, 727, 754, 781, 810, 839, 869, 900, 933, 966, 1000]
@@ -0,0 +1,3 @@
1
+ # block: merge_2
2
+ scoreboard players operation $k rs = $o rs
3
+ return run scoreboard players get $o rs
@@ -0,0 +1,5 @@
1
+ # block: then_0
2
+ scoreboard players set $q rs 0
3
+ scoreboard players operation $q rs -= $o rs
4
+ scoreboard players operation $k rs = $q rs
5
+ return run scoreboard players get $q rs
@@ -0,0 +1,6 @@
1
+ # block: entry
2
+ scoreboard players operation $o rs = $n rs
3
+ scoreboard players set $p rs 0
4
+ execute if score $o rs < $a rs run scoreboard players set $p rs 1
5
+ execute if score $p rs matches 1.. run function mypack:abs/then_0
6
+ execute if score $p rs matches ..0 run function mypack:abs/merge_2
@@ -0,0 +1,2 @@
1
+ # block: entry
2
+ $r store result score $s rs run data get storage math:tables tan[$(__sgi_0)] 1
@@ -0,0 +1,3 @@
1
+ # block: else_34
2
+ scoreboard players operation $al rs = $ar rs
3
+ function mypack:atan2_fixed/loop_check_30
@@ -0,0 +1,19 @@
1
+ # block: loop_body_31
2
+ scoreboard players operation $ao rs = $al rs
3
+ scoreboard players operation $ao rs += $am rs
4
+ scoreboard players operation $ap rs = $ao rs
5
+ scoreboard players operation $ap rs += $b rs
6
+ scoreboard players operation $aq rs = $ap rs
7
+ scoreboard players operation $aq rs /= $c rs
8
+ scoreboard players operation $ar rs = $aq rs
9
+ execute store result storage rs:heap __sgi_0 int 1 run scoreboard players get $ar rs
10
+ function mypack:atan2_fixed/__sgi_1 with storage rs:heap
11
+ scoreboard players operation $as rs = $s rs
12
+ scoreboard players operation $at rs = $s rs
13
+ scoreboard players operation $at rs *= $aa rs
14
+ scoreboard players operation $au rs = $ad rs
15
+ scoreboard players operation $au rs *= $i rs
16
+ scoreboard players set $av rs 0
17
+ execute if score $at rs > $au rs run scoreboard players set $av rs 1
18
+ execute if score $av rs matches 1.. run function mypack:atan2_fixed/then_33
19
+ execute if score $av rs matches ..0 run function mypack:atan2_fixed/else_34
@@ -0,0 +1,5 @@
1
+ # block: loop_check_30
2
+ scoreboard players set $an rs 0
3
+ execute if score $al rs < $am rs run scoreboard players set $an rs 1
4
+ execute if score $an rs matches 1.. run function mypack:atan2_fixed/loop_body_31
5
+ execute if score $an rs matches ..0 run function mypack:atan2_fixed/loop_exit_32
@@ -0,0 +1,6 @@
1
+ # block: loop_exit_32
2
+ scoreboard players operation $ax rs = $al rs
3
+ scoreboard players set $ay rs 0
4
+ execute if score $ai rs = $b rs run scoreboard players set $ay rs 1
5
+ execute if score $ay rs matches 1.. run function mypack:atan2_fixed/then_36
6
+ execute if score $ay rs matches ..0 run function mypack:atan2_fixed/merge_38
@@ -0,0 +1,6 @@
1
+ # block: merge_11
2
+ scoreboard players operation $aa rs = $o rs
3
+ scoreboard players set $ab rs 0
4
+ execute if score $o rs < $a rs run scoreboard players set $ab rs 1
5
+ execute if score $ab rs matches 1.. run function mypack:atan2_fixed/then_15
6
+ execute if score $ab rs matches ..0 run function mypack:atan2_fixed/merge_17
@@ -0,0 +1,3 @@
1
+ # block: merge_14
2
+ scoreboard players set $k rs 180
3
+ return 180
@@ -0,0 +1,6 @@
1
+ # block: merge_17
2
+ scoreboard players operation $ad rs = $u rs
3
+ scoreboard players set $ae rs 0
4
+ execute if score $u rs < $a rs run scoreboard players set $ae rs 1
5
+ execute if score $ae rs matches 1.. run function mypack:atan2_fixed/then_18
6
+ execute if score $ae rs matches ..0 run function mypack:atan2_fixed/merge_20
@@ -0,0 +1,5 @@
1
+ # block: merge_2
2
+ scoreboard players set $y rs 0
3
+ execute if score $u rs = $a rs run scoreboard players set $y rs 1
4
+ execute if score $y rs matches 1.. run function mypack:atan2_fixed/then_9
5
+ execute if score $y rs matches ..0 run function mypack:atan2_fixed/merge_11
@@ -0,0 +1,5 @@
1
+ # block: merge_20
2
+ scoreboard players set $ag rs 0
3
+ execute if score $aa rs > $j rs run scoreboard players set $ag rs 1
4
+ execute if score $ag rs matches 1.. run function mypack:atan2_fixed/then_21
5
+ execute if score $ag rs matches ..0 run function mypack:atan2_fixed/merge_23
@@ -0,0 +1,5 @@
1
+ # block: merge_23
2
+ scoreboard players set $ah rs 0
3
+ execute if score $ad rs > $j rs run scoreboard players set $ah rs 1
4
+ execute if score $ah rs matches 1.. run function mypack:atan2_fixed/then_24
5
+ execute if score $ah rs matches ..0 run function mypack:atan2_fixed/merge_26
@@ -0,0 +1,6 @@
1
+ # block: merge_26
2
+ scoreboard players set $ai rs 0
3
+ scoreboard players set $aj rs 0
4
+ execute if score $ad rs > $aa rs run scoreboard players set $aj rs 1
5
+ execute if score $aj rs matches 1.. run function mypack:atan2_fixed/then_27
6
+ execute if score $aj rs matches ..0 run function mypack:atan2_fixed/merge_29
@@ -0,0 +1,4 @@
1
+ # block: merge_29
2
+ scoreboard players set $al rs 0
3
+ scoreboard players set $am rs 45
4
+ function mypack:atan2_fixed/loop_check_30
@@ -0,0 +1,5 @@
1
+ # block: merge_38
2
+ scoreboard players set $ba rs 0
3
+ execute if score $o rs > $a rs run scoreboard players set $ba rs 1
4
+ execute if score $ba rs matches 1.. run function mypack:atan2_fixed/then_39
5
+ execute if score $ba rs matches ..0 run function mypack:atan2_fixed/merge_41
@@ -0,0 +1,5 @@
1
+ # block: merge_41
2
+ scoreboard players set $bd rs 0
3
+ execute if score $u rs >= $a rs run scoreboard players set $bd rs 1
4
+ execute if score $bd rs matches 1.. run function mypack:atan2_fixed/then_45
5
+ execute if score $bd rs matches ..0 run function mypack:atan2_fixed/merge_47
@@ -0,0 +1,5 @@
1
+ # block: merge_44
2
+ scoreboard players set $bc rs 360
3
+ scoreboard players operation $bc rs -= $ax rs
4
+ scoreboard players operation $k rs = $bc rs
5
+ return run scoreboard players get $bc rs
@@ -0,0 +1,5 @@
1
+ # block: merge_47
2
+ scoreboard players set $bf rs 180
3
+ scoreboard players operation $bf rs += $ax rs
4
+ scoreboard players operation $k rs = $bf rs
5
+ return run scoreboard players get $bf rs
@@ -0,0 +1,5 @@
1
+ # block: merge_5
2
+ scoreboard players set $x rs 0
3
+ execute if score $u rs < $a rs run scoreboard players set $x rs 1
4
+ execute if score $x rs matches 1.. run function mypack:atan2_fixed/then_6
5
+ execute if score $x rs matches ..0 run function mypack:atan2_fixed/merge_8
@@ -0,0 +1,3 @@
1
+ # block: merge_8
2
+ scoreboard players set $k rs 0
3
+ return 0
@@ -0,0 +1,5 @@
1
+ # block: then_0
2
+ scoreboard players set $w rs 0
3
+ execute if score $u rs > $a rs run scoreboard players set $w rs 1
4
+ execute if score $w rs matches 1.. run function mypack:atan2_fixed/then_3
5
+ execute if score $w rs matches ..0 run function mypack:atan2_fixed/merge_5
@@ -0,0 +1,3 @@
1
+ # block: then_12
2
+ scoreboard players set $k rs 0
3
+ return 0
@@ -0,0 +1,5 @@
1
+ # block: then_15
2
+ scoreboard players set $ac rs 0
3
+ scoreboard players operation $ac rs -= $aa rs
4
+ scoreboard players operation $aa rs = $ac rs
5
+ function mypack:atan2_fixed/merge_17
@@ -0,0 +1,5 @@
1
+ # block: then_18
2
+ scoreboard players set $af rs 0
3
+ scoreboard players operation $af rs -= $ad rs
4
+ scoreboard players operation $ad rs = $af rs
5
+ function mypack:atan2_fixed/merge_20
@@ -0,0 +1,3 @@
1
+ # block: then_21
2
+ scoreboard players set $aa rs 46340
3
+ function mypack:atan2_fixed/merge_23
@@ -0,0 +1,3 @@
1
+ # block: then_24
2
+ scoreboard players set $ad rs 46340
3
+ function mypack:atan2_fixed/merge_26
@@ -0,0 +1,6 @@
1
+ # block: then_27
2
+ scoreboard players operation $ak rs = $aa rs
3
+ scoreboard players operation $aa rs = $ad rs
4
+ scoreboard players operation $ad rs = $ak rs
5
+ scoreboard players set $ai rs 1
6
+ function mypack:atan2_fixed/merge_29
@@ -0,0 +1,3 @@
1
+ # block: then_3
2
+ scoreboard players set $k rs 90
3
+ return 90
@@ -0,0 +1,5 @@
1
+ # block: then_33
2
+ scoreboard players operation $aw rs = $ar rs
3
+ scoreboard players operation $aw rs -= $b rs
4
+ scoreboard players operation $am rs = $aw rs
5
+ function mypack:atan2_fixed/loop_check_30
@@ -0,0 +1,5 @@
1
+ # block: then_36
2
+ scoreboard players set $az rs 90
3
+ scoreboard players operation $az rs -= $ax rs
4
+ scoreboard players operation $ax rs = $az rs
5
+ function mypack:atan2_fixed/merge_38
@@ -0,0 +1,5 @@
1
+ # block: then_39
2
+ scoreboard players set $bb rs 0
3
+ execute if score $u rs >= $a rs run scoreboard players set $bb rs 1
4
+ execute if score $bb rs matches 1.. run function mypack:atan2_fixed/then_42
5
+ execute if score $bb rs matches ..0 run function mypack:atan2_fixed/merge_44
@@ -0,0 +1,3 @@
1
+ # block: then_42
2
+ scoreboard players operation $k rs = $ax rs
3
+ return run scoreboard players get $ax rs
@@ -0,0 +1,5 @@
1
+ # block: then_45
2
+ scoreboard players set $be rs 180
3
+ scoreboard players operation $be rs -= $ax rs
4
+ scoreboard players operation $k rs = $be rs
5
+ return run scoreboard players get $be rs
@@ -0,0 +1,3 @@
1
+ # block: then_6
2
+ scoreboard players set $k rs 270
3
+ return 270
@@ -0,0 +1,5 @@
1
+ # block: then_9
2
+ scoreboard players set $z rs 0
3
+ execute if score $o rs > $a rs run scoreboard players set $z rs 1
4
+ execute if score $z rs matches 1.. run function mypack:atan2_fixed/then_12
5
+ execute if score $z rs matches ..0 run function mypack:atan2_fixed/merge_14
@@ -0,0 +1,7 @@
1
+ # block: entry
2
+ scoreboard players operation $u rs = $n rs
3
+ scoreboard players operation $o rs = $t rs
4
+ scoreboard players set $v rs 0
5
+ execute if score $o rs = $a rs run scoreboard players set $v rs 1
6
+ execute if score $v rs matches 1.. run function mypack:atan2_fixed/then_0
7
+ execute if score $v rs matches ..0 run function mypack:atan2_fixed/merge_2
@@ -0,0 +1,10 @@
1
+ # block: entry
2
+ scoreboard players set $n rs -42
3
+ function mypack:abs
4
+ scoreboard players operation $l rs = $k rs
5
+ execute store result score data rs run scoreboard players get $l rs
6
+ scoreboard players set $n rs 3
7
+ scoreboard players set $t rs 4
8
+ function mypack:atan2_fixed
9
+ scoreboard players operation $m rs = $k rs
10
+ execute store result score angle rs run scoreboard players get $m rs
@@ -0,0 +1,16 @@
1
+ # RedScript runtime init
2
+ scoreboard objectives add rs dummy
3
+ scoreboard objectives add quiz_start trigger
4
+ scoreboard players enable @a quiz_start
5
+ scoreboard objectives add quiz_a trigger
6
+ scoreboard players enable @a quiz_a
7
+ scoreboard objectives add quiz_b trigger
8
+ scoreboard players enable @a quiz_b
9
+ scoreboard objectives add quiz_c trigger
10
+ scoreboard players enable @a quiz_c
11
+ scoreboard players set $const_1 rs 1
12
+ scoreboard players set $const_2 rs 2
13
+ scoreboard players set $const_3 rs 3
14
+ scoreboard players set $const_1 rs 1
15
+ scoreboard players set $const_2 rs 2
16
+ scoreboard players set $const_3 rs 3
@@ -0,0 +1,6 @@
1
+ # RedScript tick dispatcher
2
+ # Trigger checks
3
+ execute as @a[scores={quiz_start=1..}] run function quiz:__trigger_quiz_start_dispatch
4
+ execute as @a[scores={quiz_a=1..}] run function quiz:__trigger_quiz_a_dispatch
5
+ execute as @a[scores={quiz_b=1..}] run function quiz:__trigger_quiz_b_dispatch
6
+ execute as @a[scores={quiz_c=1..}] run function quiz:__trigger_quiz_c_dispatch
@@ -0,0 +1,4 @@
1
+ # Trigger dispatch for quiz_a
2
+ function quiz:answer_a
3
+ scoreboard players set @s quiz_a 0
4
+ scoreboard players enable @s quiz_a