redscript-mc 2.5.0 → 2.6.2

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 (1243) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +5 -75
  3. package/README.zh.md +165 -147
  4. package/ROADMAP.md +195 -0
  5. package/dist/data/linalg/function/_vec2d_len_sq_fx.mcfunction +17 -0
  6. package/dist/data/linalg/function/_vec3d_len_sq_fx.mcfunction +27 -0
  7. package/dist/data/linalg/function/load.mcfunction +1 -0
  8. package/dist/data/linalg/function/mat2d_det.mcfunction +16 -0
  9. package/dist/data/linalg/function/mat2d_mul_r0c0.mcfunction +16 -0
  10. package/dist/data/linalg/function/mat2d_mul_r0c1.mcfunction +16 -0
  11. package/dist/data/linalg/function/mat2d_mul_r1c0.mcfunction +16 -0
  12. package/dist/data/linalg/function/mat2d_mul_r1c1.mcfunction +16 -0
  13. package/dist/data/linalg/function/mat2d_vecmul_x.mcfunction +16 -0
  14. package/dist/data/linalg/function/mat2d_vecmul_y.mcfunction +16 -0
  15. package/dist/data/linalg/function/solve2d_x.mcfunction +27 -0
  16. package/dist/data/linalg/function/solve2d_y.mcfunction +27 -0
  17. package/dist/data/linalg/function/vec2d_dist.mcfunction +15 -0
  18. package/dist/data/linalg/function/vec2d_dot.mcfunction +16 -0
  19. package/dist/data/linalg/function/vec2d_length.mcfunction +21 -0
  20. package/dist/data/linalg/function/vec2d_normalize_x.mcfunction +8 -0
  21. package/dist/data/linalg/function/vec2d_normalize_x__merge_1.mcfunction +10 -0
  22. package/dist/data/linalg/function/vec2d_normalize_x__then_0.mcfunction +3 -0
  23. package/dist/data/linalg/function/vec2d_normalize_y.mcfunction +8 -0
  24. package/dist/data/linalg/function/vec2d_normalize_y__merge_1.mcfunction +10 -0
  25. package/dist/data/linalg/function/vec2d_normalize_y__then_0.mcfunction +3 -0
  26. package/dist/data/linalg/function/vec3d_cross_x.mcfunction +16 -0
  27. package/dist/data/linalg/function/vec3d_cross_y.mcfunction +16 -0
  28. package/dist/data/linalg/function/vec3d_cross_z.mcfunction +16 -0
  29. package/dist/data/linalg/function/vec3d_dist.mcfunction +21 -0
  30. package/dist/data/linalg/function/vec3d_dot.mcfunction +26 -0
  31. package/dist/data/linalg/function/vec3d_length.mcfunction +31 -0
  32. package/dist/data/linalg/function/vec3d_normalize_x.mcfunction +9 -0
  33. package/dist/data/linalg/function/vec3d_normalize_x__merge_1.mcfunction +11 -0
  34. package/dist/data/linalg/function/vec3d_normalize_x__then_0.mcfunction +3 -0
  35. package/dist/data/linalg/function/vec3d_normalize_y.mcfunction +9 -0
  36. package/dist/data/linalg/function/vec3d_normalize_y__merge_1.mcfunction +11 -0
  37. package/dist/data/linalg/function/vec3d_normalize_y__then_0.mcfunction +3 -0
  38. package/dist/data/linalg/function/vec3d_normalize_z.mcfunction +9 -0
  39. package/dist/data/linalg/function/vec3d_normalize_z__merge_1.mcfunction +11 -0
  40. package/dist/data/linalg/function/vec3d_normalize_z__then_0.mcfunction +3 -0
  41. package/dist/data/math_hp/function/cos_hp.mcfunction +8 -0
  42. package/dist/data/math_hp/function/div3_hp.mcfunction +23 -0
  43. package/dist/data/math_hp/function/div_hp.mcfunction +13 -0
  44. package/dist/data/math_hp/function/init_div.mcfunction +1 -0
  45. package/dist/data/math_hp/function/init_trig.mcfunction +1 -0
  46. package/dist/data/math_hp/function/ln_5term.mcfunction +6 -0
  47. package/dist/data/math_hp/function/ln_5term__loop_body_1.mcfunction +8 -0
  48. package/dist/data/math_hp/function/ln_5term__loop_body_4.mcfunction +8 -0
  49. package/dist/data/math_hp/function/ln_5term__loop_exit_2.mcfunction +1 -0
  50. package/dist/data/math_hp/function/ln_5term__loop_exit_5.mcfunction +61 -0
  51. package/dist/data/math_hp/function/ln_5term__loop_header_0.mcfunction +3 -0
  52. package/dist/data/math_hp/function/ln_5term__loop_header_3.mcfunction +6 -0
  53. package/dist/data/math_hp/function/load.mcfunction +1 -0
  54. package/dist/data/math_hp/function/norm3_hp.mcfunction +43 -0
  55. package/dist/data/math_hp/function/sin_hp.mcfunction +8 -0
  56. package/dist/data/math_hp/function/sqrt_hp.mcfunction +17 -0
  57. package/dist/data/math_hp/function/sqrt_hp__merge_1.mcfunction +21 -0
  58. package/dist/data/math_hp/function/sqrt_hp__then_0.mcfunction +2 -0
  59. package/dist/data/minecraft/tags/function/load.json +1 -2
  60. package/dist/data/minecraft/tags/function/tick.json +1 -1
  61. package/dist/data/readme_demo/function/_draw.mcfunction +1 -0
  62. package/dist/data/readme_demo/function/_init.mcfunction +1 -0
  63. package/dist/data/readme_demo/function/_math_init.mcfunction +4 -0
  64. package/dist/data/readme_demo/function/_wave_tick.mcfunction +1 -0
  65. package/dist/data/readme_demo/function/_wave_tick__foreach_t8.mcfunction +109 -0
  66. package/dist/data/readme_demo/function/acos_approx.mcfunction +7 -0
  67. package/dist/data/readme_demo/function/approx_eq.mcfunction +10 -0
  68. package/dist/data/readme_demo/function/approx_eq__merge_1.mcfunction +3 -0
  69. package/dist/data/readme_demo/function/approx_eq__merge_3.mcfunction +2 -0
  70. package/dist/data/readme_demo/function/approx_eq__then_0.mcfunction +4 -0
  71. package/dist/data/readme_demo/function/approx_eq__then_2.mcfunction +2 -0
  72. package/dist/data/readme_demo/function/asin_approx.mcfunction +5 -0
  73. package/dist/data/readme_demo/function/asin_approx__merge_1.mcfunction +3 -0
  74. package/dist/data/readme_demo/function/asin_approx__merge_10.mcfunction +5 -0
  75. package/dist/data/readme_demo/function/asin_approx__merge_4.mcfunction +12 -0
  76. package/dist/data/readme_demo/function/asin_approx__merge_7.mcfunction +14 -0
  77. package/dist/data/readme_demo/function/asin_approx__then_0.mcfunction +2 -0
  78. package/dist/data/readme_demo/function/asin_approx__then_3.mcfunction +2 -0
  79. package/dist/data/readme_demo/function/asin_approx__then_6.mcfunction +2 -0
  80. package/dist/data/readme_demo/function/asin_approx__then_9.mcfunction +2 -0
  81. package/dist/data/readme_demo/function/cbrt_fx.mcfunction +5 -0
  82. package/dist/data/readme_demo/function/cbrt_fx__loop_body_6.mcfunction +7 -0
  83. package/dist/data/readme_demo/function/cbrt_fx__loop_exit_7.mcfunction +1 -0
  84. package/dist/data/readme_demo/function/cbrt_fx__loop_header_5.mcfunction +4 -0
  85. package/dist/data/readme_demo/function/cbrt_fx__merge_1.mcfunction +8 -0
  86. package/dist/data/readme_demo/function/cbrt_fx__merge_11.mcfunction +5 -0
  87. package/dist/data/readme_demo/function/cbrt_fx__merge_13.mcfunction +4 -0
  88. package/dist/data/readme_demo/function/cbrt_fx__merge_4.mcfunction +2 -0
  89. package/dist/data/readme_demo/function/cbrt_fx__merge_9.mcfunction +13 -0
  90. package/dist/data/readme_demo/function/cbrt_fx__then_0.mcfunction +2 -0
  91. package/dist/data/readme_demo/function/cbrt_fx__then_10.mcfunction +2 -0
  92. package/dist/data/readme_demo/function/cbrt_fx__then_12.mcfunction +2 -0
  93. package/dist/data/readme_demo/function/cbrt_fx__then_3.mcfunction +2 -0
  94. package/dist/data/readme_demo/function/cbrt_fx__then_8.mcfunction +2 -0
  95. package/dist/data/readme_demo/function/cbrt_newton.mcfunction +5 -0
  96. package/dist/data/readme_demo/function/cbrt_newton__else_7.mcfunction +2 -0
  97. package/dist/data/readme_demo/function/cbrt_newton__merge_1.mcfunction +11 -0
  98. package/dist/data/readme_demo/function/cbrt_newton__merge_4.mcfunction +1 -0
  99. package/dist/data/readme_demo/function/cbrt_newton__merge_6.mcfunction +1 -0
  100. package/dist/data/readme_demo/function/cbrt_newton__then_0.mcfunction +2 -0
  101. package/dist/data/readme_demo/function/cbrt_newton__then_3.mcfunction +17 -0
  102. package/dist/data/readme_demo/function/cbrt_newton__then_5.mcfunction +11 -0
  103. package/dist/data/readme_demo/function/ceil_div.mcfunction +9 -0
  104. package/dist/data/readme_demo/function/combinations.mcfunction +6 -0
  105. package/dist/data/readme_demo/function/combinations__loop_body_9.mcfunction +15 -0
  106. package/dist/data/readme_demo/function/combinations__loop_exit_10.mcfunction +1 -0
  107. package/dist/data/readme_demo/function/combinations__loop_header_8.mcfunction +3 -0
  108. package/dist/data/readme_demo/function/combinations__merge_1.mcfunction +3 -0
  109. package/dist/data/readme_demo/function/combinations__merge_4.mcfunction +6 -0
  110. package/dist/data/readme_demo/function/combinations__merge_7.mcfunction +3 -0
  111. package/dist/data/readme_demo/function/combinations__then_0.mcfunction +2 -0
  112. package/dist/data/readme_demo/function/combinations__then_3.mcfunction +2 -0
  113. package/dist/data/readme_demo/function/combinations__then_6.mcfunction +4 -0
  114. package/dist/data/readme_demo/function/cos_fixed.mcfunction +7 -0
  115. package/dist/data/readme_demo/function/cubic_disc_fx.mcfunction +26 -0
  116. package/dist/data/readme_demo/function/cubic_newton.mcfunction +8 -0
  117. package/dist/data/readme_demo/function/cubic_newton__loop_body_1.mcfunction +55 -0
  118. package/dist/data/readme_demo/function/cubic_newton__loop_exit_2.mcfunction +1 -0
  119. package/dist/data/readme_demo/function/cubic_newton__loop_header_0.mcfunction +4 -0
  120. package/dist/data/readme_demo/function/cubic_newton__merge_10.mcfunction +1 -0
  121. package/dist/data/readme_demo/function/cubic_newton__merge_4.mcfunction +4 -0
  122. package/dist/data/readme_demo/function/cubic_newton__merge_6.mcfunction +4 -0
  123. package/dist/data/readme_demo/function/cubic_newton__merge_8.mcfunction +4 -0
  124. package/dist/data/readme_demo/function/cubic_newton__then_3.mcfunction +2 -0
  125. package/dist/data/readme_demo/function/cubic_newton__then_5.mcfunction +13 -0
  126. package/dist/data/readme_demo/function/cubic_newton__then_7.mcfunction +4 -0
  127. package/dist/data/readme_demo/function/cubic_newton__then_9.mcfunction +2 -0
  128. package/dist/data/readme_demo/function/divfix.mcfunction +6 -0
  129. package/dist/data/readme_demo/function/divfix__merge_1.mcfunction +6 -0
  130. package/dist/data/readme_demo/function/divfix__then_0.mcfunction +2 -0
  131. package/dist/data/readme_demo/function/exp_fx.mcfunction +16 -0
  132. package/dist/data/readme_demo/function/exp_fx__loop_body_10.mcfunction +8 -0
  133. package/dist/data/readme_demo/function/exp_fx__loop_body_5.mcfunction +8 -0
  134. package/dist/data/readme_demo/function/exp_fx__loop_exit_11.mcfunction +1 -0
  135. package/dist/data/readme_demo/function/exp_fx__loop_exit_6.mcfunction +1 -0
  136. package/dist/data/readme_demo/function/exp_fx__loop_header_4.mcfunction +3 -0
  137. package/dist/data/readme_demo/function/exp_fx__loop_header_9.mcfunction +3 -0
  138. package/dist/data/readme_demo/function/exp_fx__merge_1.mcfunction +47 -0
  139. package/dist/data/readme_demo/function/exp_fx__merge_3.mcfunction +4 -0
  140. package/dist/data/readme_demo/function/exp_fx__merge_8.mcfunction +1 -0
  141. package/dist/data/readme_demo/function/exp_fx__then_0.mcfunction +7 -0
  142. package/dist/data/readme_demo/function/exp_fx__then_2.mcfunction +2 -0
  143. package/dist/data/readme_demo/function/exp_fx__then_7.mcfunction +5 -0
  144. package/dist/data/readme_demo/function/factorial.mcfunction +5 -0
  145. package/dist/data/readme_demo/function/factorial__loop_body_4.mcfunction +7 -0
  146. package/dist/data/readme_demo/function/factorial__loop_exit_5.mcfunction +1 -0
  147. package/dist/data/readme_demo/function/factorial__loop_header_3.mcfunction +3 -0
  148. package/dist/data/readme_demo/function/factorial__merge_1.mcfunction +3 -0
  149. package/dist/data/readme_demo/function/factorial__then_0.mcfunction +2 -0
  150. package/dist/data/readme_demo/function/gamma_int.mcfunction +5 -0
  151. package/dist/data/readme_demo/function/gamma_int__merge_1.mcfunction +6 -0
  152. package/dist/data/readme_demo/function/gamma_int__then_0.mcfunction +2 -0
  153. package/dist/data/readme_demo/function/gcd.mcfunction +7 -0
  154. package/dist/data/readme_demo/function/gcd__loop_body_5.mcfunction +5 -0
  155. package/dist/data/readme_demo/function/gcd__loop_exit_6.mcfunction +1 -0
  156. package/dist/data/readme_demo/function/gcd__loop_header_4.mcfunction +4 -0
  157. package/dist/data/readme_demo/function/gcd__merge_1.mcfunction +5 -0
  158. package/dist/data/readme_demo/function/gcd__merge_3.mcfunction +1 -0
  159. package/dist/data/readme_demo/function/gcd__then_0.mcfunction +4 -0
  160. package/dist/data/readme_demo/function/gcd__then_2.mcfunction +4 -0
  161. package/dist/data/readme_demo/function/isqrt.mcfunction +5 -0
  162. package/dist/data/readme_demo/function/isqrt__loop_body_10.mcfunction +8 -0
  163. package/dist/data/readme_demo/function/isqrt__loop_body_13.mcfunction +11 -0
  164. package/dist/data/readme_demo/function/isqrt__loop_body_7.mcfunction +8 -0
  165. package/dist/data/readme_demo/function/isqrt__loop_exit_11.mcfunction +2 -0
  166. package/dist/data/readme_demo/function/isqrt__loop_exit_14.mcfunction +1 -0
  167. package/dist/data/readme_demo/function/isqrt__loop_exit_8.mcfunction +9 -0
  168. package/dist/data/readme_demo/function/isqrt__loop_header_12.mcfunction +4 -0
  169. package/dist/data/readme_demo/function/isqrt__loop_header_6.mcfunction +4 -0
  170. package/dist/data/readme_demo/function/isqrt__loop_header_9.mcfunction +3 -0
  171. package/dist/data/readme_demo/function/isqrt__merge_1.mcfunction +4 -0
  172. package/dist/data/readme_demo/function/isqrt__merge_16.mcfunction +5 -0
  173. package/dist/data/readme_demo/function/isqrt__merge_4.mcfunction +3 -0
  174. package/dist/data/readme_demo/function/isqrt__then_0.mcfunction +2 -0
  175. package/dist/data/readme_demo/function/isqrt__then_15.mcfunction +1 -0
  176. package/dist/data/readme_demo/function/isqrt__then_3.mcfunction +2 -0
  177. package/dist/data/readme_demo/function/lcm.mcfunction +11 -0
  178. package/dist/data/readme_demo/function/lcm__merge_1.mcfunction +5 -0
  179. package/dist/data/readme_demo/function/lcm__then_0.mcfunction +2 -0
  180. package/dist/data/readme_demo/function/lerp.mcfunction +13 -0
  181. package/dist/data/readme_demo/function/ln.mcfunction +9 -0
  182. package/dist/data/readme_demo/function/ln__loop_body_1.mcfunction +8 -0
  183. package/dist/data/readme_demo/function/ln__loop_body_4.mcfunction +8 -0
  184. package/dist/data/readme_demo/function/ln__loop_exit_2.mcfunction +1 -0
  185. package/dist/data/readme_demo/function/ln__loop_exit_5.mcfunction +37 -0
  186. package/dist/data/readme_demo/function/ln__loop_header_0.mcfunction +3 -0
  187. package/dist/data/readme_demo/function/ln__loop_header_3.mcfunction +6 -0
  188. package/dist/data/readme_demo/function/load.mcfunction +1 -0
  189. package/dist/data/readme_demo/function/log10_fx.mcfunction +11 -0
  190. package/dist/data/readme_demo/function/log2_fx.mcfunction +11 -0
  191. package/dist/data/readme_demo/function/log2_int.mcfunction +5 -0
  192. package/dist/data/readme_demo/function/log2_int__loop_body_4.mcfunction +8 -0
  193. package/dist/data/readme_demo/function/log2_int__loop_exit_5.mcfunction +1 -0
  194. package/dist/data/readme_demo/function/log2_int__loop_header_3.mcfunction +4 -0
  195. package/dist/data/readme_demo/function/log2_int__merge_1.mcfunction +3 -0
  196. package/dist/data/readme_demo/function/log2_int__then_0.mcfunction +2 -0
  197. package/dist/data/readme_demo/function/loga_fx.mcfunction +10 -0
  198. package/dist/data/readme_demo/function/loga_fx__merge_1.mcfunction +9 -0
  199. package/dist/data/readme_demo/function/loga_fx__then_0.mcfunction +2 -0
  200. package/dist/data/readme_demo/function/map.mcfunction +12 -0
  201. package/dist/data/readme_demo/function/map__merge_1.mcfunction +11 -0
  202. package/dist/data/readme_demo/function/map__then_0.mcfunction +1 -0
  203. package/dist/data/readme_demo/function/mulfix.mcfunction +8 -0
  204. package/dist/data/readme_demo/function/newton_step.mcfunction +7 -0
  205. package/dist/data/readme_demo/function/newton_step__merge_1.mcfunction +8 -0
  206. package/dist/data/readme_demo/function/newton_step__then_0.mcfunction +1 -0
  207. package/dist/data/readme_demo/function/pow_int.mcfunction +6 -0
  208. package/dist/data/readme_demo/function/pow_int__loop_body_4.mcfunction +7 -0
  209. package/dist/data/readme_demo/function/pow_int__loop_exit_5.mcfunction +1 -0
  210. package/dist/data/readme_demo/function/pow_int__loop_header_3.mcfunction +4 -0
  211. package/dist/data/readme_demo/function/pow_int__merge_1.mcfunction +4 -0
  212. package/dist/data/readme_demo/function/pow_int__merge_7.mcfunction +8 -0
  213. package/dist/data/readme_demo/function/pow_int__then_0.mcfunction +2 -0
  214. package/dist/data/readme_demo/function/pow_int__then_6.mcfunction +4 -0
  215. package/dist/data/readme_demo/function/quadratic_disc.mcfunction +12 -0
  216. package/dist/data/readme_demo/function/quadratic_x1.mcfunction +7 -0
  217. package/dist/data/readme_demo/function/quadratic_x1__merge_1.mcfunction +13 -0
  218. package/dist/data/readme_demo/function/quadratic_x1__merge_4.mcfunction +15 -0
  219. package/dist/data/readme_demo/function/quadratic_x1__then_0.mcfunction +2 -0
  220. package/dist/data/readme_demo/function/quadratic_x1__then_3.mcfunction +2 -0
  221. package/dist/data/readme_demo/function/quadratic_x2.mcfunction +7 -0
  222. package/dist/data/readme_demo/function/quadratic_x2__merge_1.mcfunction +13 -0
  223. package/dist/data/readme_demo/function/quadratic_x2__merge_4.mcfunction +15 -0
  224. package/dist/data/readme_demo/function/quadratic_x2__then_0.mcfunction +2 -0
  225. package/dist/data/readme_demo/function/quadratic_x2__then_3.mcfunction +2 -0
  226. package/dist/data/readme_demo/function/sign.mcfunction +5 -0
  227. package/dist/data/readme_demo/function/sign__merge_1.mcfunction +4 -0
  228. package/dist/data/readme_demo/function/sign__merge_4.mcfunction +2 -0
  229. package/dist/data/readme_demo/function/sign__then_0.mcfunction +2 -0
  230. package/dist/data/readme_demo/function/sign__then_3.mcfunction +2 -0
  231. package/dist/data/readme_demo/function/simpson_step.mcfunction +16 -0
  232. package/dist/data/readme_demo/function/sin_fixed.mcfunction +9 -0
  233. package/dist/data/readme_demo/function/sin_fixed__merge_1.mcfunction +4 -0
  234. package/dist/data/readme_demo/function/sin_fixed__merge_3.mcfunction +4 -0
  235. package/dist/data/readme_demo/function/sin_fixed__merge_6.mcfunction +4 -0
  236. package/dist/data/readme_demo/function/sin_fixed__merge_9.mcfunction +10 -0
  237. package/dist/data/readme_demo/function/sin_fixed__then_0.mcfunction +4 -0
  238. package/dist/data/readme_demo/function/sin_fixed__then_2.mcfunction +6 -0
  239. package/dist/data/readme_demo/function/sin_fixed__then_5.mcfunction +8 -0
  240. package/dist/data/readme_demo/function/sin_fixed__then_8.mcfunction +10 -0
  241. package/dist/data/readme_demo/function/smootherstep.mcfunction +10 -0
  242. package/dist/data/readme_demo/function/smootherstep__merge_1.mcfunction +12 -0
  243. package/dist/data/readme_demo/function/smootherstep__merge_4.mcfunction +4 -0
  244. package/dist/data/readme_demo/function/smootherstep__merge_6.mcfunction +27 -0
  245. package/dist/data/readme_demo/function/smootherstep__then_0.mcfunction +2 -0
  246. package/dist/data/readme_demo/function/smootherstep__then_3.mcfunction +2 -0
  247. package/dist/data/readme_demo/function/smootherstep__then_5.mcfunction +2 -0
  248. package/dist/data/readme_demo/function/smoothstep.mcfunction +10 -0
  249. package/dist/data/readme_demo/function/smoothstep__merge_1.mcfunction +12 -0
  250. package/dist/data/readme_demo/function/smoothstep__merge_4.mcfunction +4 -0
  251. package/dist/data/readme_demo/function/smoothstep__merge_6.mcfunction +15 -0
  252. package/dist/data/readme_demo/function/smoothstep__then_0.mcfunction +2 -0
  253. package/dist/data/readme_demo/function/smoothstep__then_3.mcfunction +2 -0
  254. package/dist/data/readme_demo/function/smoothstep__then_5.mcfunction +2 -0
  255. package/dist/data/readme_demo/function/solve2x2_x.mcfunction +17 -0
  256. package/dist/data/readme_demo/function/solve2x2_x__merge_1.mcfunction +12 -0
  257. package/dist/data/readme_demo/function/solve2x2_x__then_0.mcfunction +2 -0
  258. package/dist/data/readme_demo/function/solve2x2_y.mcfunction +17 -0
  259. package/dist/data/readme_demo/function/solve2x2_y__merge_1.mcfunction +12 -0
  260. package/dist/data/readme_demo/function/solve2x2_y__then_0.mcfunction +2 -0
  261. package/dist/data/readme_demo/function/sqrt_fixed.mcfunction +8 -0
  262. package/dist/data/readme_demo/function/sqrt_fx.mcfunction +8 -0
  263. package/dist/data/readme_demo/function/start.mcfunction +2 -0
  264. package/dist/data/readme_demo/function/stop.mcfunction +1 -0
  265. package/dist/data/readme_demo/function/trapezoid_step.mcfunction +11 -0
  266. package/dist/data/stdextra/function/__load.mcfunction +2 -0
  267. package/dist/data/stdextra/function/load.mcfunction +1 -0
  268. package/dist/data/stdextra/function/test_bigint.mcfunction +52 -0
  269. package/dist/data/stdextra/function/test_bits.mcfunction +33 -0
  270. package/dist/data/stdextra/function/test_list_sort.mcfunction +55 -0
  271. package/dist/data/stdextra/function/test_random.mcfunction +17 -0
  272. package/dist/data/stdextra/function/test_random__merge_1.mcfunction +4 -0
  273. package/dist/data/stdextra/function/test_random__merge_11.mcfunction +1 -0
  274. package/dist/data/stdextra/function/test_random__merge_3.mcfunction +14 -0
  275. package/dist/data/stdextra/function/test_random__merge_5.mcfunction +8 -0
  276. package/dist/data/stdextra/function/test_random__merge_7.mcfunction +1 -0
  277. package/dist/data/stdextra/function/test_random__merge_9.mcfunction +1 -0
  278. package/dist/data/stdextra/function/test_random__then_0.mcfunction +4 -0
  279. package/dist/data/stdextra/function/test_random__then_10.mcfunction +2 -0
  280. package/dist/data/stdextra/function/test_random__then_2.mcfunction +2 -0
  281. package/dist/data/stdextra/function/test_random__then_4.mcfunction +4 -0
  282. package/dist/data/stdextra/function/test_random__then_6.mcfunction +2 -0
  283. package/dist/data/stdextra/function/test_random__then_8.mcfunction +4 -0
  284. package/dist/data/test/function/__dyn_idx_test_arrays_nums.mcfunction +1 -0
  285. package/dist/data/test/function/__dyn_idx_test_arrays_parent.mcfunction +1 -0
  286. package/dist/data/test/function/__dyn_idx_test_arrays_queue.mcfunction +1 -0
  287. package/dist/data/test/function/__dyn_idx_test_arrays_rev.mcfunction +1 -0
  288. package/dist/data/test/function/__dyn_idx_test_arrays_visited.mcfunction +1 -0
  289. package/dist/data/test/function/__dyn_wrt_test_arrays_parent.mcfunction +1 -0
  290. package/dist/data/test/function/__dyn_wrt_test_arrays_visited.mcfunction +1 -0
  291. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1.mcfunction +2 -0
  292. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_body_1.mcfunction +17 -0
  293. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_body_1_continue.mcfunction +1 -0
  294. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_body_1_yield.mcfunction +1 -0
  295. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_header_0.mcfunction +4 -0
  296. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_1__loop_header_0_exit.mcfunction +1 -0
  297. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2.mcfunction +2 -0
  298. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__else_8.mcfunction +19 -0
  299. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__loop_body_4.mcfunction +9 -0
  300. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__loop_header_3.mcfunction +3 -0
  301. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__loop_header_3_exit.mcfunction +1 -0
  302. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_10.mcfunction +11 -0
  303. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_12.mcfunction +1 -0
  304. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_14.mcfunction +11 -0
  305. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_16.mcfunction +1 -0
  306. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_18.mcfunction +11 -0
  307. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_20.mcfunction +1 -0
  308. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_22.mcfunction +1 -0
  309. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_24.mcfunction +1 -0
  310. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_7.mcfunction +6 -0
  311. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_7_continue.mcfunction +1 -0
  312. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__merge_7_yield.mcfunction +1 -0
  313. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_11.mcfunction +15 -0
  314. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_13.mcfunction +13 -0
  315. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_15.mcfunction +15 -0
  316. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_17.mcfunction +13 -0
  317. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_19.mcfunction +15 -0
  318. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_21.mcfunction +13 -0
  319. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_23.mcfunction +15 -0
  320. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_6.mcfunction +2 -0
  321. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_2__then_9.mcfunction +13 -0
  322. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3.mcfunction +2 -0
  323. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__else_32.mcfunction +4 -0
  324. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__loop_body_28.mcfunction +6 -0
  325. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__loop_header_27.mcfunction +4 -0
  326. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__loop_header_27_exit.mcfunction +1 -0
  327. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__merge_31.mcfunction +6 -0
  328. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__merge_31_continue.mcfunction +1 -0
  329. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__merge_31_yield.mcfunction +1 -0
  330. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_3__then_30.mcfunction +2 -0
  331. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4.mcfunction +2 -0
  332. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_body_34.mcfunction +16 -0
  333. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_body_34_continue.mcfunction +1 -0
  334. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_body_34_yield.mcfunction +1 -0
  335. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_header_33.mcfunction +4 -0
  336. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_4__loop_header_33_exit.mcfunction +1 -0
  337. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_5.mcfunction +16 -0
  338. package/dist/data/test/function/_coro_pathfind_bfs_coro_cont_5__merge_26.mcfunction +1 -0
  339. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick.mcfunction +4 -0
  340. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_1.mcfunction +1 -0
  341. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_2.mcfunction +1 -0
  342. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_3.mcfunction +1 -0
  343. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_4.mcfunction +1 -0
  344. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__call_5.mcfunction +1 -0
  345. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__check_2.mcfunction +4 -0
  346. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__check_3.mcfunction +4 -0
  347. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__check_4.mcfunction +4 -0
  348. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__check_5.mcfunction +4 -0
  349. package/dist/data/test/function/_coro_pathfind_bfs_coro_tick__done.mcfunction +1 -0
  350. package/dist/data/test/function/_hsl_chroma_x.mcfunction +1 -2
  351. package/dist/data/test/function/aabb_contains.mcfunction +1 -2
  352. package/dist/data/test/function/aabb_contains__merge_1.mcfunction +1 -2
  353. package/dist/data/test/function/aabb_contains__merge_10.mcfunction +1 -2
  354. package/dist/data/test/function/aabb_contains__merge_13.mcfunction +1 -2
  355. package/dist/data/test/function/aabb_contains__merge_4.mcfunction +1 -2
  356. package/dist/data/test/function/aabb_contains__merge_7.mcfunction +1 -2
  357. package/dist/data/test/function/acos_approx.mcfunction +7 -0
  358. package/dist/data/test/function/add_to_team.mcfunction +5 -0
  359. package/dist/data/test/function/angle_diff.mcfunction +1 -2
  360. package/dist/data/test/function/angle_normalize__loop_header_0.mcfunction +1 -2
  361. package/dist/data/test/function/angle_normalize__loop_header_3.mcfunction +1 -2
  362. package/dist/data/test/function/angry_at.mcfunction +1 -0
  363. package/dist/data/test/function/apply_damage.mcfunction +12 -0
  364. package/dist/data/test/function/apply_damage__else_2.mcfunction +2 -0
  365. package/dist/data/test/function/apply_damage__merge_1.mcfunction +1 -0
  366. package/dist/data/test/function/apply_damage__then_0.mcfunction +2 -0
  367. package/dist/data/test/function/arr_test.mcfunction +4 -0
  368. package/dist/data/test/function/asin_approx.mcfunction +5 -0
  369. package/dist/data/test/function/asin_approx__merge_1.mcfunction +3 -0
  370. package/dist/data/test/function/asin_approx__merge_10.mcfunction +5 -0
  371. package/dist/data/test/function/asin_approx__merge_4.mcfunction +12 -0
  372. package/dist/data/test/function/asin_approx__merge_7.mcfunction +14 -0
  373. package/dist/data/test/function/asin_approx__then_0.mcfunction +2 -0
  374. package/dist/data/test/function/asin_approx__then_3.mcfunction +2 -0
  375. package/dist/data/test/function/asin_approx__then_6.mcfunction +2 -0
  376. package/dist/data/test/function/asin_approx__then_9.mcfunction +2 -0
  377. package/dist/data/test/function/barrier_wall.mcfunction +1 -0
  378. package/dist/data/test/function/bernoulli.mcfunction +1 -2
  379. package/dist/data/test/function/bernoulli__merge_1.mcfunction +1 -2
  380. package/dist/data/test/function/bigint_chunk.mcfunction +2 -0
  381. package/dist/data/test/function/bigint_div_small.mcfunction +6 -0
  382. package/dist/data/test/function/bigint_div_small__loop_body_1.mcfunction +12 -0
  383. package/dist/data/test/function/bigint_div_small__loop_exit_2.mcfunction +1 -0
  384. package/dist/data/test/function/bigint_div_small__loop_header_0.mcfunction +3 -0
  385. package/dist/data/test/function/bigint_mod_small.mcfunction +6 -0
  386. package/dist/data/test/function/bigint_mod_small__loop_body_1.mcfunction +12 -0
  387. package/dist/data/test/function/bigint_mod_small__loop_exit_2.mcfunction +1 -0
  388. package/dist/data/test/function/bigint_mod_small__loop_header_0.mcfunction +3 -0
  389. package/dist/data/test/function/bit_and__loop_body_1.mcfunction +1 -2
  390. package/dist/data/test/function/bit_and__loop_header_0.mcfunction +1 -2
  391. package/dist/data/test/function/bit_and__then_3.mcfunction +1 -2
  392. package/dist/data/test/function/bit_clear__loop_exit_2.mcfunction +1 -2
  393. package/dist/data/test/function/bit_clear__loop_header_0.mcfunction +1 -2
  394. package/dist/data/test/function/bit_get__loop_header_0.mcfunction +1 -2
  395. package/dist/data/test/function/bit_not__loop_body_1.mcfunction +1 -2
  396. package/dist/data/test/function/bit_not__loop_header_0.mcfunction +1 -2
  397. package/dist/data/test/function/bit_or__loop_body_1.mcfunction +1 -2
  398. package/dist/data/test/function/bit_or__loop_header_0.mcfunction +1 -2
  399. package/dist/data/test/function/bit_or__merge_4.mcfunction +1 -2
  400. package/dist/data/test/function/bit_or__then_5.mcfunction +1 -2
  401. package/dist/data/test/function/bit_set__loop_exit_2.mcfunction +1 -2
  402. package/dist/data/test/function/bit_set__loop_header_0.mcfunction +1 -2
  403. package/dist/data/test/function/bit_shl__loop_header_0.mcfunction +1 -2
  404. package/dist/data/test/function/bit_shr__loop_header_0.mcfunction +1 -2
  405. package/dist/data/test/function/bit_toggle__loop_exit_2.mcfunction +1 -2
  406. package/dist/data/test/function/bit_toggle__loop_header_0.mcfunction +1 -2
  407. package/dist/data/test/function/bit_xor__loop_body_1.mcfunction +1 -2
  408. package/dist/data/test/function/bit_xor__loop_header_0.mcfunction +1 -2
  409. package/dist/data/test/function/buff_all.mcfunction +22 -0
  410. package/dist/data/test/function/cbrt_newton.mcfunction +5 -0
  411. package/dist/data/test/function/cbrt_newton__else_7.mcfunction +2 -0
  412. package/dist/data/test/function/cbrt_newton__merge_1.mcfunction +11 -0
  413. package/dist/data/test/function/cbrt_newton__merge_4.mcfunction +1 -0
  414. package/dist/data/test/function/cbrt_newton__merge_6.mcfunction +1 -0
  415. package/dist/data/test/function/cbrt_newton__then_0.mcfunction +2 -0
  416. package/dist/data/test/function/cbrt_newton__then_3.mcfunction +17 -0
  417. package/dist/data/test/function/cbrt_newton__then_5.mcfunction +11 -0
  418. package/dist/data/test/function/check_holding_item.mcfunction +1 -0
  419. package/dist/data/test/function/check_look_down.mcfunction +1 -0
  420. package/dist/data/test/function/check_look_down__foreach_t0.mcfunction +2 -0
  421. package/dist/data/test/function/check_look_straight.mcfunction +1 -0
  422. package/dist/data/test/function/check_look_straight__foreach_t0.mcfunction +2 -0
  423. package/dist/data/test/function/check_look_up.mcfunction +1 -0
  424. package/dist/data/test/function/check_look_up__foreach_t0.mcfunction +2 -0
  425. package/dist/data/test/function/cleanup_teams.mcfunction +8 -0
  426. package/dist/data/test/function/clear_area.mcfunction +1 -0
  427. package/dist/data/test/function/clear_effect.mcfunction +1 -0
  428. package/dist/data/test/function/clear_effects.mcfunction +1 -0
  429. package/dist/data/test/function/clear_inventory.mcfunction +1 -0
  430. package/dist/data/test/function/cooldown_ready.mcfunction +7 -0
  431. package/dist/data/test/function/cooldown_ready__merge_1.mcfunction +4 -0
  432. package/dist/data/test/function/cooldown_ready__merge_4.mcfunction +2 -0
  433. package/dist/data/test/function/cooldown_ready__then_0.mcfunction +2 -0
  434. package/dist/data/test/function/cooldown_ready__then_3.mcfunction +2 -0
  435. package/dist/data/test/function/cooldown_start.mcfunction +3 -0
  436. package/dist/data/test/function/cooldown_tick.mcfunction +7 -0
  437. package/dist/data/test/function/cooldown_tick__else_5.mcfunction +2 -0
  438. package/dist/data/test/function/cooldown_tick__merge_1.mcfunction +4 -0
  439. package/dist/data/test/function/cooldown_tick__merge_4.mcfunction +1 -0
  440. package/dist/data/test/function/cooldown_tick__merge_7.mcfunction +1 -0
  441. package/dist/data/test/function/cooldown_tick__then_0.mcfunction +1 -0
  442. package/dist/data/test/function/cooldown_tick__then_3.mcfunction +7 -0
  443. package/dist/data/test/function/cooldown_tick__then_6.mcfunction +2 -0
  444. package/dist/data/test/function/cos_hp.mcfunction +4 -2
  445. package/dist/data/test/function/create_blue_team.mcfunction +10 -0
  446. package/dist/data/test/function/create_green_team.mcfunction +10 -0
  447. package/dist/data/test/function/create_health_bar.mcfunction +24 -0
  448. package/dist/data/test/function/create_progress_bar.mcfunction +24 -0
  449. package/dist/data/test/function/create_red_team.mcfunction +10 -0
  450. package/dist/data/test/function/create_team.mcfunction +8 -0
  451. package/dist/data/test/function/create_timer_bar.mcfunction +30 -0
  452. package/dist/data/test/function/create_yellow_team.mcfunction +10 -0
  453. package/dist/data/test/function/cubic_disc_fx.mcfunction +26 -0
  454. package/dist/data/test/function/cubic_newton.mcfunction +8 -0
  455. package/dist/data/test/function/cubic_newton__loop_body_1.mcfunction +55 -0
  456. package/dist/data/test/function/cubic_newton__loop_exit_2.mcfunction +1 -0
  457. package/dist/data/test/function/cubic_newton__loop_header_0.mcfunction +4 -0
  458. package/dist/data/test/function/cubic_newton__merge_10.mcfunction +1 -0
  459. package/dist/data/test/function/cubic_newton__merge_4.mcfunction +4 -0
  460. package/dist/data/test/function/cubic_newton__merge_6.mcfunction +4 -0
  461. package/dist/data/test/function/cubic_newton__merge_8.mcfunction +4 -0
  462. package/dist/data/test/function/cubic_newton__then_3.mcfunction +2 -0
  463. package/dist/data/test/function/cubic_newton__then_5.mcfunction +13 -0
  464. package/dist/data/test/function/cubic_newton__then_7.mcfunction +4 -0
  465. package/dist/data/test/function/cubic_newton__then_9.mcfunction +2 -0
  466. package/dist/data/test/function/curve_length_2d.mcfunction +6 -0
  467. package/dist/data/test/function/curve_length_2d__loop_body_1.mcfunction +32 -0
  468. package/dist/data/test/function/curve_length_2d__loop_exit_2.mcfunction +1 -0
  469. package/dist/data/test/function/curve_length_2d__loop_header_0.mcfunction +5 -0
  470. package/dist/data/test/function/cylinder_contains.mcfunction +1 -2
  471. package/dist/data/test/function/damage.mcfunction +9 -0
  472. package/dist/data/test/function/damage__else_2.mcfunction +2 -0
  473. package/dist/data/test/function/damage__merge_1.mcfunction +1 -0
  474. package/dist/data/test/function/damage__then_0.mcfunction +2 -0
  475. package/dist/data/test/function/deriv_central.mcfunction +7 -0
  476. package/dist/data/test/function/deriv_central__merge_1.mcfunction +10 -0
  477. package/dist/data/test/function/deriv_central__then_0.mcfunction +2 -0
  478. package/dist/data/test/function/deriv_forward.mcfunction +7 -0
  479. package/dist/data/test/function/deriv_forward__merge_1.mcfunction +8 -0
  480. package/dist/data/test/function/deriv_forward__then_0.mcfunction +2 -0
  481. package/dist/data/test/function/disable_fire_spread.mcfunction +1 -0
  482. package/dist/data/test/function/disable_keep_inventory.mcfunction +1 -0
  483. package/dist/data/test/function/disable_mob_griefing.mcfunction +1 -0
  484. package/dist/data/test/function/div3_hp.mcfunction +23 -0
  485. package/dist/data/test/function/div_hp.mcfunction +13 -0
  486. package/dist/data/test/function/draw_circle.mcfunction +8 -0
  487. package/dist/data/test/function/draw_circle__loop_body_1.mcfunction +34 -0
  488. package/dist/data/test/function/draw_circle__loop_exit_2.mcfunction +1 -0
  489. package/dist/data/test/function/draw_circle__loop_header_0.mcfunction +3 -0
  490. package/dist/data/test/function/draw_helix.mcfunction +10 -0
  491. package/dist/data/test/function/draw_helix__loop_body_1.mcfunction +42 -0
  492. package/dist/data/test/function/draw_helix__loop_exit_2.mcfunction +1 -0
  493. package/dist/data/test/function/draw_helix__loop_header_0.mcfunction +3 -0
  494. package/dist/data/test/function/draw_line_2d.mcfunction +9 -0
  495. package/dist/data/test/function/draw_line_2d__loop_body_1.mcfunction +34 -0
  496. package/dist/data/test/function/draw_line_2d__loop_exit_2.mcfunction +1 -0
  497. package/dist/data/test/function/draw_line_2d__loop_header_0.mcfunction +3 -0
  498. package/dist/data/test/function/ease_in_expo.mcfunction +1 -2
  499. package/dist/data/test/function/ease_in_out_back.mcfunction +1 -2
  500. package/dist/data/test/function/ease_in_out_bounce.mcfunction +1 -2
  501. package/dist/data/test/function/ease_in_out_cubic.mcfunction +1 -2
  502. package/dist/data/test/function/ease_in_out_quad.mcfunction +1 -2
  503. package/dist/data/test/function/ease_in_out_sine.mcfunction +1 -2
  504. package/dist/data/test/function/ease_out_bounce.mcfunction +1 -2
  505. package/dist/data/test/function/ease_out_bounce__merge_1.mcfunction +1 -2
  506. package/dist/data/test/function/ease_out_bounce__merge_4.mcfunction +1 -2
  507. package/dist/data/test/function/ease_out_expo.mcfunction +1 -2
  508. package/dist/data/test/function/enable_keep_inventory.mcfunction +1 -0
  509. package/dist/data/test/function/end_sparkles_at.mcfunction +1 -0
  510. package/dist/data/test/function/enemy_health.mcfunction +2 -0
  511. package/dist/data/test/function/example_right_click.mcfunction +1 -0
  512. package/dist/data/test/function/example_right_click__foreach_t0.mcfunction +5 -0
  513. package/dist/data/test/function/example_right_click__foreach_t0__merge_1.mcfunction +1 -0
  514. package/dist/data/test/function/example_right_click__foreach_t0__then_0.mcfunction +3 -0
  515. package/dist/data/test/function/exp_dist_approx.mcfunction +1 -2
  516. package/dist/data/test/function/exp_dist_approx__merge_1.mcfunction +1 -2
  517. package/dist/data/test/function/exp_dist_approx__merge_3.mcfunction +1 -2
  518. package/dist/data/test/function/explosion_effect.mcfunction +1 -0
  519. package/dist/data/test/function/fbm_1d__loop_exit_2.mcfunction +1 -2
  520. package/dist/data/test/function/fbm_1d__loop_header_0.mcfunction +1 -2
  521. package/dist/data/test/function/fbm_2d__loop_exit_2.mcfunction +1 -2
  522. package/dist/data/test/function/fbm_2d__loop_header_0.mcfunction +1 -2
  523. package/dist/data/test/function/flames.mcfunction +1 -0
  524. package/dist/data/test/function/gather_all.mcfunction +8 -0
  525. package/dist/data/test/function/give_kit_archer.mcfunction +6 -0
  526. package/dist/data/test/function/give_kit_mage.mcfunction +5 -0
  527. package/dist/data/test/function/give_kit_warrior.mcfunction +6 -0
  528. package/dist/data/test/function/glass_box.mcfunction +2 -0
  529. package/dist/data/test/function/glow.mcfunction +1 -0
  530. package/dist/data/test/function/goto_arena.mcfunction +7 -0
  531. package/dist/data/test/function/goto_lobby.mcfunction +7 -0
  532. package/dist/data/test/function/happy_at.mcfunction +1 -0
  533. package/dist/data/test/function/hash_1d_pos.mcfunction +1 -2
  534. package/dist/data/test/function/hash_2d_pos.mcfunction +1 -2
  535. package/dist/data/test/function/heal.mcfunction +5 -0
  536. package/dist/data/test/function/heap_new.mcfunction +7 -0
  537. package/dist/data/test/function/heap_new__loop_body_1.mcfunction +7 -0
  538. package/dist/data/test/function/heap_new__loop_exit_2.mcfunction +1 -0
  539. package/dist/data/test/function/heap_new__loop_header_0.mcfunction +4 -0
  540. package/dist/data/test/function/heap_peek.mcfunction +2 -0
  541. package/dist/data/test/function/heap_pop.mcfunction +4 -0
  542. package/dist/data/test/function/heap_pop__else_13.mcfunction +2 -0
  543. package/dist/data/test/function/heap_pop__loop_body_1.mcfunction +14 -0
  544. package/dist/data/test/function/heap_pop__loop_exit_2.mcfunction +1 -0
  545. package/dist/data/test/function/heap_pop__loop_header_0.mcfunction +4 -0
  546. package/dist/data/test/function/heap_pop__merge_10.mcfunction +1 -0
  547. package/dist/data/test/function/heap_pop__merge_12.mcfunction +1 -0
  548. package/dist/data/test/function/heap_pop__merge_4.mcfunction +3 -0
  549. package/dist/data/test/function/heap_pop__merge_6.mcfunction +1 -0
  550. package/dist/data/test/function/heap_pop__merge_8.mcfunction +3 -0
  551. package/dist/data/test/function/heap_pop__then_11.mcfunction +2 -0
  552. package/dist/data/test/function/heap_pop__then_3.mcfunction +3 -0
  553. package/dist/data/test/function/heap_pop__then_5.mcfunction +2 -0
  554. package/dist/data/test/function/heap_pop__then_7.mcfunction +3 -0
  555. package/dist/data/test/function/heap_pop__then_9.mcfunction +2 -0
  556. package/dist/data/test/function/heap_push.mcfunction +6 -0
  557. package/dist/data/test/function/heap_push__else_5.mcfunction +2 -0
  558. package/dist/data/test/function/heap_push__else_8.mcfunction +2 -0
  559. package/dist/data/test/function/heap_push__loop_body_1.mcfunction +4 -0
  560. package/dist/data/test/function/heap_push__loop_exit_2.mcfunction +1 -0
  561. package/dist/data/test/function/heap_push__loop_header_0.mcfunction +4 -0
  562. package/dist/data/test/function/heap_push__merge_4.mcfunction +1 -0
  563. package/dist/data/test/function/heap_push__merge_7.mcfunction +1 -0
  564. package/dist/data/test/function/heap_push__then_3.mcfunction +7 -0
  565. package/dist/data/test/function/heap_push__then_6.mcfunction +2 -0
  566. package/dist/data/test/function/heap_size.mcfunction +2 -0
  567. package/dist/data/test/function/hearts_at.mcfunction +1 -0
  568. package/dist/data/test/function/hide_bar.mcfunction +4 -0
  569. package/dist/data/test/function/hsl_to_b.mcfunction +1 -2
  570. package/dist/data/test/function/hsl_to_b__merge_1.mcfunction +1 -2
  571. package/dist/data/test/function/hsl_to_b__merge_12.mcfunction +1 -2
  572. package/dist/data/test/function/hsl_to_b__merge_3.mcfunction +1 -2
  573. package/dist/data/test/function/hsl_to_b__merge_6.mcfunction +1 -2
  574. package/dist/data/test/function/hsl_to_b__merge_9.mcfunction +1 -2
  575. package/dist/data/test/function/hsl_to_g.mcfunction +1 -2
  576. package/dist/data/test/function/hsl_to_g__merge_1.mcfunction +1 -2
  577. package/dist/data/test/function/hsl_to_g__merge_12.mcfunction +1 -2
  578. package/dist/data/test/function/hsl_to_g__merge_3.mcfunction +1 -2
  579. package/dist/data/test/function/hsl_to_g__merge_6.mcfunction +1 -2
  580. package/dist/data/test/function/hsl_to_g__merge_9.mcfunction +1 -2
  581. package/dist/data/test/function/hsl_to_r.mcfunction +1 -2
  582. package/dist/data/test/function/hsl_to_r__merge_1.mcfunction +1 -2
  583. package/dist/data/test/function/hsl_to_r__merge_12.mcfunction +1 -2
  584. package/dist/data/test/function/hsl_to_r__merge_3.mcfunction +1 -2
  585. package/dist/data/test/function/hsl_to_r__merge_6.mcfunction +1 -2
  586. package/dist/data/test/function/hsl_to_r__merge_9.mcfunction +1 -2
  587. package/dist/data/test/function/init_div.mcfunction +1 -0
  588. package/dist/data/test/function/insertion_sort.mcfunction +4 -0
  589. package/dist/data/test/function/insertion_sort__else_11.mcfunction +2 -0
  590. package/dist/data/test/function/insertion_sort__else_8.mcfunction +2 -0
  591. package/dist/data/test/function/insertion_sort__loop_body_1.mcfunction +6 -0
  592. package/dist/data/test/function/insertion_sort__loop_body_4.mcfunction +4 -0
  593. package/dist/data/test/function/insertion_sort__loop_exit_2.mcfunction +1 -0
  594. package/dist/data/test/function/insertion_sort__loop_exit_5.mcfunction +4 -0
  595. package/dist/data/test/function/insertion_sort__loop_header_0.mcfunction +3 -0
  596. package/dist/data/test/function/insertion_sort__loop_header_3.mcfunction +4 -0
  597. package/dist/data/test/function/insertion_sort__merge_10.mcfunction +1 -0
  598. package/dist/data/test/function/insertion_sort__merge_7.mcfunction +1 -0
  599. package/dist/data/test/function/insertion_sort__then_6.mcfunction +3 -0
  600. package/dist/data/test/function/insertion_sort__then_9.mcfunction +4 -0
  601. package/dist/data/test/function/insertion_sort_desc.mcfunction +4 -0
  602. package/dist/data/test/function/insertion_sort_desc__else_11.mcfunction +2 -0
  603. package/dist/data/test/function/insertion_sort_desc__else_8.mcfunction +2 -0
  604. package/dist/data/test/function/insertion_sort_desc__loop_body_1.mcfunction +6 -0
  605. package/dist/data/test/function/insertion_sort_desc__loop_body_4.mcfunction +4 -0
  606. package/dist/data/test/function/insertion_sort_desc__loop_exit_2.mcfunction +1 -0
  607. package/dist/data/test/function/insertion_sort_desc__loop_exit_5.mcfunction +4 -0
  608. package/dist/data/test/function/insertion_sort_desc__loop_header_0.mcfunction +3 -0
  609. package/dist/data/test/function/insertion_sort_desc__loop_header_3.mcfunction +4 -0
  610. package/dist/data/test/function/insertion_sort_desc__merge_10.mcfunction +1 -0
  611. package/dist/data/test/function/insertion_sort_desc__merge_7.mcfunction +1 -0
  612. package/dist/data/test/function/insertion_sort_desc__then_6.mcfunction +3 -0
  613. package/dist/data/test/function/insertion_sort_desc__then_9.mcfunction +4 -0
  614. package/dist/data/test/function/integrate_simpson.mcfunction +7 -0
  615. package/dist/data/test/function/integrate_simpson__loop_body_6.mcfunction +7 -0
  616. package/dist/data/test/function/integrate_simpson__loop_exit_7.mcfunction +6 -0
  617. package/dist/data/test/function/integrate_simpson__loop_header_5.mcfunction +5 -0
  618. package/dist/data/test/function/integrate_simpson__merge_1.mcfunction +8 -0
  619. package/dist/data/test/function/integrate_simpson__merge_11.mcfunction +4 -0
  620. package/dist/data/test/function/integrate_simpson__merge_4.mcfunction +5 -0
  621. package/dist/data/test/function/integrate_simpson__merge_9.mcfunction +7 -0
  622. package/dist/data/test/function/integrate_simpson__then_0.mcfunction +6 -0
  623. package/dist/data/test/function/integrate_simpson__then_10.mcfunction +6 -0
  624. package/dist/data/test/function/integrate_simpson__then_3.mcfunction +4 -0
  625. package/dist/data/test/function/integrate_simpson__then_8.mcfunction +6 -0
  626. package/dist/data/test/function/integrate_trapezoid.mcfunction +7 -0
  627. package/dist/data/test/function/integrate_trapezoid__loop_body_4.mcfunction +7 -0
  628. package/dist/data/test/function/integrate_trapezoid__loop_exit_5.mcfunction +6 -0
  629. package/dist/data/test/function/integrate_trapezoid__loop_header_3.mcfunction +5 -0
  630. package/dist/data/test/function/integrate_trapezoid__merge_1.mcfunction +11 -0
  631. package/dist/data/test/function/integrate_trapezoid__then_0.mcfunction +2 -0
  632. package/dist/data/test/function/interactions_init.mcfunction +9 -0
  633. package/dist/data/test/function/invisible.mcfunction +1 -0
  634. package/dist/data/test/function/is_op.mcfunction +2 -0
  635. package/dist/data/test/function/is_op__exec_t1.mcfunction +1 -0
  636. package/dist/data/test/function/is_sneaking.mcfunction +5 -0
  637. package/dist/data/test/function/is_sneaking__merge_1.mcfunction +2 -0
  638. package/dist/data/test/function/is_sneaking__then_0.mcfunction +2 -0
  639. package/dist/data/test/function/jump.mcfunction +1 -0
  640. package/dist/data/test/function/launch_up.mcfunction +6 -0
  641. package/dist/data/test/function/list_max3.mcfunction +1 -2
  642. package/dist/data/test/function/list_max3__merge_1.mcfunction +1 -2
  643. package/dist/data/test/function/list_max5.mcfunction +1 -2
  644. package/dist/data/test/function/list_max5__merge_1.mcfunction +1 -2
  645. package/dist/data/test/function/list_max5__merge_3.mcfunction +1 -2
  646. package/dist/data/test/function/list_max5__merge_5.mcfunction +1 -2
  647. package/dist/data/test/function/list_min3.mcfunction +1 -2
  648. package/dist/data/test/function/list_min3__merge_1.mcfunction +1 -2
  649. package/dist/data/test/function/list_min5.mcfunction +1 -2
  650. package/dist/data/test/function/list_min5__merge_1.mcfunction +1 -2
  651. package/dist/data/test/function/list_min5__merge_3.mcfunction +1 -2
  652. package/dist/data/test/function/list_min5__merge_5.mcfunction +1 -2
  653. package/dist/data/test/function/list_sort_asc__loop_body_4.mcfunction +1 -2
  654. package/dist/data/test/function/list_sort_asc__loop_header_0.mcfunction +1 -2
  655. package/dist/data/test/function/list_sort_asc__loop_header_3.mcfunction +1 -2
  656. package/dist/data/test/function/list_sort_desc__loop_body_4.mcfunction +1 -2
  657. package/dist/data/test/function/list_sort_desc__loop_header_0.mcfunction +1 -2
  658. package/dist/data/test/function/list_sort_desc__loop_header_3.mcfunction +1 -2
  659. package/dist/data/test/function/max_heap_pop.mcfunction +4 -0
  660. package/dist/data/test/function/max_heap_pop__else_13.mcfunction +2 -0
  661. package/dist/data/test/function/max_heap_pop__loop_body_1.mcfunction +14 -0
  662. package/dist/data/test/function/max_heap_pop__loop_exit_2.mcfunction +1 -0
  663. package/dist/data/test/function/max_heap_pop__loop_header_0.mcfunction +4 -0
  664. package/dist/data/test/function/max_heap_pop__merge_10.mcfunction +1 -0
  665. package/dist/data/test/function/max_heap_pop__merge_12.mcfunction +1 -0
  666. package/dist/data/test/function/max_heap_pop__merge_4.mcfunction +3 -0
  667. package/dist/data/test/function/max_heap_pop__merge_6.mcfunction +1 -0
  668. package/dist/data/test/function/max_heap_pop__merge_8.mcfunction +3 -0
  669. package/dist/data/test/function/max_heap_pop__then_11.mcfunction +2 -0
  670. package/dist/data/test/function/max_heap_pop__then_3.mcfunction +3 -0
  671. package/dist/data/test/function/max_heap_pop__then_5.mcfunction +2 -0
  672. package/dist/data/test/function/max_heap_pop__then_7.mcfunction +3 -0
  673. package/dist/data/test/function/max_heap_pop__then_9.mcfunction +2 -0
  674. package/dist/data/test/function/max_heap_push.mcfunction +6 -0
  675. package/dist/data/test/function/max_heap_push__else_5.mcfunction +2 -0
  676. package/dist/data/test/function/max_heap_push__else_8.mcfunction +2 -0
  677. package/dist/data/test/function/max_heap_push__loop_body_1.mcfunction +4 -0
  678. package/dist/data/test/function/max_heap_push__loop_exit_2.mcfunction +1 -0
  679. package/dist/data/test/function/max_heap_push__loop_header_0.mcfunction +4 -0
  680. package/dist/data/test/function/max_heap_push__merge_4.mcfunction +1 -0
  681. package/dist/data/test/function/max_heap_push__merge_7.mcfunction +1 -0
  682. package/dist/data/test/function/max_heap_push__then_3.mcfunction +7 -0
  683. package/dist/data/test/function/max_heap_push__then_6.mcfunction +2 -0
  684. package/dist/data/test/function/newton_step.mcfunction +7 -0
  685. package/dist/data/test/function/newton_step__merge_1.mcfunction +8 -0
  686. package/dist/data/test/function/newton_step__then_0.mcfunction +1 -0
  687. package/dist/data/test/function/night_vision.mcfunction +1 -0
  688. package/dist/data/test/function/norm3_hp.mcfunction +43 -0
  689. package/dist/data/test/function/normal_approx12.mcfunction +1 -2
  690. package/dist/data/test/function/normal_approx12__merge_1.mcfunction +1 -2
  691. package/dist/data/test/function/normal_approx12__merge_11.mcfunction +1 -2
  692. package/dist/data/test/function/normal_approx12__merge_13.mcfunction +1 -2
  693. package/dist/data/test/function/normal_approx12__merge_15.mcfunction +1 -2
  694. package/dist/data/test/function/normal_approx12__merge_17.mcfunction +1 -2
  695. package/dist/data/test/function/normal_approx12__merge_19.mcfunction +1 -2
  696. package/dist/data/test/function/normal_approx12__merge_21.mcfunction +1 -2
  697. package/dist/data/test/function/normal_approx12__merge_3.mcfunction +1 -2
  698. package/dist/data/test/function/normal_approx12__merge_5.mcfunction +1 -2
  699. package/dist/data/test/function/normal_approx12__merge_7.mcfunction +1 -2
  700. package/dist/data/test/function/normal_approx12__merge_9.mcfunction +1 -2
  701. package/dist/data/test/function/on_double_sneak.mcfunction +1 -0
  702. package/dist/data/test/function/on_double_sneak__foreach_t0.mcfunction +9 -0
  703. package/dist/data/test/function/on_double_sneak__foreach_t0__merge_1.mcfunction +1 -0
  704. package/dist/data/test/function/on_double_sneak__foreach_t0__merge_3.mcfunction +2 -0
  705. package/dist/data/test/function/on_double_sneak__foreach_t0__then_0.mcfunction +6 -0
  706. package/dist/data/test/function/on_double_sneak__foreach_t0__then_2.mcfunction +2 -0
  707. package/dist/data/test/function/on_right_click.mcfunction +1 -0
  708. package/dist/data/test/function/on_right_click__foreach_t1.mcfunction +5 -0
  709. package/dist/data/test/function/on_right_click__foreach_t1__merge_1.mcfunction +1 -0
  710. package/dist/data/test/function/on_right_click__foreach_t1__then_0.mcfunction +3 -0
  711. package/dist/data/test/function/on_sneak_click.mcfunction +1 -0
  712. package/dist/data/test/function/on_sneak_click__foreach_t0.mcfunction +7 -0
  713. package/dist/data/test/function/on_sneak_click__foreach_t0__else_4.mcfunction +3 -0
  714. package/dist/data/test/function/on_sneak_click__foreach_t0__merge_1.mcfunction +1 -0
  715. package/dist/data/test/function/on_sneak_click__foreach_t0__merge_3.mcfunction +1 -0
  716. package/dist/data/test/function/on_sneak_click__foreach_t0__then_0.mcfunction +4 -0
  717. package/dist/data/test/function/on_sneak_click__foreach_t0__then_2.mcfunction +3 -0
  718. package/dist/data/test/function/on_sneak_start.mcfunction +1 -0
  719. package/dist/data/test/function/on_sneak_start__foreach_t0.mcfunction +5 -0
  720. package/dist/data/test/function/on_sneak_start__foreach_t0__else_2.mcfunction +2 -0
  721. package/dist/data/test/function/on_sneak_start__foreach_t0__merge_1.mcfunction +1 -0
  722. package/dist/data/test/function/on_sneak_start__foreach_t0__then_0.mcfunction +2 -0
  723. package/dist/data/test/function/particle_at_fx.mcfunction +1 -0
  724. package/dist/data/test/function/particle_dot.mcfunction +1 -0
  725. package/dist/data/test/function/pathfind_bfs.mcfunction +11 -0
  726. package/dist/data/test/function/pathfind_bfs__else_33.mcfunction +4 -0
  727. package/dist/data/test/function/pathfind_bfs__else_8.mcfunction +19 -0
  728. package/dist/data/test/function/pathfind_bfs__loop_body_1.mcfunction +10 -0
  729. package/dist/data/test/function/pathfind_bfs__loop_body_29.mcfunction +6 -0
  730. package/dist/data/test/function/pathfind_bfs__loop_body_35.mcfunction +9 -0
  731. package/dist/data/test/function/pathfind_bfs__loop_body_4.mcfunction +9 -0
  732. package/dist/data/test/function/pathfind_bfs__loop_exit_2.mcfunction +24 -0
  733. package/dist/data/test/function/pathfind_bfs__loop_exit_30.mcfunction +6 -0
  734. package/dist/data/test/function/pathfind_bfs__loop_exit_36.mcfunction +1 -0
  735. package/dist/data/test/function/pathfind_bfs__loop_exit_5.mcfunction +6 -0
  736. package/dist/data/test/function/pathfind_bfs__loop_header_0.mcfunction +4 -0
  737. package/dist/data/test/function/pathfind_bfs__loop_header_28.mcfunction +4 -0
  738. package/dist/data/test/function/pathfind_bfs__loop_header_3.mcfunction +3 -0
  739. package/dist/data/test/function/pathfind_bfs__loop_header_34.mcfunction +4 -0
  740. package/dist/data/test/function/pathfind_bfs__merge_10.mcfunction +11 -0
  741. package/dist/data/test/function/pathfind_bfs__merge_12.mcfunction +1 -0
  742. package/dist/data/test/function/pathfind_bfs__merge_14.mcfunction +11 -0
  743. package/dist/data/test/function/pathfind_bfs__merge_16.mcfunction +1 -0
  744. package/dist/data/test/function/pathfind_bfs__merge_18.mcfunction +11 -0
  745. package/dist/data/test/function/pathfind_bfs__merge_20.mcfunction +1 -0
  746. package/dist/data/test/function/pathfind_bfs__merge_22.mcfunction +1 -0
  747. package/dist/data/test/function/pathfind_bfs__merge_24.mcfunction +1 -0
  748. package/dist/data/test/function/pathfind_bfs__merge_26.mcfunction +5 -0
  749. package/dist/data/test/function/pathfind_bfs__merge_32.mcfunction +1 -0
  750. package/dist/data/test/function/pathfind_bfs__merge_7.mcfunction +1 -0
  751. package/dist/data/test/function/pathfind_bfs__then_11.mcfunction +15 -0
  752. package/dist/data/test/function/pathfind_bfs__then_13.mcfunction +13 -0
  753. package/dist/data/test/function/pathfind_bfs__then_15.mcfunction +15 -0
  754. package/dist/data/test/function/pathfind_bfs__then_17.mcfunction +13 -0
  755. package/dist/data/test/function/pathfind_bfs__then_19.mcfunction +15 -0
  756. package/dist/data/test/function/pathfind_bfs__then_21.mcfunction +13 -0
  757. package/dist/data/test/function/pathfind_bfs__then_23.mcfunction +15 -0
  758. package/dist/data/test/function/pathfind_bfs__then_25.mcfunction +1 -0
  759. package/dist/data/test/function/pathfind_bfs__then_31.mcfunction +2 -0
  760. package/dist/data/test/function/pathfind_bfs__then_6.mcfunction +3 -0
  761. package/dist/data/test/function/pathfind_bfs__then_9.mcfunction +13 -0
  762. package/dist/data/test/function/pathfind_bfs_coro.mcfunction +1 -0
  763. package/dist/data/test/function/pcg_output.mcfunction +1 -2
  764. package/dist/data/test/function/pf_heuristic.mcfunction +14 -0
  765. package/dist/data/test/function/pf_heuristic__merge_1.mcfunction +4 -0
  766. package/dist/data/test/function/pf_heuristic__merge_3.mcfunction +6 -0
  767. package/dist/data/test/function/pf_heuristic__then_0.mcfunction +4 -0
  768. package/dist/data/test/function/pf_heuristic__then_2.mcfunction +4 -0
  769. package/dist/data/test/function/pf_is_blocked.mcfunction +7 -0
  770. package/dist/data/test/function/pf_is_blocked__merge_1.mcfunction +4 -0
  771. package/dist/data/test/function/pf_is_blocked__merge_10.mcfunction +4 -0
  772. package/dist/data/test/function/pf_is_blocked__merge_4.mcfunction +4 -0
  773. package/dist/data/test/function/pf_is_blocked__merge_7.mcfunction +4 -0
  774. package/dist/data/test/function/pf_is_blocked__then_0.mcfunction +2 -0
  775. package/dist/data/test/function/pf_is_blocked__then_3.mcfunction +2 -0
  776. package/dist/data/test/function/pf_is_blocked__then_6.mcfunction +2 -0
  777. package/dist/data/test/function/pf_is_blocked__then_9.mcfunction +2 -0
  778. package/dist/data/test/function/pf_new_map.mcfunction +4 -0
  779. package/dist/data/test/function/pf_new_map__loop_body_1.mcfunction +7 -0
  780. package/dist/data/test/function/pf_new_map__loop_exit_2.mcfunction +1 -0
  781. package/dist/data/test/function/pf_new_map__loop_header_0.mcfunction +4 -0
  782. package/dist/data/test/function/pf_noop.mcfunction +1 -0
  783. package/dist/data/test/function/pf_pack.mcfunction +8 -0
  784. package/dist/data/test/function/pf_set_blocked.mcfunction +5 -0
  785. package/dist/data/test/function/pf_set_open.mcfunction +5 -0
  786. package/dist/data/test/function/pf_unpack_x.mcfunction +5 -0
  787. package/dist/data/test/function/pf_unpack_z.mcfunction +5 -0
  788. package/dist/data/test/function/popcount__loop_body_1.mcfunction +1 -2
  789. package/dist/data/test/function/popcount__loop_header_0.mcfunction +1 -2
  790. package/dist/data/test/function/portal_effect.mcfunction +1 -0
  791. package/dist/data/test/function/random_bool.mcfunction +1 -2
  792. package/dist/data/test/function/random_range.mcfunction +1 -2
  793. package/dist/data/test/function/regen.mcfunction +1 -0
  794. package/dist/data/test/function/remove_bar.mcfunction +3 -0
  795. package/dist/data/test/function/remove_from_teams.mcfunction +3 -0
  796. package/dist/data/test/function/remove_item.mcfunction +1 -0
  797. package/dist/data/test/function/resistance.mcfunction +1 -0
  798. package/dist/data/test/function/rgb_to_h.mcfunction +1 -2
  799. package/dist/data/test/function/rgb_to_h__merge_1.mcfunction +1 -2
  800. package/dist/data/test/function/rgb_to_h__merge_12.mcfunction +1 -2
  801. package/dist/data/test/function/rgb_to_h__merge_3.mcfunction +1 -2
  802. package/dist/data/test/function/rgb_to_h__merge_5.mcfunction +1 -2
  803. package/dist/data/test/function/rgb_to_h__merge_7.mcfunction +1 -2
  804. package/dist/data/test/function/rgb_to_h__merge_9.mcfunction +1 -2
  805. package/dist/data/test/function/rgb_to_h__then_11.mcfunction +1 -2
  806. package/dist/data/test/function/rgb_to_l.mcfunction +1 -2
  807. package/dist/data/test/function/rgb_to_l__merge_1.mcfunction +1 -2
  808. package/dist/data/test/function/rgb_to_l__merge_3.mcfunction +1 -2
  809. package/dist/data/test/function/rgb_to_l__merge_5.mcfunction +1 -2
  810. package/dist/data/test/function/rgb_to_s.mcfunction +1 -2
  811. package/dist/data/test/function/rgb_to_s__merge_1.mcfunction +1 -2
  812. package/dist/data/test/function/rgb_to_s__merge_3.mcfunction +1 -2
  813. package/dist/data/test/function/rgb_to_s__merge_5.mcfunction +1 -2
  814. package/dist/data/test/function/rgb_to_s__merge_7.mcfunction +1 -2
  815. package/dist/data/test/function/rgb_to_s__merge_9.mcfunction +1 -2
  816. package/dist/data/test/function/riemann_left.mcfunction +6 -0
  817. package/dist/data/test/function/riemann_left__loop_body_1.mcfunction +7 -0
  818. package/dist/data/test/function/riemann_left__loop_exit_2.mcfunction +6 -0
  819. package/dist/data/test/function/riemann_left__loop_header_0.mcfunction +5 -0
  820. package/dist/data/test/function/riemann_mid.mcfunction +6 -0
  821. package/dist/data/test/function/riemann_mid__loop_body_1.mcfunction +7 -0
  822. package/dist/data/test/function/riemann_mid__loop_exit_2.mcfunction +6 -0
  823. package/dist/data/test/function/riemann_mid__loop_header_0.mcfunction +3 -0
  824. package/dist/data/test/function/riemann_right.mcfunction +6 -0
  825. package/dist/data/test/function/riemann_right__loop_body_1.mcfunction +7 -0
  826. package/dist/data/test/function/riemann_right__loop_exit_2.mcfunction +6 -0
  827. package/dist/data/test/function/riemann_right__loop_header_0.mcfunction +3 -0
  828. package/dist/data/test/function/running_m2.mcfunction +16 -0
  829. package/dist/data/test/function/running_mean.mcfunction +7 -0
  830. package/dist/data/test/function/running_mean__merge_1.mcfunction +13 -0
  831. package/dist/data/test/function/running_mean__then_0.mcfunction +1 -0
  832. package/dist/data/test/function/second_deriv.mcfunction +8 -0
  833. package/dist/data/test/function/second_deriv__merge_1.mcfunction +14 -0
  834. package/dist/data/test/function/second_deriv__then_0.mcfunction +2 -0
  835. package/dist/data/test/function/set_day.mcfunction +1 -0
  836. package/dist/data/test/function/set_easy.mcfunction +1 -0
  837. package/dist/data/test/function/set_hard.mcfunction +1 -0
  838. package/dist/data/test/function/set_midnight.mcfunction +1 -0
  839. package/dist/data/test/function/set_night.mcfunction +1 -0
  840. package/dist/data/test/function/set_noon.mcfunction +1 -0
  841. package/dist/data/test/function/set_normal.mcfunction +1 -0
  842. package/dist/data/test/function/set_peaceful.mcfunction +1 -0
  843. package/dist/data/test/function/setup_four_teams.mcfunction +4 -0
  844. package/dist/data/test/function/setup_two_teams.mcfunction +2 -0
  845. package/dist/data/test/function/show_bar.mcfunction +4 -0
  846. package/dist/data/test/function/simpson_step.mcfunction +16 -0
  847. package/dist/data/test/function/sin_hp.mcfunction +4 -2
  848. package/dist/data/test/function/slow_fall.mcfunction +1 -0
  849. package/dist/data/test/function/smoke.mcfunction +1 -0
  850. package/dist/data/test/function/sort2_max.mcfunction +1 -2
  851. package/dist/data/test/function/sort2_min.mcfunction +1 -2
  852. package/dist/data/test/function/sort3.mcfunction +1 -2
  853. package/dist/data/test/function/sort3__merge_1.mcfunction +1 -2
  854. package/dist/data/test/function/sort3__merge_3.mcfunction +1 -2
  855. package/dist/data/test/function/sort3__merge_5.mcfunction +1 -2
  856. package/dist/data/test/function/sort3__merge_7.mcfunction +1 -2
  857. package/dist/data/test/function/sort4.mcfunction +1 -2
  858. package/dist/data/test/function/sort4__merge_1.mcfunction +1 -2
  859. package/dist/data/test/function/sort4__merge_11.mcfunction +1 -2
  860. package/dist/data/test/function/sort4__merge_14.mcfunction +1 -2
  861. package/dist/data/test/function/sort4__merge_3.mcfunction +1 -2
  862. package/dist/data/test/function/sort4__merge_5.mcfunction +1 -2
  863. package/dist/data/test/function/sort4__merge_7.mcfunction +1 -2
  864. package/dist/data/test/function/sort4__merge_9.mcfunction +1 -2
  865. package/dist/data/test/function/sort5.mcfunction +1 -2
  866. package/dist/data/test/function/sort5__merge_1.mcfunction +1 -2
  867. package/dist/data/test/function/sort5__merge_11.mcfunction +1 -2
  868. package/dist/data/test/function/sort5__merge_13.mcfunction +1 -2
  869. package/dist/data/test/function/sort5__merge_15.mcfunction +1 -2
  870. package/dist/data/test/function/sort5__merge_17.mcfunction +1 -2
  871. package/dist/data/test/function/sort5__merge_19.mcfunction +1 -2
  872. package/dist/data/test/function/sort5__merge_22.mcfunction +1 -2
  873. package/dist/data/test/function/sort5__merge_25.mcfunction +1 -2
  874. package/dist/data/test/function/sort5__merge_3.mcfunction +1 -2
  875. package/dist/data/test/function/sort5__merge_5.mcfunction +1 -2
  876. package/dist/data/test/function/sort5__merge_7.mcfunction +1 -2
  877. package/dist/data/test/function/sort5__merge_9.mcfunction +1 -2
  878. package/dist/data/test/function/sort_merge.mcfunction +10 -0
  879. package/dist/data/test/function/sort_merge__else_11.mcfunction +7 -0
  880. package/dist/data/test/function/sort_merge__else_14.mcfunction +2 -0
  881. package/dist/data/test/function/sort_merge__else_5.mcfunction +3 -0
  882. package/dist/data/test/function/sort_merge__else_8.mcfunction +7 -0
  883. package/dist/data/test/function/sort_merge__loop_body_1.mcfunction +3 -0
  884. package/dist/data/test/function/sort_merge__loop_exit_2.mcfunction +1 -0
  885. package/dist/data/test/function/sort_merge__loop_header_0.mcfunction +4 -0
  886. package/dist/data/test/function/sort_merge__merge_10.mcfunction +1 -0
  887. package/dist/data/test/function/sort_merge__merge_13.mcfunction +1 -0
  888. package/dist/data/test/function/sort_merge__merge_4.mcfunction +1 -0
  889. package/dist/data/test/function/sort_merge__merge_7.mcfunction +1 -0
  890. package/dist/data/test/function/sort_merge__then_12.mcfunction +7 -0
  891. package/dist/data/test/function/sort_merge__then_3.mcfunction +3 -0
  892. package/dist/data/test/function/sort_merge__then_6.mcfunction +3 -0
  893. package/dist/data/test/function/sort_merge__then_9.mcfunction +7 -0
  894. package/dist/data/test/function/sparkles_at.mcfunction +1 -0
  895. package/dist/data/test/function/speed.mcfunction +1 -0
  896. package/dist/data/test/function/sphere_contains.mcfunction +1 -2
  897. package/dist/data/test/function/spread_players.mcfunction +1 -0
  898. package/dist/data/test/function/sqrt_fx.mcfunction +5 -8
  899. package/dist/data/test/function/sqrt_hp.mcfunction +17 -0
  900. package/dist/data/test/function/sqrt_hp__merge_1.mcfunction +21 -0
  901. package/dist/data/test/function/sqrt_hp__then_0.mcfunction +2 -0
  902. package/dist/data/test/function/std_dev_approx.mcfunction +5 -0
  903. package/dist/data/test/function/std_dev_approx__merge_1.mcfunction +13 -0
  904. package/dist/data/test/function/std_dev_approx__then_0.mcfunction +2 -0
  905. package/dist/data/test/function/str_len.mcfunction +2 -0
  906. package/dist/data/test/function/strength.mcfunction +1 -0
  907. package/dist/data/test/function/t.mcfunction +3 -0
  908. package/dist/data/test/function/teleport_to.mcfunction +9 -0
  909. package/dist/data/test/function/teleport_to_entity.mcfunction +5 -0
  910. package/dist/data/test/function/test.mcfunction +5 -0
  911. package/dist/data/test/function/test__loop_body_1.mcfunction +9 -0
  912. package/dist/data/test/function/test__loop_exit_2.mcfunction +1 -0
  913. package/dist/data/test/function/test__loop_header_0.mcfunction +3 -0
  914. package/dist/data/test/function/tile_of.mcfunction +1 -2
  915. package/dist/data/test/function/timer/done.mcfunction +1 -2
  916. package/dist/data/test/function/timer/remaining.mcfunction +1 -2
  917. package/dist/data/test/function/timer/tick.mcfunction +1 -2
  918. package/dist/data/test/function/timer/tick__then_0.mcfunction +1 -2
  919. package/dist/data/test/function/totem_at.mcfunction +1 -0
  920. package/dist/data/test/function/trapezoid_step.mcfunction +11 -0
  921. package/dist/data/test/function/uniform_frac.mcfunction +1 -2
  922. package/dist/data/test/function/uniform_int.mcfunction +1 -2
  923. package/dist/data/test/function/update_bar.mcfunction +5 -0
  924. package/dist/data/test/function/update_bar_color.mcfunction +6 -0
  925. package/dist/data/test/function/update_bar_color__else_2.mcfunction +4 -0
  926. package/dist/data/test/function/update_bar_color__else_5.mcfunction +4 -0
  927. package/dist/data/test/function/update_bar_color__merge_1.mcfunction +1 -0
  928. package/dist/data/test/function/update_bar_color__merge_4.mcfunction +1 -0
  929. package/dist/data/test/function/update_bar_color__then_0.mcfunction +4 -0
  930. package/dist/data/test/function/update_bar_color__then_3.mcfunction +4 -0
  931. package/dist/data/test/function/value_noise_1d.mcfunction +1 -2
  932. package/dist/data/test/function/value_noise_2d.mcfunction +1 -2
  933. package/dist/data/test/function/value_noise_2d__merge_1.mcfunction +1 -2
  934. package/dist/data/test/function/variance_from_m2.mcfunction +6 -0
  935. package/dist/data/test/function/variance_from_m2__merge_1.mcfunction +5 -0
  936. package/dist/data/test/function/variance_from_m2__then_0.mcfunction +2 -0
  937. package/dist/data/test/function/weapon_damage.mcfunction +5 -0
  938. package/dist/data/test/function/weather_clear.mcfunction +1 -0
  939. package/dist/data/test/function/weather_rain.mcfunction +1 -0
  940. package/dist/data/test/function/weather_thunder.mcfunction +1 -0
  941. package/dist/data/test/function/weighted2.mcfunction +1 -2
  942. package/dist/data/test/function/weighted2__merge_1.mcfunction +1 -2
  943. package/dist/data/test/function/weighted3.mcfunction +1 -2
  944. package/dist/data/test/function/weighted3__merge_1.mcfunction +1 -2
  945. package/dist/data/test/function/weighted3__merge_3.mcfunction +1 -2
  946. package/dist/data/test_dmul/function/__double_mul_macro.mcfunction +1 -0
  947. package/dist/data/test_dmul/function/double_mul_fixed.mcfunction +6 -0
  948. package/dist/data/test_dmul/function/load.mcfunction +1 -0
  949. package/dist/data/test_double_fn/function/double_test.mcfunction +2 -0
  950. package/dist/data/test_double_fn/function/load.mcfunction +1 -0
  951. package/dist/data/test_double_fn2/function/double_test.mcfunction +2 -0
  952. package/dist/data/test_double_fn2/function/load.mcfunction +1 -0
  953. package/dist/data/test_double_pass/function/caller_fn.mcfunction +4 -0
  954. package/dist/data/test_double_pass/function/consume_double.mcfunction +2 -0
  955. package/dist/data/test_double_pass/function/load.mcfunction +1 -0
  956. package/dist/data/test_macro/function/load.mcfunction +1 -0
  957. package/dist/data/test_macro/function/macro_helper.mcfunction +1 -0
  958. package/dist/data/test_macro3/function/__dmul_macro.mcfunction +1 -0
  959. package/dist/data/test_macro3/function/double_mul_test.mcfunction +7 -0
  960. package/dist/data/test_macro3/function/load.mcfunction +1 -0
  961. package/dist/data/test_ret_double/function/load.mcfunction +1 -0
  962. package/dist/data/test_ret_double/function/make_double.mcfunction +3 -0
  963. package/dist/data/test_ret_double/function/use_it.mcfunction +3 -0
  964. package/dist/pack.mcmeta +1 -1
  965. package/dist/src/__tests__/array-dynamic.test.js +42 -0
  966. package/dist/src/__tests__/builtins.test.d.ts +1 -0
  967. package/dist/src/__tests__/builtins.test.js +55 -0
  968. package/dist/src/__tests__/compile-all.test.js +1 -0
  969. package/dist/src/__tests__/diagnostics.test.js +8 -11
  970. package/dist/src/__tests__/double.test.d.ts +7 -0
  971. package/dist/src/__tests__/double.test.js +464 -0
  972. package/dist/src/__tests__/e2e/ecs-stdlib.test.d.ts +7 -0
  973. package/dist/src/__tests__/e2e/ecs-stdlib.test.js +328 -0
  974. package/dist/src/__tests__/e2e/events-stdlib.test.d.ts +1 -0
  975. package/dist/src/__tests__/e2e/events-stdlib.test.js +81 -0
  976. package/dist/src/__tests__/e2e/fft-stdlib.test.d.ts +13 -0
  977. package/dist/src/__tests__/e2e/fft-stdlib.test.js +288 -0
  978. package/dist/src/__tests__/e2e/for-in-array.test.d.ts +4 -0
  979. package/dist/src/__tests__/e2e/for-in-array.test.js +59 -0
  980. package/dist/src/__tests__/e2e/macros.test.js +7 -7
  981. package/dist/src/__tests__/e2e/ode-stdlib.test.d.ts +1 -0
  982. package/dist/src/__tests__/e2e/ode-stdlib.test.js +91 -0
  983. package/dist/src/__tests__/e2e/stdlib-e2e.test.js +1616 -0
  984. package/dist/src/__tests__/emit/compile.test.d.ts +1 -0
  985. package/dist/src/__tests__/emit/compile.test.js +95 -0
  986. package/dist/src/__tests__/emit/index.test.d.ts +1 -0
  987. package/dist/src/__tests__/emit/index.test.js +180 -0
  988. package/dist/src/__tests__/emit/modules-extra.test.d.ts +1 -0
  989. package/dist/src/__tests__/emit/modules-extra.test.js +77 -0
  990. package/dist/src/__tests__/enum.test.js +4 -6
  991. package/dist/src/__tests__/fixed.test.d.ts +7 -0
  992. package/dist/src/__tests__/fixed.test.js +148 -0
  993. package/dist/src/__tests__/float-lint.test.d.ts +7 -0
  994. package/dist/src/__tests__/float-lint.test.js +96 -0
  995. package/dist/src/__tests__/float.test.d.ts +7 -0
  996. package/dist/src/__tests__/float.test.js +148 -0
  997. package/dist/src/__tests__/for-each.test.d.ts +1 -0
  998. package/dist/src/__tests__/for-each.test.js +125 -0
  999. package/dist/src/__tests__/for-range.test.d.ts +1 -0
  1000. package/dist/src/__tests__/for-range.test.js +136 -0
  1001. package/dist/src/__tests__/generics.test.js +4 -4
  1002. package/dist/src/__tests__/impl.test.d.ts +1 -0
  1003. package/dist/src/__tests__/impl.test.js +199 -0
  1004. package/dist/src/__tests__/lsp-logic.test.d.ts +1 -0
  1005. package/dist/src/__tests__/lsp-logic.test.js +145 -0
  1006. package/dist/src/__tests__/match.test.d.ts +10 -0
  1007. package/dist/src/__tests__/match.test.js +197 -0
  1008. package/dist/src/__tests__/mc-integration/item-entity-events.test.d.ts +18 -0
  1009. package/dist/src/__tests__/mc-integration/item-entity-events.test.js +287 -0
  1010. package/dist/src/__tests__/mc-integration/stdlib-coverage-2.test.d.ts +13 -0
  1011. package/dist/src/__tests__/mc-integration/stdlib-coverage-2.test.js +833 -0
  1012. package/dist/src/__tests__/mc-integration/stdlib-coverage.test.d.ts +13 -0
  1013. package/dist/src/__tests__/mc-integration/stdlib-coverage.test.js +707 -0
  1014. package/dist/src/__tests__/mc-integration/syntax-coverage.test.d.ts +9 -0
  1015. package/dist/src/__tests__/mc-integration/syntax-coverage.test.js +442 -0
  1016. package/dist/src/__tests__/mc-integration.test.js +835 -5
  1017. package/dist/src/__tests__/optimizer/constant_fold.test.js +105 -0
  1018. package/dist/src/__tests__/optimizer/coroutine.test.js +3 -2
  1019. package/dist/src/__tests__/parser.test.js +5 -5
  1020. package/dist/src/__tests__/runtime.test.js +143 -238
  1021. package/dist/src/__tests__/stdlib/arr-len.test.d.ts +13 -0
  1022. package/dist/src/__tests__/stdlib/arr-len.test.js +195 -0
  1023. package/dist/src/__tests__/stdlib/calculus.test.d.ts +5 -0
  1024. package/dist/src/__tests__/stdlib/calculus.test.js +123 -0
  1025. package/dist/src/__tests__/stdlib/dialog.test.d.ts +6 -0
  1026. package/dist/src/__tests__/stdlib/dialog.test.js +142 -0
  1027. package/dist/src/__tests__/stdlib/easing.test.d.ts +5 -0
  1028. package/dist/src/__tests__/stdlib/easing.test.js +117 -0
  1029. package/dist/src/__tests__/stdlib/geometry.test.d.ts +5 -0
  1030. package/dist/src/__tests__/stdlib/geometry.test.js +163 -0
  1031. package/dist/src/__tests__/stdlib/heap.test.d.ts +4 -0
  1032. package/dist/src/__tests__/stdlib/heap.test.js +141 -0
  1033. package/dist/src/__tests__/stdlib/list.test.d.ts +5 -0
  1034. package/dist/src/__tests__/stdlib/list.test.js +134 -0
  1035. package/dist/src/__tests__/stdlib/matrix.test.d.ts +5 -0
  1036. package/dist/src/__tests__/stdlib/matrix.test.js +148 -0
  1037. package/dist/src/__tests__/stdlib/pathfind.test.d.ts +4 -0
  1038. package/dist/src/__tests__/stdlib/pathfind.test.js +167 -0
  1039. package/dist/src/__tests__/stdlib/scheduler.test.d.ts +6 -0
  1040. package/dist/src/__tests__/stdlib/scheduler.test.js +177 -0
  1041. package/dist/src/__tests__/stdlib/sort-v2.test.d.ts +4 -0
  1042. package/dist/src/__tests__/stdlib/sort-v2.test.js +131 -0
  1043. package/dist/src/__tests__/stdlib/sort.test.d.ts +4 -0
  1044. package/dist/src/__tests__/stdlib/sort.test.js +128 -0
  1045. package/dist/src/__tests__/stdlib/state.test.d.ts +5 -0
  1046. package/dist/src/__tests__/stdlib/state.test.js +176 -0
  1047. package/dist/src/__tests__/typechecker-strict.test.js +21 -21
  1048. package/dist/src/__tests__/typechecker.test.js +5 -3
  1049. package/dist/src/ast/types.d.ts +28 -2
  1050. package/dist/src/emit/compile.js +30 -3
  1051. package/dist/src/emit/index.d.ts +2 -0
  1052. package/dist/src/emit/index.js +20 -1
  1053. package/dist/src/emit/modules.js +3 -2
  1054. package/dist/src/events/types.d.ts +1 -1
  1055. package/dist/src/events/types.js +5 -2
  1056. package/dist/src/hir/lower.js +88 -2
  1057. package/dist/src/hir/monomorphize.js +11 -5
  1058. package/dist/src/hir/types.d.ts +20 -1
  1059. package/dist/src/lexer/index.d.ts +1 -1
  1060. package/dist/src/lexer/index.js +10 -1
  1061. package/dist/src/lir/lower.js +7 -0
  1062. package/dist/src/lsp/server.js +912 -56
  1063. package/dist/src/mc-test/client.d.ts +13 -1
  1064. package/dist/src/mc-test/client.js +29 -1
  1065. package/dist/src/mir/lower.js +703 -74
  1066. package/dist/src/mir/types.d.ts +5 -0
  1067. package/dist/src/mir/verify.js +2 -0
  1068. package/dist/src/optimizer/constant_fold.js +10 -6
  1069. package/dist/src/optimizer/coroutine.js +90 -33
  1070. package/dist/src/optimizer/interprocedural.js +4 -0
  1071. package/dist/src/parser/index.d.ts +5 -0
  1072. package/dist/src/parser/index.js +171 -39
  1073. package/dist/src/runtime/index.js +24 -0
  1074. package/dist/src/typechecker/index.d.ts +8 -1
  1075. package/dist/src/typechecker/index.js +73 -14
  1076. package/docs/LANGUAGE_REFERENCE.md +302 -67
  1077. package/docs/stdlib/README.md +54 -0
  1078. package/docs/stdlib/advanced.md +276 -0
  1079. package/docs/stdlib/bigint.md +285 -0
  1080. package/docs/stdlib/bits.md +159 -0
  1081. package/docs/stdlib/bossbar.md +101 -0
  1082. package/docs/stdlib/calculus.md +141 -0
  1083. package/docs/stdlib/color.md +125 -0
  1084. package/docs/stdlib/combat.md +41 -0
  1085. package/docs/stdlib/cooldown.md +48 -0
  1086. package/docs/stdlib/easing.md +157 -0
  1087. package/docs/stdlib/effects.md +101 -0
  1088. package/docs/stdlib/expr.md +38 -0
  1089. package/docs/stdlib/geometry.md +130 -0
  1090. package/docs/stdlib/interactions.md +111 -0
  1091. package/docs/stdlib/inventory.md +53 -0
  1092. package/docs/stdlib/list.md +189 -0
  1093. package/docs/stdlib/math.md +334 -0
  1094. package/docs/stdlib/math_hp.md +185 -0
  1095. package/docs/stdlib/matrix.md +123 -0
  1096. package/docs/stdlib/mobs.md +131 -0
  1097. package/docs/stdlib/noise.md +103 -0
  1098. package/docs/stdlib/parabola.md +119 -0
  1099. package/docs/stdlib/particles.md +123 -0
  1100. package/docs/stdlib/physics.md +148 -0
  1101. package/docs/stdlib/player.md +43 -0
  1102. package/docs/stdlib/quaternion.md +159 -0
  1103. package/docs/stdlib/random.md +86 -0
  1104. package/docs/stdlib/sets.md +68 -0
  1105. package/docs/stdlib/signal.md +141 -0
  1106. package/docs/stdlib/spawn.md +65 -0
  1107. package/docs/stdlib/strings.md +17 -0
  1108. package/docs/stdlib/tags.md +117 -0
  1109. package/docs/stdlib/teams.md +87 -0
  1110. package/docs/stdlib/timer.md +126 -0
  1111. package/docs/stdlib/vec.md +193 -0
  1112. package/docs/stdlib/world.md +151 -0
  1113. package/editors/vscode/build.mjs +31 -12
  1114. package/editors/vscode/out/extension.js +3670 -200
  1115. package/editors/vscode/out/lsp-server.js +14854 -0
  1116. package/editors/vscode/package-lock.json +3 -3
  1117. package/editors/vscode/package.json +1 -1
  1118. package/editors/vscode/snippets/redscript.json +109 -30
  1119. package/editors/vscode/src/extension.ts +15 -13
  1120. package/examples/readme-demo.mcrs +4 -4
  1121. package/jest.config.js +5 -2
  1122. package/package.json +1 -1
  1123. package/scripts/postbuild.js +20 -0
  1124. package/src/__tests__/array-dynamic.test.ts +42 -0
  1125. package/src/__tests__/builtins.test.ts +66 -0
  1126. package/src/__tests__/compile-all.test.ts +3 -2
  1127. package/src/__tests__/diagnostics.test.ts +8 -10
  1128. package/src/__tests__/double.test.ts +478 -0
  1129. package/src/__tests__/e2e/ecs-stdlib.test.ts +371 -0
  1130. package/src/__tests__/e2e/events-stdlib.test.ts +50 -0
  1131. package/src/__tests__/e2e/fft-stdlib.test.ts +313 -0
  1132. package/src/__tests__/e2e/macros.test.ts +7 -7
  1133. package/src/__tests__/e2e/ode-stdlib.test.ts +68 -0
  1134. package/src/__tests__/e2e/stdlib-e2e.test.ts +1952 -0
  1135. package/src/__tests__/emit/compile.test.ts +102 -0
  1136. package/src/__tests__/emit/index.test.ts +189 -0
  1137. package/src/__tests__/emit/modules-extra.test.ts +80 -0
  1138. package/src/__tests__/enum.test.ts +4 -6
  1139. package/src/__tests__/fixed.test.ts +159 -0
  1140. package/src/__tests__/fixtures/coroutine-mc-test.mcrs +58 -0
  1141. package/src/__tests__/fixtures/for-range.mcrs +15 -0
  1142. package/src/__tests__/fixtures/heap-sort-mc-test.mcrs +87 -0
  1143. package/src/__tests__/fixtures/impl-test.mcrs +13 -44
  1144. package/src/__tests__/fixtures/stdlib-extra-test.mcrs +226 -0
  1145. package/src/__tests__/fixtures/stdlib-math-integration.mcrs +28 -0
  1146. package/src/__tests__/fixtures/stdlib-math-test.mcrs +53 -0
  1147. package/src/__tests__/float-lint.test.ts +102 -0
  1148. package/src/__tests__/float.test.ts +158 -0
  1149. package/src/__tests__/for-each.test.ts +135 -0
  1150. package/src/__tests__/for-range.test.ts +149 -0
  1151. package/src/__tests__/generics.test.ts +4 -4
  1152. package/src/__tests__/impl.test.ts +207 -0
  1153. package/src/__tests__/lsp-logic.test.ts +162 -0
  1154. package/src/__tests__/match.test.ts +212 -0
  1155. package/src/__tests__/mc-integration/item-entity-events.test.ts +298 -0
  1156. package/src/__tests__/mc-integration/stdlib-coverage-2.test.ts +817 -0
  1157. package/src/__tests__/mc-integration/stdlib-coverage.test.ts +699 -0
  1158. package/src/__tests__/mc-integration/syntax-coverage.test.ts +464 -0
  1159. package/src/__tests__/mc-integration.test.ts +889 -5
  1160. package/src/__tests__/optimizer/constant_fold.test.ts +115 -0
  1161. package/src/__tests__/optimizer/coroutine.test.ts +3 -2
  1162. package/src/__tests__/parser.test.ts +5 -5
  1163. package/src/__tests__/runtime.test.ts +194 -0
  1164. package/src/__tests__/stdlib/arr-len.test.ts +231 -0
  1165. package/src/__tests__/stdlib/calculus.test.ts +99 -0
  1166. package/src/__tests__/stdlib/dialog.test.ts +132 -0
  1167. package/src/__tests__/stdlib/easing.test.ts +97 -0
  1168. package/src/__tests__/stdlib/geometry.test.ts +171 -0
  1169. package/src/__tests__/stdlib/heap.test.ts +121 -0
  1170. package/src/__tests__/stdlib/list.test.ts +117 -0
  1171. package/src/__tests__/stdlib/matrix.test.ts +140 -0
  1172. package/src/__tests__/stdlib/pathfind.test.ts +151 -0
  1173. package/src/__tests__/stdlib/scheduler.test.ts +171 -0
  1174. package/src/__tests__/stdlib/sort-v2.test.ts +111 -0
  1175. package/src/__tests__/stdlib/sort.test.ts +106 -0
  1176. package/src/__tests__/stdlib/state.test.ts +164 -0
  1177. package/src/__tests__/typechecker-strict.test.ts +21 -21
  1178. package/src/__tests__/typechecker.test.ts +5 -3
  1179. package/src/ast/types.ts +16 -3
  1180. package/src/emit/compile.ts +32 -3
  1181. package/src/emit/index.ts +24 -1
  1182. package/src/emit/modules.ts +2 -1
  1183. package/src/events/types.ts +5 -2
  1184. package/src/examples/capture_the_flag.mcrs +2 -2
  1185. package/src/examples/hunger_games.mcrs +4 -4
  1186. package/src/examples/parkour_race.mcrs +8 -8
  1187. package/src/examples/tutorial_01_hello.mcrs +63 -0
  1188. package/src/examples/tutorial_02_variables.mcrs +157 -0
  1189. package/src/examples/tutorial_03_functions_structs.mcrs +162 -0
  1190. package/src/examples/tutorial_04_selectors.mcrs +139 -0
  1191. package/src/examples/tutorial_05_decorators.mcrs +131 -0
  1192. package/src/examples/tutorial_06_math_particles.mcrs +123 -0
  1193. package/src/examples/tutorial_07_random.mcrs +142 -0
  1194. package/src/examples/tutorial_08_coroutine.mcrs +163 -0
  1195. package/src/examples/tutorial_09_precision.mcrs +154 -0
  1196. package/src/examples/tutorial_10_kill_race.mcrs +289 -0
  1197. package/src/examples/zombie_survival.mcrs +7 -7
  1198. package/src/hir/lower.ts +101 -4
  1199. package/src/hir/monomorphize.ts +11 -6
  1200. package/src/hir/types.ts +14 -1
  1201. package/src/lexer/index.ts +11 -2
  1202. package/src/lir/lower.ts +8 -0
  1203. package/src/lsp/server.ts +894 -54
  1204. package/src/mc-test/client.ts +32 -1
  1205. package/src/mir/lower.ts +703 -74
  1206. package/src/mir/types.ts +1 -0
  1207. package/src/mir/verify.ts +2 -0
  1208. package/src/optimizer/constant_fold.ts +11 -6
  1209. package/src/optimizer/coroutine.ts +89 -29
  1210. package/src/optimizer/interprocedural.ts +4 -0
  1211. package/src/parser/index.ts +175 -41
  1212. package/src/runtime/index.ts +26 -0
  1213. package/src/stdlib/advanced.mcrs +47 -0
  1214. package/src/stdlib/bigint.mcrs +251 -0
  1215. package/src/stdlib/calculus.mcrs +150 -0
  1216. package/src/stdlib/color.mcrs +102 -82
  1217. package/src/stdlib/combat.mcrs +18 -12
  1218. package/src/stdlib/dialog.mcrs +55 -0
  1219. package/src/stdlib/ecs.mcrs +238 -0
  1220. package/src/stdlib/events.mcrs +29 -0
  1221. package/src/stdlib/expr.mcrs +117 -0
  1222. package/src/stdlib/fft.mcrs +177 -0
  1223. package/src/stdlib/geometry.mcrs +89 -0
  1224. package/src/stdlib/graph.mcrs +274 -0
  1225. package/src/stdlib/heap.mcrs +175 -0
  1226. package/src/stdlib/linalg.mcrs +260 -0
  1227. package/src/stdlib/list.mcrs +99 -0
  1228. package/src/stdlib/math.mcrs +121 -5
  1229. package/src/stdlib/math_hp.mcrs +452 -0
  1230. package/src/stdlib/matrix.mcrs +113 -0
  1231. package/src/stdlib/ode.mcrs +168 -0
  1232. package/src/stdlib/parabola.mcrs +160 -0
  1233. package/src/stdlib/particles.mcrs +69 -0
  1234. package/src/stdlib/pathfind.mcrs +321 -0
  1235. package/src/stdlib/quaternion.mcrs +192 -0
  1236. package/src/stdlib/random.mcrs +46 -1
  1237. package/src/stdlib/scheduler.mcrs +271 -0
  1238. package/src/stdlib/signal.mcrs +223 -0
  1239. package/src/stdlib/sort.mcrs +194 -0
  1240. package/src/stdlib/state.mcrs +65 -0
  1241. package/src/stdlib/world.mcrs +24 -0
  1242. package/src/typechecker/index.ts +88 -15
  1243. package/test_trig.ts +43 -0
@@ -102,6 +102,11 @@ class FnContext {
102
102
  this.sourceFile = undefined;
103
103
  /** Tracks temps whose values are known compile-time constants (for Timer static ID propagation) */
104
104
  this.constTemps = new Map();
105
+ /** Tracks temps that hold fixed (×10000 fixed-point) values — for mul/div scale correction */
106
+ this.floatTemps = new Set();
107
+ /** Tracks double variables: varName → NBT storage path (without "rs:d " prefix) */
108
+ this.doubleVars = new Map();
109
+ this.doubleVarCount = 0;
105
110
  /** HIR function definitions for array-arg monomorphization */
106
111
  this.hirFunctions = new Map();
107
112
  /** Shared registry of already-generated specialized (monomorphized) MIR functions */
@@ -167,6 +172,12 @@ class FnContext {
167
172
  getFnName() {
168
173
  return this.fnName;
169
174
  }
175
+ /** Allocate a unique NBT storage path for a double variable */
176
+ freshDoubleVar(varName) {
177
+ const path = `${this.namespace}_${this.fnName}_${varName}_${this.doubleVarCount++}`;
178
+ this.doubleVars.set(varName, path);
179
+ return path;
180
+ }
170
181
  }
171
182
  // ---------------------------------------------------------------------------
172
183
  // Function lowering
@@ -195,13 +206,22 @@ overrideName) {
195
206
  }
196
207
  }
197
208
  // Create temps for parameters, skipping array-type params that are pre-bound
209
+ // and double-type params (which are passed via NBT __dp<i> slots instead of scoreboard)
198
210
  const params = [];
199
211
  const scope = new Map();
212
+ let doubleParamSlot = 0;
200
213
  fn.params.forEach((p) => {
201
214
  if (p.type.kind === 'array' && arrayArgBindings?.has(p.name)) {
202
215
  // Array param already bound via arrayVars; no scoreboard slot needed
203
216
  return;
204
217
  }
218
+ if (p.type.kind === 'named' && p.type.name === 'double') {
219
+ // double param: passed via NBT storage rs:d __dp<i> instead of scoreboard
220
+ const path = `__dp${doubleParamSlot++}`;
221
+ ctx.doubleVars.set(p.name, path);
222
+ // No scoreboard param slot; callee reads from rs:d __dp<i> via doubleVars
223
+ return;
224
+ }
205
225
  const t = ctx.freshTemp();
206
226
  params.push({ name: t, isMacroParam: fnMacroInfo?.macroParams.has(p.name) ?? false });
207
227
  scope.set(p.name, t);
@@ -243,19 +263,49 @@ function lowerImplMethod(method, typeName, namespace, structDefs, implMethods, m
243
263
  selfFields.set(fieldName, t);
244
264
  }
245
265
  ctx.structVars.set('self', { typeName, fields: selfFields });
246
- // Remaining params (after self)
266
+ // Remaining params (after self) — struct params get one slot per field
247
267
  for (let i = 1; i < method.params.length; i++) {
248
- const t = ctx.freshTemp();
249
- params.push({ name: t, isMacroParam: false });
250
- scope.set(method.params[i].name, t);
268
+ const p = method.params[i];
269
+ const paramTypeName = p.type.kind === 'named' ? p.type.name
270
+ : p.type.kind === 'struct' ? p.type.name : null;
271
+ const paramFields = paramTypeName ? ctx.structDefs.get(paramTypeName) : null;
272
+ if (paramFields && paramFields.length > 0) {
273
+ // Struct param: one slot per field, register as structVar
274
+ const paramFieldTemps = new Map();
275
+ for (const fieldName of paramFields) {
276
+ const t = ctx.freshTemp();
277
+ params.push({ name: t, isMacroParam: false });
278
+ paramFieldTemps.set(fieldName, t);
279
+ }
280
+ ctx.structVars.set(p.name, { typeName: paramTypeName, fields: paramFieldTemps });
281
+ }
282
+ else {
283
+ const t = ctx.freshTemp();
284
+ params.push({ name: t, isMacroParam: false });
285
+ scope.set(p.name, t);
286
+ }
251
287
  }
252
288
  }
253
289
  else {
254
- // Static method — regular params
290
+ // Static method — regular params (struct params get one slot per field)
255
291
  for (const p of method.params) {
256
- const t = ctx.freshTemp();
257
- params.push({ name: t, isMacroParam: false });
258
- scope.set(p.name, t);
292
+ const paramTypeName = p.type.kind === 'named' ? p.type.name
293
+ : p.type.kind === 'struct' ? p.type.name : null;
294
+ const paramFields = paramTypeName ? ctx.structDefs.get(paramTypeName) : null;
295
+ if (paramFields && paramFields.length > 0) {
296
+ const paramFieldTemps = new Map();
297
+ for (const fieldName of paramFields) {
298
+ const t = ctx.freshTemp();
299
+ params.push({ name: t, isMacroParam: false });
300
+ paramFieldTemps.set(fieldName, t);
301
+ }
302
+ ctx.structVars.set(p.name, { typeName: paramTypeName, fields: paramFieldTemps });
303
+ }
304
+ else {
305
+ const t = ctx.freshTemp();
306
+ params.push({ name: t, isMacroParam: false });
307
+ scope.set(p.name, t);
308
+ }
259
309
  }
260
310
  }
261
311
  lowerBlock(method.body, ctx, scope);
@@ -359,10 +409,30 @@ function lowerStmt(stmt, ctx, scope) {
359
409
  const typeName = (stmt.type?.kind === 'struct') ? stmt.type.name : '__anon';
360
410
  const fieldTemps = new Map();
361
411
  for (const field of stmt.init.fields) {
362
- const val = lowerExpr(field.value, ctx, scope);
363
- const t = ctx.freshTemp();
364
- ctx.emit({ kind: 'copy', dst: t, src: val });
365
- fieldTemps.set(field.name, t);
412
+ if (field.value.kind === 'struct_lit') {
413
+ // Nested struct literal: register it as a synthetic var "${parentName}.${fieldName}"
414
+ // so that chained access like r.pos.x can be resolved
415
+ const nestedVarName = `${stmt.name}.${field.name}`;
416
+ const nestedTypeName = '__anon';
417
+ const nestedFieldTemps = new Map();
418
+ for (const nestedField of field.value.fields) {
419
+ const nval = lowerExpr(nestedField.value, ctx, scope);
420
+ const nt = ctx.freshTemp();
421
+ ctx.emit({ kind: 'copy', dst: nt, src: nval });
422
+ nestedFieldTemps.set(nestedField.name, nt);
423
+ }
424
+ ctx.structVars.set(nestedVarName, { typeName: nestedTypeName, fields: nestedFieldTemps });
425
+ // Store a placeholder temp (0) for the field itself in the parent struct
426
+ const t = ctx.freshTemp();
427
+ ctx.emit({ kind: 'const', dst: t, value: 0 });
428
+ fieldTemps.set(field.name, t);
429
+ }
430
+ else {
431
+ const val = lowerExpr(field.value, ctx, scope);
432
+ const t = ctx.freshTemp();
433
+ ctx.emit({ kind: 'copy', dst: t, src: val });
434
+ fieldTemps.set(field.name, t);
435
+ }
366
436
  }
367
437
  ctx.structVars.set(stmt.name, { typeName, fields: fieldTemps });
368
438
  }
@@ -403,11 +473,32 @@ function lowerStmt(stmt, ctx, scope) {
403
473
  scope.set(stmt.name, t);
404
474
  }
405
475
  }
476
+ else if (stmt.type?.kind === 'named' && stmt.type.name === 'double') {
477
+ // double variable: store in NBT storage rs:d
478
+ const path = ctx.freshDoubleVar(stmt.name);
479
+ const ns = ctx.getNamespace();
480
+ if (stmt.init.kind === 'double_lit') {
481
+ // Store the double literal directly into NBT
482
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage rs:d ${path} set value ${stmt.init.value}d`, args: [] });
483
+ }
484
+ else {
485
+ // Lower init as fixed (×10000) then convert to double in NBT
486
+ const initOp = lowerExpr(stmt.init, ctx, scope);
487
+ const initTemp = ctx.freshTemp();
488
+ ctx.emit({ kind: 'copy', dst: initTemp, src: initOp });
489
+ // execute store result storage rs:d <path> double 0.0001 run scoreboard players get $<t> __<ns>
490
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:execute store result storage rs:d ${path} double 0.0001 run scoreboard players get $${initTemp} __${ns}`, args: [] });
491
+ }
492
+ // Store a placeholder temp in scope (value = 0, not used directly for reads)
493
+ const t = ctx.freshTemp();
494
+ ctx.emit({ kind: 'const', dst: t, value: 0 });
495
+ scope.set(stmt.name, t);
496
+ }
406
497
  else if (stmt.init.kind === 'array_lit') {
407
498
  // Array literal: write to NBT storage, track the var for index access
408
499
  const ns = `${ctx.getNamespace()}:arrays`;
409
500
  const pathPrefix = stmt.name;
410
- ctx.arrayVars.set(stmt.name, { ns, pathPrefix });
501
+ ctx.arrayVars.set(stmt.name, { ns, pathPrefix, knownLen: stmt.init.elements.length });
411
502
  const elems = stmt.init.elements;
412
503
  // Check if all elements are pure integer literals (no side-effects)
413
504
  const allConst = elems.every(e => e.kind === 'int_lit');
@@ -417,14 +508,16 @@ function lowerStmt(stmt, ctx, scope) {
417
508
  ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage ${ns} ${pathPrefix} set value [${vals}]`, args: [] });
418
509
  }
419
510
  else {
420
- // Initialize with zeros, then overwrite dynamic elements
421
- const zeros = elems.map(() => '0').join(', ');
422
- ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage ${ns} ${pathPrefix} set value [${zeros}]`, args: [] });
511
+ // Initialize with known int_lit values (0 for dynamic slots), then overwrite dynamic elements.
512
+ // Using actual int_lit values avoids a bug where non-zero literals (e.g. 10000) would be
513
+ // left as 0 because the nbt_write for pure int_lits was skipped.
514
+ const initVals = elems.map(e => (e.kind === 'int_lit' ? String(e.value) : '0')).join(', ');
515
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage ${ns} ${pathPrefix} set value [${initVals}]`, args: [] });
423
516
  for (let i = 0; i < elems.length; i++) {
517
+ if (elems[i].kind === 'int_lit')
518
+ continue; // already in the init array
424
519
  const elemOp = lowerExpr(elems[i], ctx, scope);
425
- if (elemOp.kind !== 'const' || (elems[i].kind !== 'int_lit')) {
426
- ctx.emit({ kind: 'nbt_write', ns, path: `${pathPrefix}[${i}]`, type: 'int', scale: 1, src: elemOp });
427
- }
520
+ ctx.emit({ kind: 'nbt_write', ns, path: `${pathPrefix}[${i}]`, type: 'int', scale: 1, src: elemOp });
428
521
  }
429
522
  }
430
523
  // Store array length as a temp in scope (for .len access)
@@ -432,11 +525,35 @@ function lowerStmt(stmt, ctx, scope) {
432
525
  ctx.emit({ kind: 'const', dst: lenTemp, value: elems.length });
433
526
  scope.set(stmt.name, lenTemp);
434
527
  }
528
+ else if (stmt.type?.kind === 'array') {
529
+ // int[] variable initialized from a function call (e.g. let h: int[] = heap_new())
530
+ // Register as arrayVar so h[i] / h.push(v) / monomorphization all work correctly.
531
+ // The call returns the array in the caller's own NBT path (same ns:arrays/<name>).
532
+ const ns = `${ctx.getNamespace()}:arrays`;
533
+ const pathPrefix = stmt.name;
534
+ ctx.arrayVars.set(stmt.name, { ns, pathPrefix });
535
+ // Evaluate the init expression (e.g. heap_new() or some function call)
536
+ lowerExpr(stmt.init, ctx, scope);
537
+ // After the call, copy the NBT array from the return path into our own path.
538
+ // By convention array-returning functions write into ns:arrays/<ret> or a __ret path.
539
+ // Here we use 'data modify ... set from storage ns:arrays __ret_array' pattern,
540
+ // but since we don't have a unified return convention for arrays, we rely on
541
+ // monomorphization: the first time heap_push(h, val) is called with h in arrayVars,
542
+ // it will monomorphize correctly.
543
+ // Store a length temp so .length() works.
544
+ const lenTemp = ctx.freshTemp();
545
+ ctx.emit({ kind: 'const', dst: lenTemp, value: 0 });
546
+ scope.set(stmt.name, lenTemp);
547
+ }
435
548
  else {
436
549
  const valOp = lowerExpr(stmt.init, ctx, scope);
437
550
  const t = ctx.freshTemp();
438
551
  ctx.emit({ kind: 'copy', dst: t, src: valOp });
439
552
  scope.set(stmt.name, t);
553
+ // Track fixed-typed temps for mul/div scale correction
554
+ if (stmt.type?.kind === 'named' && (stmt.type.name === 'fixed' || stmt.type.name === 'float')) {
555
+ ctx.floatTemps.add(t);
556
+ }
440
557
  }
441
558
  break;
442
559
  }
@@ -682,45 +799,62 @@ function lowerStmt(stmt, ctx, scope) {
682
799
  }
683
800
  case 'match': {
684
801
  // Lower match as chained if/else
685
- const matchVal = lowerExpr(stmt.expr, ctx, scope);
686
802
  const mergeBlock = ctx.newBlock('match_merge');
803
+ // Determine if any arm uses Option patterns (PatSome / PatNone).
804
+ // If so, resolve the Option has/val slots from the subject ident.
805
+ const hasOptionPats = stmt.arms.some(a => a.pattern.kind === 'PatSome' || a.pattern.kind === 'PatNone');
806
+ // For Option match: resolve has/val temps from subject (must be an ident)
807
+ let optHasOp;
808
+ let optValTemp;
809
+ if (hasOptionPats) {
810
+ if (stmt.expr.kind === 'ident') {
811
+ const sv = ctx.structVars.get(stmt.expr.name);
812
+ if (sv && sv.typeName === '__option') {
813
+ optHasOp = { kind: 'temp', name: sv.fields.get('has') };
814
+ optValTemp = sv.fields.get('val');
815
+ }
816
+ else {
817
+ // Fall back: evaluate and use __rf_has/__rf_val convention
818
+ lowerExpr(stmt.expr, ctx, scope);
819
+ const hasT = ctx.freshTemp();
820
+ const valT = ctx.freshTemp();
821
+ ctx.emit({ kind: 'copy', dst: hasT, src: { kind: 'temp', name: '__rf_has' } });
822
+ ctx.emit({ kind: 'copy', dst: valT, src: { kind: 'temp', name: '__rf_val' } });
823
+ optHasOp = { kind: 'temp', name: hasT };
824
+ optValTemp = valT;
825
+ }
826
+ }
827
+ else {
828
+ lowerExpr(stmt.expr, ctx, scope);
829
+ const hasT = ctx.freshTemp();
830
+ const valT = ctx.freshTemp();
831
+ ctx.emit({ kind: 'copy', dst: hasT, src: { kind: 'temp', name: '__rf_has' } });
832
+ ctx.emit({ kind: 'copy', dst: valT, src: { kind: 'temp', name: '__rf_val' } });
833
+ optHasOp = { kind: 'temp', name: hasT };
834
+ optValTemp = valT;
835
+ }
836
+ }
837
+ // For non-option match, evaluate the subject once
838
+ const matchVal = hasOptionPats
839
+ ? optHasOp // unused for non-option path
840
+ : lowerExpr(stmt.expr, ctx, scope);
687
841
  for (let i = 0; i < stmt.arms.length; i++) {
688
842
  const arm = stmt.arms[i];
689
- if (arm.pattern === null) {
690
- // Default arm just emit the body
843
+ const pat = arm.pattern;
844
+ if (pat.kind === 'PatWild') {
845
+ // Wildcard/default arm — always matches
691
846
  lowerBlock(arm.body, ctx, new Map(scope));
692
847
  if (isPlaceholderTerm(ctx.current().term)) {
693
848
  ctx.terminate({ kind: 'jump', target: mergeBlock.id });
694
849
  }
695
850
  }
696
- else if (arm.pattern.kind === 'range_lit') {
697
- // Range pattern: e.g. 0..59 => emit ge/le comparisons
698
- const range = arm.pattern.range;
851
+ else if (pat.kind === 'PatNone') {
852
+ // None arm: optHasOp == 0
853
+ const cmpTemp = ctx.freshTemp();
854
+ ctx.emit({ kind: 'cmp', dst: cmpTemp, op: 'eq', a: optHasOp, b: { kind: 'const', value: 0 } });
699
855
  const armBody = ctx.newBlock('match_arm');
700
856
  const nextArm = ctx.newBlock('match_next');
701
- // Chain checks: if min defined, check matchVal >= min; if max defined, check matchVal <= max
702
- // Each failed check jumps to nextArm
703
- const checks = [];
704
- if (range.min !== undefined)
705
- checks.push({ op: 'ge', bound: range.min });
706
- if (range.max !== undefined)
707
- checks.push({ op: 'le', bound: range.max });
708
- if (checks.length === 0) {
709
- // Open range — always matches
710
- ctx.terminate({ kind: 'jump', target: armBody.id });
711
- }
712
- else {
713
- // Emit checks sequentially; each check passes → continue to next or armBody
714
- for (let ci = 0; ci < checks.length; ci++) {
715
- const { op, bound } = checks[ci];
716
- const cmpTemp = ctx.freshTemp();
717
- ctx.emit({ kind: 'cmp', dst: cmpTemp, op, a: matchVal, b: { kind: 'const', value: bound } });
718
- const passBlock = ci === checks.length - 1 ? armBody : ctx.newBlock('match_range_check');
719
- ctx.terminate({ kind: 'branch', cond: { kind: 'temp', name: cmpTemp }, then: passBlock.id, else: nextArm.id });
720
- if (ci < checks.length - 1)
721
- ctx.switchTo(passBlock);
722
- }
723
- }
857
+ ctx.terminate({ kind: 'branch', cond: { kind: 'temp', name: cmpTemp }, then: armBody.id, else: nextArm.id });
724
858
  ctx.switchTo(armBody);
725
859
  lowerBlock(arm.body, ctx, new Map(scope));
726
860
  if (isPlaceholderTerm(ctx.current().term)) {
@@ -728,10 +862,27 @@ function lowerStmt(stmt, ctx, scope) {
728
862
  }
729
863
  ctx.switchTo(nextArm);
730
864
  }
731
- else {
732
- const patOp = lowerExpr(arm.pattern, ctx, scope);
865
+ else if (pat.kind === 'PatSome') {
866
+ // Some(x) arm: optHasOp == 1, bind x = optValTemp
867
+ const cmpTemp = ctx.freshTemp();
868
+ ctx.emit({ kind: 'cmp', dst: cmpTemp, op: 'eq', a: optHasOp, b: { kind: 'const', value: 1 } });
869
+ const armBody = ctx.newBlock('match_arm');
870
+ const nextArm = ctx.newBlock('match_next');
871
+ ctx.terminate({ kind: 'branch', cond: { kind: 'temp', name: cmpTemp }, then: armBody.id, else: nextArm.id });
872
+ ctx.switchTo(armBody);
873
+ const armScope = new Map(scope);
874
+ // Bind the pattern variable to the option value temp
875
+ if (optValTemp)
876
+ armScope.set(pat.binding, optValTemp);
877
+ lowerBlock(arm.body, ctx, armScope);
878
+ if (isPlaceholderTerm(ctx.current().term)) {
879
+ ctx.terminate({ kind: 'jump', target: mergeBlock.id });
880
+ }
881
+ ctx.switchTo(nextArm);
882
+ }
883
+ else if (pat.kind === 'PatInt') {
733
884
  const cmpTemp = ctx.freshTemp();
734
- ctx.emit({ kind: 'cmp', dst: cmpTemp, op: 'eq', a: matchVal, b: patOp });
885
+ ctx.emit({ kind: 'cmp', dst: cmpTemp, op: 'eq', a: matchVal, b: { kind: 'const', value: pat.value } });
735
886
  const armBody = ctx.newBlock('match_arm');
736
887
  const nextArm = ctx.newBlock('match_next');
737
888
  ctx.terminate({ kind: 'branch', cond: { kind: 'temp', name: cmpTemp }, then: armBody.id, else: nextArm.id });
@@ -742,6 +893,54 @@ function lowerStmt(stmt, ctx, scope) {
742
893
  }
743
894
  ctx.switchTo(nextArm);
744
895
  }
896
+ else if (pat.kind === 'PatExpr') {
897
+ // Legacy: range_lit or other expression
898
+ const expr = pat.expr;
899
+ if (expr.kind === 'range_lit') {
900
+ const range = expr.range;
901
+ const armBody = ctx.newBlock('match_arm');
902
+ const nextArm = ctx.newBlock('match_next');
903
+ const checks = [];
904
+ if (range.min !== undefined)
905
+ checks.push({ op: 'ge', bound: range.min });
906
+ if (range.max !== undefined)
907
+ checks.push({ op: 'le', bound: range.max });
908
+ if (checks.length === 0) {
909
+ ctx.terminate({ kind: 'jump', target: armBody.id });
910
+ }
911
+ else {
912
+ for (let ci = 0; ci < checks.length; ci++) {
913
+ const { op, bound } = checks[ci];
914
+ const cmpTemp = ctx.freshTemp();
915
+ ctx.emit({ kind: 'cmp', dst: cmpTemp, op, a: matchVal, b: { kind: 'const', value: bound } });
916
+ const passBlock = ci === checks.length - 1 ? armBody : ctx.newBlock('match_range_check');
917
+ ctx.terminate({ kind: 'branch', cond: { kind: 'temp', name: cmpTemp }, then: passBlock.id, else: nextArm.id });
918
+ if (ci < checks.length - 1)
919
+ ctx.switchTo(passBlock);
920
+ }
921
+ }
922
+ ctx.switchTo(armBody);
923
+ lowerBlock(arm.body, ctx, new Map(scope));
924
+ if (isPlaceholderTerm(ctx.current().term)) {
925
+ ctx.terminate({ kind: 'jump', target: mergeBlock.id });
926
+ }
927
+ ctx.switchTo(nextArm);
928
+ }
929
+ else {
930
+ const patOp = lowerExpr(expr, ctx, scope);
931
+ const cmpTemp = ctx.freshTemp();
932
+ ctx.emit({ kind: 'cmp', dst: cmpTemp, op: 'eq', a: matchVal, b: patOp });
933
+ const armBody = ctx.newBlock('match_arm');
934
+ const nextArm = ctx.newBlock('match_next');
935
+ ctx.terminate({ kind: 'branch', cond: { kind: 'temp', name: cmpTemp }, then: armBody.id, else: nextArm.id });
936
+ ctx.switchTo(armBody);
937
+ lowerBlock(arm.body, ctx, new Map(scope));
938
+ if (isPlaceholderTerm(ctx.current().term)) {
939
+ ctx.terminate({ kind: 'jump', target: mergeBlock.id });
940
+ }
941
+ ctx.switchTo(nextArm);
942
+ }
943
+ }
745
944
  }
746
945
  // If no default arm matched, jump to merge
747
946
  if (isPlaceholderTerm(ctx.current().term)) {
@@ -752,8 +951,13 @@ function lowerStmt(stmt, ctx, scope) {
752
951
  }
753
952
  case 'raw': {
754
953
  // Raw commands are opaque at MIR level — emit as a call to a synthetic raw function
755
- // For now, pass through as a call with no args (will be handled in LIR)
756
- ctx.emit({ kind: 'call', dst: null, fn: `__raw:${stmt.cmd}`, args: [] });
954
+ // __NS__ is replaced with the current namespace so stdlib can reference self-functions.
955
+ // __OBJ__ is replaced with the scoreboard objective (__<namespace>).
956
+ const ns = ctx.getNamespace();
957
+ const rawCmd = stmt.cmd
958
+ .replace(/__NS__/g, ns)
959
+ .replace(/__OBJ__/g, `__${ns}`);
960
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:${rawCmd}`, args: [] });
757
961
  break;
758
962
  }
759
963
  case 'if_let_some': {
@@ -820,13 +1024,21 @@ function lowerExpr(expr, ctx, scope) {
820
1024
  case 'int_lit':
821
1025
  return { kind: 'const', value: expr.value };
822
1026
  case 'float_lit':
823
- // float is ×1000 fixed-point in RedScript
824
- return { kind: 'const', value: expr.value };
1027
+ // fixed is ×10000 fixed-point in RedScript
1028
+ return { kind: 'const', value: Math.round(expr.value * 10000) };
825
1029
  case 'byte_lit':
826
1030
  case 'short_lit':
827
1031
  case 'long_lit':
828
- case 'double_lit':
829
1032
  return { kind: 'const', value: expr.value };
1033
+ case 'double_lit': {
1034
+ // Store as NBT double, return as ×10000 fixed score
1035
+ const path = ctx.freshDoubleVar(`dlit`);
1036
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage rs:d ${path} set value ${expr.value}d`, args: [] });
1037
+ const t = ctx.freshTemp();
1038
+ ctx.emit({ kind: 'nbt_read', dst: t, ns: 'rs:d', path, scale: 10000.0 });
1039
+ ctx.floatTemps.add(t);
1040
+ return { kind: 'temp', name: t };
1041
+ }
830
1042
  case 'bool_lit': {
831
1043
  return { kind: 'const', value: expr.value ? 1 : 0 };
832
1044
  }
@@ -860,6 +1072,16 @@ function lowerExpr(expr, ctx, scope) {
860
1072
  return { kind: 'temp', name: t };
861
1073
  }
862
1074
  case 'ident': {
1075
+ // If this is a double variable, load it as ×10000 fixed into a fresh temp
1076
+ if (ctx.doubleVars.has(expr.name)) {
1077
+ const path = ctx.doubleVars.get(expr.name);
1078
+ const t = ctx.freshTemp();
1079
+ // Load double NBT as ×10000 fixed-point score via nbt_read (LIR renames dst properly)
1080
+ ctx.emit({ kind: 'nbt_read', dst: t, ns: 'rs:d', path, scale: 10000.0 });
1081
+ // Mark as fixed (×10000) so arithmetic scale correction applies
1082
+ ctx.floatTemps.add(t);
1083
+ return { kind: 'temp', name: t };
1084
+ }
863
1085
  const temp = scope.get(expr.name);
864
1086
  if (temp)
865
1087
  return { kind: 'temp', name: temp };
@@ -877,6 +1099,30 @@ function lowerExpr(expr, ctx, scope) {
877
1099
  if (expr.op === '||') {
878
1100
  return lowerShortCircuitOr(expr, ctx, scope);
879
1101
  }
1102
+ // Double arithmetic intrinsics: double op double → call math_hp:double_add/sub/mul/div
1103
+ const doubleArithOps = {
1104
+ '+': 'math_hp:double_add',
1105
+ '-': 'math_hp:double_sub',
1106
+ '*': 'math_hp:double_mul',
1107
+ '/': 'math_hp:double_div',
1108
+ };
1109
+ if (expr.op in doubleArithOps && isDoubleExpr(expr.left, ctx) && isDoubleExpr(expr.right, ctx)) {
1110
+ const ns = ctx.getNamespace();
1111
+ const leftPath = lowerDoubleExprToPath(expr.left, ctx, scope);
1112
+ const rightPath = lowerDoubleExprToPath(expr.right, ctx, scope);
1113
+ // Copy operands into __dp0 and __dp1 (intrinsic calling convention)
1114
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage rs:d __dp0 set from storage rs:d ${leftPath}`, args: [] });
1115
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage rs:d __dp1 set from storage rs:d ${rightPath}`, args: [] });
1116
+ // Call the intrinsic
1117
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:function ${doubleArithOps[expr.op]}`, args: [] });
1118
+ // Result is in rs:d __dp0 — register as a new double var and read back as ×10000 fixed
1119
+ const resultPath = ctx.freshDoubleVar('dres');
1120
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage rs:d ${resultPath} set from storage rs:d __dp0`, args: [] });
1121
+ const t = ctx.freshTemp();
1122
+ ctx.emit({ kind: 'nbt_read', dst: t, ns: 'rs:d', path: resultPath, scale: 10000.0 });
1123
+ ctx.floatTemps.add(t);
1124
+ return { kind: 'temp', name: t };
1125
+ }
880
1126
  const left = lowerExpr(expr.left, ctx, scope);
881
1127
  const right = lowerExpr(expr.right, ctx, scope);
882
1128
  const t = ctx.freshTemp();
@@ -888,7 +1134,33 @@ function lowerExpr(expr, ctx, scope) {
888
1134
  '==': 'eq', '!=': 'ne', '<': 'lt', '<=': 'le', '>': 'gt', '>=': 'ge',
889
1135
  };
890
1136
  if (expr.op in arithmeticOps) {
891
- ctx.emit({ kind: arithmeticOps[expr.op], dst: t, a: left, b: right });
1137
+ const isFloatLeft = left.kind === 'temp' && ctx.floatTemps.has(left.name);
1138
+ const isFloatRight = right.kind === 'temp' && ctx.floatTemps.has(right.name);
1139
+ if (expr.op === '*' && isFloatLeft && isFloatRight) {
1140
+ // fixed * fixed: result is ×100000000, divide by 10000 to restore ×10000 scale
1141
+ ctx.emit({ kind: 'mul', dst: t, a: left, b: right });
1142
+ const scaleTemp = ctx.freshTemp();
1143
+ ctx.emit({ kind: 'const', dst: scaleTemp, value: 10000 });
1144
+ const corrected = ctx.freshTemp();
1145
+ ctx.emit({ kind: 'div', dst: corrected, a: { kind: 'temp', name: t }, b: { kind: 'temp', name: scaleTemp } });
1146
+ ctx.floatTemps.add(corrected);
1147
+ return { kind: 'temp', name: corrected };
1148
+ }
1149
+ else if (expr.op === '/' && isFloatLeft && isFloatRight) {
1150
+ // fixed / fixed: pre-multiply dividend by 10000 to restore ×10000 scale
1151
+ const scaleTemp = ctx.freshTemp();
1152
+ ctx.emit({ kind: 'const', dst: scaleTemp, value: 10000 });
1153
+ const scaled = ctx.freshTemp();
1154
+ ctx.emit({ kind: 'mul', dst: scaled, a: left, b: { kind: 'temp', name: scaleTemp } });
1155
+ ctx.emit({ kind: 'div', dst: t, a: { kind: 'temp', name: scaled }, b: right });
1156
+ ctx.floatTemps.add(t);
1157
+ }
1158
+ else {
1159
+ ctx.emit({ kind: arithmeticOps[expr.op], dst: t, a: left, b: right });
1160
+ if (isFloatLeft || isFloatRight) {
1161
+ ctx.floatTemps.add(t);
1162
+ }
1163
+ }
892
1164
  }
893
1165
  else if (expr.op in cmpOps) {
894
1166
  ctx.emit({ kind: 'cmp', dst: t, op: cmpOps[expr.op], a: left, b: right });
@@ -958,6 +1230,16 @@ function lowerExpr(expr, ctx, scope) {
958
1230
  return { kind: 'temp', name: fieldTemp };
959
1231
  }
960
1232
  }
1233
+ // Chained struct field access: v.pos.x → look up synthetic var "v.pos" in structVars
1234
+ if (expr.obj.kind === 'member' && expr.obj.obj.kind === 'ident') {
1235
+ const syntheticName = `${expr.obj.obj.name}.${expr.obj.field}`;
1236
+ const nestedSv = ctx.structVars.get(syntheticName);
1237
+ if (nestedSv) {
1238
+ const fieldTemp = nestedSv.fields.get(expr.field);
1239
+ if (fieldTemp)
1240
+ return { kind: 'temp', name: fieldTemp };
1241
+ }
1242
+ }
961
1243
  // Fallback: opaque
962
1244
  const obj = lowerExpr(expr.obj, ctx, scope);
963
1245
  const t = ctx.freshTemp();
@@ -1008,9 +1290,36 @@ function lowerExpr(expr, ctx, scope) {
1008
1290
  return valOp;
1009
1291
  }
1010
1292
  case 'call': {
1293
+ // Handle arr.len() — parser desugars obj.len() → call { fn: 'len', args: [obj] }
1294
+ if (expr.fn === 'len' && expr.args.length === 1 && expr.args[0].kind === 'ident') {
1295
+ const arrName = expr.args[0].name;
1296
+ const arrInfo = ctx.arrayVars.get(arrName);
1297
+ if (arrInfo) {
1298
+ if (arrInfo.knownLen !== undefined) {
1299
+ const t = ctx.freshTemp();
1300
+ ctx.emit({ kind: 'const', dst: t, value: arrInfo.knownLen });
1301
+ return { kind: 'temp', name: t };
1302
+ }
1303
+ // Dynamic array: read length at runtime via data get
1304
+ const t = ctx.freshTemp();
1305
+ ctx.emit({ kind: 'nbt_list_len', dst: t, ns: arrInfo.ns, path: arrInfo.pathPrefix });
1306
+ return { kind: 'temp', name: t };
1307
+ }
1308
+ // Also check scope (literal array length temp)
1309
+ const lenTemp = scope.get(arrName);
1310
+ if (lenTemp !== undefined) {
1311
+ return { kind: 'temp', name: lenTemp };
1312
+ }
1313
+ }
1011
1314
  // Handle scoreboard_get / score — read from vanilla MC scoreboard
1012
1315
  if (expr.fn === 'scoreboard_get' || expr.fn === 'score') {
1013
- const player = hirExprToStringLiteral(expr.args[0]);
1316
+ const playerArg = exprToCommandArg(expr.args[0], ctx.currentMacroParams);
1317
+ // If the arg is a plain ident (Player variable, not a macro param), use @s —
1318
+ // event handlers are always called via `execute as <player> run function ...`
1319
+ // so @s correctly refers to the player in context.
1320
+ const player = (!playerArg.isMacro && expr.args[0].kind === 'ident')
1321
+ ? '@s'
1322
+ : (playerArg.str || '@s');
1014
1323
  const obj = hirExprToStringLiteral(expr.args[1]);
1015
1324
  const t = ctx.freshTemp();
1016
1325
  ctx.emit({ kind: 'score_read', dst: t, player, obj });
@@ -1018,7 +1327,10 @@ function lowerExpr(expr, ctx, scope) {
1018
1327
  }
1019
1328
  // Handle scoreboard_set — write to vanilla MC scoreboard
1020
1329
  if (expr.fn === 'scoreboard_set') {
1021
- const player = hirExprToStringLiteral(expr.args[0]);
1330
+ const playerArg = exprToCommandArg(expr.args[0], ctx.currentMacroParams);
1331
+ const player = (!playerArg.isMacro && expr.args[0].kind === 'ident')
1332
+ ? '@s'
1333
+ : (playerArg.str || '@s');
1022
1334
  const obj = hirExprToStringLiteral(expr.args[1]);
1023
1335
  const src = lowerExpr(expr.args[2], ctx, scope);
1024
1336
  ctx.emit({ kind: 'score_write', player, obj, src });
@@ -1026,6 +1338,103 @@ function lowerExpr(expr, ctx, scope) {
1026
1338
  ctx.emit({ kind: 'const', dst: t, value: 0 });
1027
1339
  return { kind: 'temp', name: t };
1028
1340
  }
1341
+ // Handle storage_set_array(storagePath, fieldName, nbtArrayLiteral)
1342
+ // Writes a literal NBT int array to data storage (used in @load for tables).
1343
+ // Emits: data modify storage <storagePath> <fieldName> set value <nbtArray>
1344
+ if (expr.fn === 'storage_set_array' && expr.args.length >= 3) {
1345
+ const storagePath = hirExprToStringLiteral(expr.args[0]);
1346
+ const fieldName = hirExprToStringLiteral(expr.args[1]);
1347
+ const nbtLiteral = hirExprToStringLiteral(expr.args[2]);
1348
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage ${storagePath} ${fieldName} set value ${nbtLiteral}`, args: [] });
1349
+ const t = ctx.freshTemp();
1350
+ ctx.emit({ kind: 'const', dst: t, value: 0 });
1351
+ return { kind: 'temp', name: t };
1352
+ }
1353
+ // Handle storage_get_int(storagePath, fieldName, index) → int
1354
+ // Reads one element from an NBT int-array stored in data storage.
1355
+ // Const index: execute store result score $dst run data get storage <ns> <field>[N] 1
1356
+ // Runtime index: nbt_read_dynamic via macro sub-function
1357
+ if (expr.fn === 'storage_get_int' && expr.args.length >= 3) {
1358
+ const storagePath = hirExprToStringLiteral(expr.args[0]);
1359
+ const fieldName = hirExprToStringLiteral(expr.args[1]);
1360
+ const indexOp = lowerExpr(expr.args[2], ctx, scope);
1361
+ const t = ctx.freshTemp();
1362
+ if (indexOp.kind === 'const') {
1363
+ ctx.emit({ kind: 'nbt_read', dst: t, ns: storagePath, path: `${fieldName}[${indexOp.value}]`, scale: 1 });
1364
+ }
1365
+ else {
1366
+ ctx.emit({ kind: 'nbt_read_dynamic', dst: t, ns: storagePath, pathPrefix: fieldName, indexSrc: indexOp });
1367
+ }
1368
+ return { kind: 'temp', name: t };
1369
+ }
1370
+ // Handle __entity_tag / __entity_untag — entity.tag("name") / entity.untag("name") sugar
1371
+ if (expr.fn === '__entity_tag' || expr.fn === '__entity_untag') {
1372
+ const selArg = expr.args[0];
1373
+ const tagArg = expr.args[1];
1374
+ const tagStr = tagArg.kind === 'str_lit' ? tagArg.value : 'unknown';
1375
+ const selStr = selArg.kind === 'selector'
1376
+ ? selectorToString(selArg.sel ?? selArg)
1377
+ : '@s';
1378
+ const op = expr.fn === '__entity_tag' ? 'add' : 'remove';
1379
+ const t = ctx.freshTemp();
1380
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:tag ${selStr} ${op} ${tagStr}`, args: [] });
1381
+ ctx.emit({ kind: 'const', dst: t, value: 0 });
1382
+ return { kind: 'temp', name: t };
1383
+ }
1384
+ // Handle __entity_has_tag(entity, tag) — entity.has_tag("vip") sugar
1385
+ // Compiles to: execute store success score $ret __ns if entity <sel>[tag=<name>]
1386
+ // We use $ret as the store target so LIR's dst-copy mechanism picks it up.
1387
+ if (expr.fn === '__entity_has_tag') {
1388
+ const tagArg = expr.args[1];
1389
+ const tagStr = tagArg.kind === 'str_lit' ? tagArg.value : 'unknown';
1390
+ const selArg = expr.args[0];
1391
+ const selStr = selArg.kind === 'selector'
1392
+ ? selectorToString(selArg.sel ?? selArg)
1393
+ : '@s';
1394
+ const t = ctx.freshTemp();
1395
+ const ns = ctx.getNamespace();
1396
+ // Store result in $ret — LIR will copy $ret → $t when dst=t
1397
+ ctx.emit({ kind: 'call', dst: t, fn: `__raw:execute store success score $ret __${ns} if entity ${selStr}[tag=${tagStr}]`, args: [] });
1398
+ return { kind: 'temp', name: t };
1399
+ }
1400
+ // Handle __array_push(arr, val) — h.push(val) sugar (parser desugars arr.push → __array_push)
1401
+ // Equivalent to list_push but uses the array's known NBT path directly.
1402
+ if (expr.fn === '__array_push') {
1403
+ if (expr.args[0].kind === 'ident') {
1404
+ const arrInfo = ctx.arrayVars.get(expr.args[0].name);
1405
+ if (arrInfo) {
1406
+ const valOp = lowerExpr(expr.args[1], ctx, scope);
1407
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage ${arrInfo.ns} ${arrInfo.pathPrefix} append value 0`, args: [] });
1408
+ ctx.emit({ kind: 'nbt_write', ns: arrInfo.ns, path: `${arrInfo.pathPrefix}[-1]`, type: 'int', scale: 1, src: valOp });
1409
+ const t = ctx.freshTemp();
1410
+ ctx.emit({ kind: 'const', dst: t, value: 0 });
1411
+ return { kind: 'temp', name: t };
1412
+ }
1413
+ }
1414
+ }
1415
+ // Handle __array_pop(arr) — h.pop() sugar
1416
+ if (expr.fn === '__array_pop') {
1417
+ if (expr.args[0].kind === 'ident') {
1418
+ const arrInfo = ctx.arrayVars.get(expr.args[0].name);
1419
+ if (arrInfo) {
1420
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data remove storage ${arrInfo.ns} ${arrInfo.pathPrefix}[-1]`, args: [] });
1421
+ const t = ctx.freshTemp();
1422
+ ctx.emit({ kind: 'const', dst: t, value: 0 });
1423
+ return { kind: 'temp', name: t };
1424
+ }
1425
+ }
1426
+ }
1427
+ // Handle __array_length(arr) — h.length sugar → get array length via data get
1428
+ if (expr.fn === '__array_length') {
1429
+ if (expr.args[0].kind === 'ident') {
1430
+ const arrInfo = ctx.arrayVars.get(expr.args[0].name);
1431
+ if (arrInfo) {
1432
+ const t = ctx.freshTemp();
1433
+ ctx.emit({ kind: 'nbt_read', dst: t, ns: arrInfo.ns, path: `${arrInfo.pathPrefix}`, scale: 1 });
1434
+ return { kind: 'temp', name: t };
1435
+ }
1436
+ }
1437
+ }
1029
1438
  // Handle list_push(arr_name, val) — append an int to an NBT int array
1030
1439
  // list_push("rs:lists", "mylist", val) or simpler: uses the array's storage path
1031
1440
  if (expr.fn === 'list_push') {
@@ -1128,7 +1537,7 @@ function lowerExpr(expr, ctx, scope) {
1128
1537
  }
1129
1538
  // Handle builtin calls → raw MC commands
1130
1539
  if (macro_1.BUILTIN_SET.has(expr.fn)) {
1131
- const cmd = formatBuiltinCall(expr.fn, expr.args, ctx.currentMacroParams);
1540
+ const cmd = formatBuiltinCall(expr.fn, expr.args, ctx.currentMacroParams, ctx.getNamespace());
1132
1541
  ctx.emit({ kind: 'call', dst: null, fn: `__raw:${cmd}`, args: [] });
1133
1542
  const t = ctx.freshTemp();
1134
1543
  ctx.emit({ kind: 'const', dst: t, value: 0 });
@@ -1154,7 +1563,25 @@ function lowerExpr(expr, ctx, scope) {
1154
1563
  const temp = sv.fields.get(f);
1155
1564
  return temp ? { kind: 'temp', name: temp } : { kind: 'const', value: 0 };
1156
1565
  });
1157
- const explicitArgs = expr.args.slice(1).map(a => lowerExpr(a, ctx, scope));
1566
+ // Flatten struct args field-by-field; primitives as single operand
1567
+ const explicitArgs = [];
1568
+ for (const argExpr of expr.args.slice(1)) {
1569
+ if (argExpr.kind === 'ident') {
1570
+ const argSv = ctx.structVars.get(argExpr.name);
1571
+ if (argSv) {
1572
+ // Struct arg: pass each field as a separate operand
1573
+ const argFields = ctx.structDefs.get(argSv.typeName) ?? [];
1574
+ for (const fieldName of argFields) {
1575
+ const ft = argSv.fields.get(fieldName);
1576
+ explicitArgs.push(ft
1577
+ ? { kind: 'temp', name: ft }
1578
+ : { kind: 'const', value: 0 });
1579
+ }
1580
+ continue;
1581
+ }
1582
+ }
1583
+ explicitArgs.push(lowerExpr(argExpr, ctx, scope));
1584
+ }
1158
1585
  const allArgs = [...selfArgs, ...explicitArgs];
1159
1586
  const t = ctx.freshTemp();
1160
1587
  ctx.emit({ kind: 'call', dst: t, fn: `${sv.typeName}::${expr.fn}`, args: allArgs });
@@ -1173,11 +1600,12 @@ function lowerExpr(expr, ctx, scope) {
1173
1600
  if (targetMacro.macroParams.has(paramName)) {
1174
1601
  const paramTypeName = targetMacro.paramTypes.get(paramName) ?? 'int';
1175
1602
  const isFloat = paramTypeName === 'float';
1603
+ const isFixed = paramTypeName === 'fixed';
1176
1604
  macroArgs.push({
1177
1605
  name: paramName,
1178
1606
  value: args[i],
1179
- type: isFloat ? 'double' : 'int',
1180
- scale: isFloat ? 0.01 : 1,
1607
+ type: (isFloat || isFixed) ? 'double' : 'int',
1608
+ scale: isFloat ? 0.01 : isFixed ? 0.0001 : 1,
1181
1609
  });
1182
1610
  }
1183
1611
  }
@@ -1230,12 +1658,76 @@ function lowerExpr(expr, ctx, scope) {
1230
1658
  }
1231
1659
  }
1232
1660
  // --- end array monomorphization ---
1661
+ // Check if any args are double-typed — pass via NBT __dp<i> slots
1662
+ {
1663
+ const targetParams = ctx.fnParamInfo.get(expr.fn);
1664
+ if (targetParams) {
1665
+ const hasDoubleParam = targetParams.some(p => p.type.kind === 'named' && p.type.name === 'double');
1666
+ if (hasDoubleParam) {
1667
+ const ns = ctx.getNamespace();
1668
+ const nonDoubleArgs = [];
1669
+ let doubleSlot = 0;
1670
+ for (let i = 0; i < targetParams.length && i < expr.args.length; i++) {
1671
+ const p = targetParams[i];
1672
+ if (p.type.kind === 'named' && p.type.name === 'double') {
1673
+ // Caller has a double arg: copy NBT path directly to __dp<doubleSlot>
1674
+ const arg = expr.args[i];
1675
+ if (arg.kind === 'ident' && ctx.doubleVars.has(arg.name)) {
1676
+ // Arg is already a double var — copy NBT path directly
1677
+ const srcPath = ctx.doubleVars.get(arg.name);
1678
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage rs:d __dp${doubleSlot} set from storage rs:d ${srcPath}`, args: [] });
1679
+ }
1680
+ else {
1681
+ // Arg is an expression — lower it as fixed (×10000), store as double
1682
+ const argOp = lowerExpr(arg, ctx, scope);
1683
+ const tmp = ctx.freshTemp();
1684
+ ctx.emit({ kind: 'copy', dst: tmp, src: argOp });
1685
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:execute store result storage rs:d __dp${doubleSlot} double 0.0001 run scoreboard players get $${tmp} __${ns}`, args: [] });
1686
+ }
1687
+ doubleSlot++;
1688
+ }
1689
+ else {
1690
+ nonDoubleArgs.push(lowerExpr(expr.args[i], ctx, scope));
1691
+ }
1692
+ }
1693
+ // Any extra args beyond param count
1694
+ for (let i = targetParams.length; i < expr.args.length; i++) {
1695
+ nonDoubleArgs.push(lowerExpr(expr.args[i], ctx, scope));
1696
+ }
1697
+ const t = ctx.freshTemp();
1698
+ ctx.emit({ kind: 'call', dst: t, fn: expr.fn, args: nonDoubleArgs });
1699
+ return { kind: 'temp', name: t };
1700
+ }
1701
+ }
1702
+ }
1233
1703
  const args = expr.args.map(a => lowerExpr(a, ctx, scope));
1234
1704
  const t = ctx.freshTemp();
1235
1705
  ctx.emit({ kind: 'call', dst: t, fn: expr.fn, args });
1236
1706
  return { kind: 'temp', name: t };
1237
1707
  }
1238
1708
  case 'invoke': {
1709
+ // Check for array.len() call: arr.len() → compile-time constant or NBT length
1710
+ if (expr.callee.kind === 'member' && expr.callee.field === 'len' && expr.callee.obj.kind === 'ident') {
1711
+ const arrInfo = ctx.arrayVars.get(expr.callee.obj.name);
1712
+ if (arrInfo) {
1713
+ if (arrInfo.knownLen !== undefined) {
1714
+ // Compile-time constant length (literal array)
1715
+ const t = ctx.freshTemp();
1716
+ ctx.emit({ kind: 'const', dst: t, value: arrInfo.knownLen });
1717
+ return { kind: 'temp', name: t };
1718
+ }
1719
+ // Dynamic array (function parameter, heap_new, etc.): read length at runtime
1720
+ // emit: execute store result score $t __ns run data get storage ns:arrays path
1721
+ const t = ctx.freshTemp();
1722
+ ctx.emit({ kind: 'nbt_list_len', dst: t, ns: arrInfo.ns, path: arrInfo.pathPrefix });
1723
+ return { kind: 'temp', name: t };
1724
+ }
1725
+ // Also check scope-tracked length temp for literal arrays
1726
+ const lenTemp = scope.get(expr.callee.obj.name);
1727
+ if (lenTemp !== undefined) {
1728
+ return { kind: 'temp', name: lenTemp };
1729
+ }
1730
+ }
1239
1731
  // Check for struct method call: v.method(args)
1240
1732
  if (expr.callee.kind === 'member' && expr.callee.obj.kind === 'ident') {
1241
1733
  const sv = ctx.structVars.get(expr.callee.obj.name);
@@ -1323,6 +1815,50 @@ function lowerExpr(expr, ctx, scope) {
1323
1815
  ctx.emit({ kind: 'const', dst: t, value: 0 });
1324
1816
  return { kind: 'temp', name: t };
1325
1817
  }
1818
+ case 'type_cast': {
1819
+ const ns = ctx.getNamespace();
1820
+ const targetName = expr.targetType.kind === 'named' ? expr.targetType.name : null;
1821
+ if (targetName === 'double') {
1822
+ // expr as double: evaluate inner as fixed (×10000), store as double in NBT
1823
+ const innerOp = lowerExpr(expr.expr, ctx, scope);
1824
+ const innerTemp = ctx.freshTemp();
1825
+ ctx.emit({ kind: 'copy', dst: innerTemp, src: innerOp });
1826
+ const path = ctx.freshDoubleVar(`cast`);
1827
+ // execute store result storage rs:d <path> double 0.0001 run scoreboard players get $<t> __<ns>
1828
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:execute store result storage rs:d ${path} double 0.0001 run scoreboard players get $${innerTemp} __${ns}`, args: [] });
1829
+ // Return a fresh temp that reads the stored double back as fixed ×10000 via nbt_read
1830
+ const t = ctx.freshTemp();
1831
+ ctx.emit({ kind: 'nbt_read', dst: t, ns: 'rs:d', path, scale: 10000.0 });
1832
+ ctx.floatTemps.add(t);
1833
+ return { kind: 'temp', name: t };
1834
+ }
1835
+ if (targetName === 'fixed' || targetName === 'float' || targetName === 'int') {
1836
+ // expr as fixed (or int): check if expr is a double variable
1837
+ if (expr.expr.kind === 'ident' && ctx.doubleVars.has(expr.expr.name)) {
1838
+ // Load double NBT as ×10000 fixed-point score via nbt_read (LIR renames dst properly)
1839
+ const path = ctx.doubleVars.get(expr.expr.name);
1840
+ const t = ctx.freshTemp();
1841
+ ctx.emit({ kind: 'nbt_read', dst: t, ns: 'rs:d', path, scale: 10000.0 });
1842
+ if (targetName === 'fixed' || targetName === 'float') {
1843
+ ctx.floatTemps.add(t);
1844
+ }
1845
+ return { kind: 'temp', name: t };
1846
+ }
1847
+ // Otherwise just evaluate the inner expression (numeric coercion — no-op at scoreboard level)
1848
+ const innerOp = lowerExpr(expr.expr, ctx, scope);
1849
+ const t = ctx.freshTemp();
1850
+ ctx.emit({ kind: 'copy', dst: t, src: innerOp });
1851
+ if (targetName === 'fixed' || targetName === 'float') {
1852
+ ctx.floatTemps.add(t);
1853
+ }
1854
+ return { kind: 'temp', name: t };
1855
+ }
1856
+ // All other casts: pass through
1857
+ const innerOp = lowerExpr(expr.expr, ctx, scope);
1858
+ const t = ctx.freshTemp();
1859
+ ctx.emit({ kind: 'copy', dst: t, src: innerOp });
1860
+ return { kind: 'temp', name: t };
1861
+ }
1326
1862
  default: {
1327
1863
  const _exhaustive = expr;
1328
1864
  throw new Error(`Unknown HIR expression kind: ${_exhaustive.kind}`);
@@ -1330,6 +1866,41 @@ function lowerExpr(expr, ctx, scope) {
1330
1866
  }
1331
1867
  }
1332
1868
  // ---------------------------------------------------------------------------
1869
+ // Double arithmetic helpers
1870
+ // ---------------------------------------------------------------------------
1871
+ /** Returns true if expr is a double-typed HIR expression (ident in doubleVars or double_lit). */
1872
+ function isDoubleExpr(expr, ctx) {
1873
+ if (expr.kind === 'ident' && ctx.doubleVars.has(expr.name))
1874
+ return true;
1875
+ if (expr.kind === 'double_lit')
1876
+ return true;
1877
+ return false;
1878
+ }
1879
+ /**
1880
+ * Lower a double HIR expression to its NBT storage path in rs:d.
1881
+ * For double_lit, stores the value and returns the path.
1882
+ * For double idents, returns the existing path directly.
1883
+ * For other expressions, lowers as fixed (×10000) and converts to double.
1884
+ */
1885
+ function lowerDoubleExprToPath(expr, ctx, scope) {
1886
+ if (expr.kind === 'ident' && ctx.doubleVars.has(expr.name)) {
1887
+ return ctx.doubleVars.get(expr.name);
1888
+ }
1889
+ if (expr.kind === 'double_lit') {
1890
+ const path = ctx.freshDoubleVar('dlit');
1891
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:data modify storage rs:d ${path} set value ${expr.value}d`, args: [] });
1892
+ return path;
1893
+ }
1894
+ // Fallback: lower as fixed (×10000), then convert to double NBT
1895
+ const op = lowerExpr(expr, ctx, scope);
1896
+ const tmp = ctx.freshTemp();
1897
+ ctx.emit({ kind: 'copy', dst: tmp, src: op });
1898
+ const ns = ctx.getNamespace();
1899
+ const path = ctx.freshDoubleVar('dtmp');
1900
+ ctx.emit({ kind: 'call', dst: null, fn: `__raw:execute store result storage rs:d ${path} double 0.0001 run scoreboard players get $${tmp} __${ns}`, args: [] });
1901
+ return path;
1902
+ }
1903
+ // ---------------------------------------------------------------------------
1333
1904
  // Short-circuit lowering
1334
1905
  // ---------------------------------------------------------------------------
1335
1906
  function lowerShortCircuitAnd(expr, ctx, scope) {
@@ -1545,7 +2116,48 @@ const MACRO_SENTINEL = '\x01';
1545
2116
  * If any argument uses a macro param, the command is prefixed with \x01
1546
2117
  * (converted to $ in LIR emission).
1547
2118
  */
1548
- function formatBuiltinCall(fn, args, macroParams) {
2119
+ /**
2120
+ * Convert an f_string HIRExpr to a Minecraft JSON text component string.
2121
+ * Each interpolated variable becomes a {"score":{"name":"$var","objective":"__ns"}} component.
2122
+ */
2123
+ function fStringToJsonText(expr, namespace) {
2124
+ if (expr.kind !== 'f_string')
2125
+ return JSON.stringify(expr.kind === 'str_lit' ? { text: expr.value } : { text: '~' });
2126
+ const objective = `__${namespace}`;
2127
+ const extra = [];
2128
+ for (const part of expr.parts) {
2129
+ if (part.kind === 'text') {
2130
+ if (part.value)
2131
+ extra.push({ text: part.value });
2132
+ }
2133
+ else {
2134
+ // expr part — must be a scoreboard variable (ident)
2135
+ const inner = part.expr;
2136
+ if (inner.kind === 'ident') {
2137
+ extra.push({ score: { name: `$${inner.name}`, objective } });
2138
+ }
2139
+ else if (inner.kind === 'int_lit') {
2140
+ extra.push({ text: String(inner.value) });
2141
+ }
2142
+ else {
2143
+ extra.push({ text: '?' });
2144
+ }
2145
+ }
2146
+ }
2147
+ if (extra.length === 0)
2148
+ return '{"text":""}';
2149
+ if (extra.length === 1)
2150
+ return JSON.stringify(extra[0]);
2151
+ return JSON.stringify({ text: '', extra });
2152
+ }
2153
+ function formatBuiltinCall(fn, args, macroParams, namespace = '') {
2154
+ // For text-display builtins, the message arg may be an f_string — convert to JSON text
2155
+ const TEXT_BUILTINS = new Set(['tell', 'tellraw', 'title', 'subtitle', 'actionbar', 'announce']);
2156
+ const resolveTextArg = (arg) => {
2157
+ if (arg.kind === 'f_string')
2158
+ return fStringToJsonText(arg, namespace);
2159
+ return JSON.stringify({ text: exprToCommandArg(arg, macroParams).str });
2160
+ };
1549
2161
  const fmtArgs = args.map(a => exprToCommandArg(a, macroParams));
1550
2162
  const strs = fmtArgs.map(a => a.str);
1551
2163
  const hasMacro = fmtArgs.some(a => a.isMacro);
@@ -1603,24 +2215,34 @@ function formatBuiltinCall(fn, args, macroParams) {
1603
2215
  cmd = `say ${strs[0] ?? ''}`;
1604
2216
  break;
1605
2217
  case 'tell':
1606
- case 'tellraw':
1607
- cmd = `tellraw ${strs[0]} {"text":"${strs[1]}"}`;
2218
+ case 'tellraw': {
2219
+ const msgJson = resolveTextArg(args[1]);
2220
+ cmd = `tellraw ${strs[0]} ${msgJson}`;
1608
2221
  break;
1609
- case 'title':
1610
- cmd = `title ${strs[0]} title {"text":"${strs[1]}"}`;
2222
+ }
2223
+ case 'title': {
2224
+ const msgJson = resolveTextArg(args[1]);
2225
+ cmd = `title ${strs[0]} title ${msgJson}`;
1611
2226
  break;
1612
- case 'actionbar':
1613
- cmd = `title ${strs[0]} actionbar {"text":"${strs[1]}"}`;
2227
+ }
2228
+ case 'actionbar': {
2229
+ const msgJson = resolveTextArg(args[1]);
2230
+ cmd = `title ${strs[0]} actionbar ${msgJson}`;
1614
2231
  break;
1615
- case 'subtitle':
1616
- cmd = `title ${strs[0]} subtitle {"text":"${strs[1]}"}`;
2232
+ }
2233
+ case 'subtitle': {
2234
+ const msgJson = resolveTextArg(args[1]);
2235
+ cmd = `title ${strs[0]} subtitle ${msgJson}`;
1617
2236
  break;
2237
+ }
1618
2238
  case 'title_times':
1619
2239
  cmd = `title ${strs[0]} times ${strs[1]} ${strs[2]} ${strs[3]}`;
1620
2240
  break;
1621
- case 'announce':
1622
- cmd = `tellraw @a {"text":"${strs[0]}"}`;
2241
+ case 'announce': {
2242
+ const msgJson = resolveTextArg(args[0]);
2243
+ cmd = `tellraw @a ${msgJson}`;
1623
2244
  break;
2245
+ }
1624
2246
  case 'give': {
1625
2247
  const nbt = strs[3] ? strs[3] : '';
1626
2248
  cmd = `give ${strs[0]} ${strs[1]}${nbt} ${strs[2] ?? '1'}`;
@@ -1659,6 +2281,13 @@ function formatBuiltinCall(fn, args, macroParams) {
1659
2281
  case 'tag_remove':
1660
2282
  cmd = `tag ${strs[0]} remove ${strs[1]}`;
1661
2283
  break;
2284
+ // entity.tag(name) / entity.untag(name) sugar — same as tag_add/tag_remove
2285
+ case '__entity_tag':
2286
+ cmd = `tag ${strs[0]} add ${strs[1]}`;
2287
+ break;
2288
+ case '__entity_untag':
2289
+ cmd = `tag ${strs[0]} remove ${strs[1]}`;
2290
+ break;
1662
2291
  case 'kick':
1663
2292
  cmd = `kick ${strs[0]} ${strs[1] ?? ''}`.trim();
1664
2293
  break;