redscript-mc 1.2.20 → 1.2.24
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.
- package/.github/workflows/publish-extension-on-ci.yml +99 -0
- package/dist/__tests__/compile-all.test.js +5 -0
- package/dist/__tests__/entity-types.test.d.ts +1 -0
- package/dist/__tests__/entity-types.test.js +203 -0
- package/dist/__tests__/var-allocator.test.d.ts +1 -0
- package/dist/__tests__/var-allocator.test.js +69 -0
- package/dist/ast/types.d.ts +2 -1
- package/dist/cli.js +24 -7
- package/dist/codegen/mcfunction/index.d.ts +2 -0
- package/dist/codegen/mcfunction/index.js +47 -43
- package/dist/codegen/structure/index.d.ts +4 -1
- package/dist/codegen/structure/index.js +8 -12
- package/dist/codegen/var-allocator.d.ts +28 -0
- package/dist/codegen/var-allocator.js +74 -0
- package/dist/compile.d.ts +8 -0
- package/dist/compile.js +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -7
- package/dist/lowering/index.d.ts +2 -0
- package/dist/lowering/index.js +62 -3
- package/dist/optimizer/dce.d.ts +2 -1
- package/dist/optimizer/dce.js +13 -2
- package/dist/parser/index.js +22 -1
- package/dist/typechecker/index.js +30 -0
- package/dist/types/entity-hierarchy.d.ts +29 -0
- package/dist/types/entity-hierarchy.js +107 -0
- package/editors/vscode/out/extension.js +29 -4
- package/editors/vscode/package-lock.json +6 -4
- package/editors/vscode/package.json +3 -3
- package/package.json +1 -1
- package/src/__tests__/compile-all.test.ts +6 -0
- package/src/__tests__/entity-types.test.ts +236 -0
- package/src/__tests__/var-allocator.test.ts +75 -0
- package/src/ast/types.ts +8 -4
- package/src/cli.ts +28 -8
- package/src/codegen/mcfunction/index.ts +55 -48
- package/src/codegen/structure/index.ts +9 -14
- package/src/codegen/var-allocator.ts +71 -0
- package/src/compile.ts +18 -0
- package/src/examples/capture_the_flag.mcrs +34 -34
- package/src/examples/hunger_games.mcrs +60 -60
- package/src/examples/new_features_demo.mcrs +32 -32
- package/src/examples/parkour_race.mcrs +58 -58
- package/src/examples/zombie_survival.mcrs +73 -73
- package/src/index.ts +11 -7
- package/src/lowering/index.ts +73 -8
- package/src/optimizer/dce.ts +18 -2
- package/src/parser/index.ts +20 -1
- package/src/typechecker/index.ts +30 -0
- package/src/types/entity-hierarchy.ts +120 -0
- package/dist/data/arena/function/__load.mcfunction +0 -6
- package/dist/data/arena/function/__tick.mcfunction +0 -2
- package/dist/data/arena/function/announce_leaders/else_1.mcfunction +0 -3
- package/dist/data/arena/function/announce_leaders/foreach_0/merge_2.mcfunction +0 -1
- package/dist/data/arena/function/announce_leaders/foreach_0/then_0.mcfunction +0 -3
- package/dist/data/arena/function/announce_leaders/foreach_0.mcfunction +0 -7
- package/dist/data/arena/function/announce_leaders/foreach_1/merge_2.mcfunction +0 -1
- package/dist/data/arena/function/announce_leaders/foreach_1/then_0.mcfunction +0 -4
- package/dist/data/arena/function/announce_leaders/foreach_1.mcfunction +0 -6
- package/dist/data/arena/function/announce_leaders/merge_2.mcfunction +0 -1
- package/dist/data/arena/function/announce_leaders/then_0.mcfunction +0 -4
- package/dist/data/arena/function/announce_leaders.mcfunction +0 -6
- package/dist/data/arena/function/arena_tick/merge_2.mcfunction +0 -1
- package/dist/data/arena/function/arena_tick/then_0.mcfunction +0 -4
- package/dist/data/arena/function/arena_tick.mcfunction +0 -11
- package/dist/data/counter/function/__load.mcfunction +0 -5
- package/dist/data/counter/function/__tick.mcfunction +0 -2
- package/dist/data/counter/function/counter_tick/merge_2.mcfunction +0 -1
- package/dist/data/counter/function/counter_tick/then_0.mcfunction +0 -3
- package/dist/data/counter/function/counter_tick.mcfunction +0 -11
- package/dist/data/minecraft/tags/function/load.json +0 -5
- package/dist/data/minecraft/tags/function/tick.json +0 -5
- package/dist/data/quiz/function/__load.mcfunction +0 -16
- package/dist/data/quiz/function/__tick.mcfunction +0 -6
- package/dist/data/quiz/function/__trigger_quiz_a_dispatch.mcfunction +0 -4
- package/dist/data/quiz/function/__trigger_quiz_b_dispatch.mcfunction +0 -4
- package/dist/data/quiz/function/__trigger_quiz_c_dispatch.mcfunction +0 -4
- package/dist/data/quiz/function/__trigger_quiz_start_dispatch.mcfunction +0 -4
- package/dist/data/quiz/function/answer_a.mcfunction +0 -4
- package/dist/data/quiz/function/answer_b.mcfunction +0 -4
- package/dist/data/quiz/function/answer_c.mcfunction +0 -4
- package/dist/data/quiz/function/ask_question/else_1.mcfunction +0 -5
- package/dist/data/quiz/function/ask_question/else_4.mcfunction +0 -5
- package/dist/data/quiz/function/ask_question/else_7.mcfunction +0 -4
- package/dist/data/quiz/function/ask_question/merge_2.mcfunction +0 -1
- package/dist/data/quiz/function/ask_question/merge_5.mcfunction +0 -2
- package/dist/data/quiz/function/ask_question/merge_8.mcfunction +0 -2
- package/dist/data/quiz/function/ask_question/then_0.mcfunction +0 -4
- package/dist/data/quiz/function/ask_question/then_3.mcfunction +0 -4
- package/dist/data/quiz/function/ask_question/then_6.mcfunction +0 -4
- package/dist/data/quiz/function/ask_question.mcfunction +0 -7
- package/dist/data/quiz/function/finish_quiz.mcfunction +0 -6
- package/dist/data/quiz/function/handle_answer/else_1.mcfunction +0 -5
- package/dist/data/quiz/function/handle_answer/else_10.mcfunction +0 -3
- package/dist/data/quiz/function/handle_answer/else_16.mcfunction +0 -3
- package/dist/data/quiz/function/handle_answer/else_4.mcfunction +0 -3
- package/dist/data/quiz/function/handle_answer/else_7.mcfunction +0 -5
- package/dist/data/quiz/function/handle_answer/merge_11.mcfunction +0 -2
- package/dist/data/quiz/function/handle_answer/merge_14.mcfunction +0 -2
- package/dist/data/quiz/function/handle_answer/merge_17.mcfunction +0 -2
- package/dist/data/quiz/function/handle_answer/merge_2.mcfunction +0 -8
- package/dist/data/quiz/function/handle_answer/merge_5.mcfunction +0 -2
- package/dist/data/quiz/function/handle_answer/merge_8.mcfunction +0 -2
- package/dist/data/quiz/function/handle_answer/then_0.mcfunction +0 -5
- package/dist/data/quiz/function/handle_answer/then_12.mcfunction +0 -5
- package/dist/data/quiz/function/handle_answer/then_15.mcfunction +0 -6
- package/dist/data/quiz/function/handle_answer/then_3.mcfunction +0 -6
- package/dist/data/quiz/function/handle_answer/then_6.mcfunction +0 -5
- package/dist/data/quiz/function/handle_answer/then_9.mcfunction +0 -6
- package/dist/data/quiz/function/handle_answer.mcfunction +0 -11
- package/dist/data/quiz/function/start_quiz.mcfunction +0 -5
- package/dist/data/shop/function/__load.mcfunction +0 -7
- package/dist/data/shop/function/__tick.mcfunction +0 -3
- package/dist/data/shop/function/__trigger_shop_buy_dispatch.mcfunction +0 -4
- package/dist/data/shop/function/complete_purchase/else_1.mcfunction +0 -5
- package/dist/data/shop/function/complete_purchase/else_4.mcfunction +0 -5
- package/dist/data/shop/function/complete_purchase/else_7.mcfunction +0 -3
- package/dist/data/shop/function/complete_purchase/merge_2.mcfunction +0 -2
- package/dist/data/shop/function/complete_purchase/merge_5.mcfunction +0 -2
- package/dist/data/shop/function/complete_purchase/merge_8.mcfunction +0 -2
- package/dist/data/shop/function/complete_purchase/then_0.mcfunction +0 -4
- package/dist/data/shop/function/complete_purchase/then_3.mcfunction +0 -4
- package/dist/data/shop/function/complete_purchase/then_6.mcfunction +0 -4
- package/dist/data/shop/function/complete_purchase.mcfunction +0 -7
- package/dist/data/shop/function/handle_shop_trigger.mcfunction +0 -3
- package/dist/data/turret/function/__load.mcfunction +0 -5
- package/dist/data/turret/function/__tick.mcfunction +0 -4
- package/dist/data/turret/function/__trigger_deploy_turret_dispatch.mcfunction +0 -4
- package/dist/data/turret/function/deploy_turret.mcfunction +0 -8
- package/dist/data/turret/function/turret_tick/at_1.mcfunction +0 -2
- package/dist/data/turret/function/turret_tick/foreach_0.mcfunction +0 -2
- package/dist/data/turret/function/turret_tick/foreach_2.mcfunction +0 -2
- package/dist/data/turret/function/turret_tick/tick_body.mcfunction +0 -3
- package/dist/data/turret/function/turret_tick/tick_skip.mcfunction +0 -1
- package/dist/data/turret/function/turret_tick.mcfunction +0 -5
- package/dist/pack.mcmeta +0 -6
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: else_1
|
|
2
|
-
scoreboard players set $t2 rs 0
|
|
3
|
-
execute if score $question rs = $const_2 rs run scoreboard players set $t2 rs 1
|
|
4
|
-
execute if score $t2 rs matches 1.. run function quiz:ask_question/then_3
|
|
5
|
-
execute if score $t2 rs matches ..0 run function quiz:ask_question/else_4
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: else_4
|
|
2
|
-
scoreboard players set $t3 rs 0
|
|
3
|
-
execute if score $question rs = $const_3 rs run scoreboard players set $t3 rs 1
|
|
4
|
-
execute if score $t3 rs matches 1.. run function quiz:ask_question/then_6
|
|
5
|
-
execute if score $t3 rs matches ..0 run function quiz:ask_question/else_7
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# block: merge_2
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# block: entry
|
|
2
|
-
execute store result score $t0 rs run scoreboard players get @s quiz_question
|
|
3
|
-
scoreboard players operation $question rs = $t0 rs
|
|
4
|
-
scoreboard players set $t1 rs 0
|
|
5
|
-
execute if score $t0 rs = $const_1 rs run scoreboard players set $t1 rs 1
|
|
6
|
-
execute if score $t1 rs matches 1.. run function quiz:ask_question/then_0
|
|
7
|
-
execute if score $t1 rs matches ..0 run function quiz:ask_question/else_1
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# block: entry
|
|
2
|
-
execute store result score $t0 rs run scoreboard players get @s quiz_score
|
|
3
|
-
title @s title {"text":"Quiz Complete"}
|
|
4
|
-
tellraw @s {"text":"Your final quiz score is recorded in quiz_score."}
|
|
5
|
-
scoreboard players set @s quiz_question 0
|
|
6
|
-
execute store result score @s quiz_score run scoreboard players get $t1 rs
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: else_1
|
|
2
|
-
scoreboard players set $t5 rs 0
|
|
3
|
-
execute if score $question rs = $const_2 rs run scoreboard players set $t5 rs 1
|
|
4
|
-
execute if score $t5 rs matches 1.. run function quiz:handle_answer/then_6
|
|
5
|
-
execute if score $t5 rs matches ..0 run function quiz:handle_answer/else_7
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: else_7
|
|
2
|
-
scoreboard players set $t8 rs 0
|
|
3
|
-
execute if score $question rs = $const_3 rs run scoreboard players set $t8 rs 1
|
|
4
|
-
execute if score $t8 rs matches 1.. run function quiz:handle_answer/then_12
|
|
5
|
-
execute if score $t8 rs matches ..0 run function quiz:handle_answer/merge_14
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# block: merge_2
|
|
2
|
-
execute store result score @s quiz_score run scoreboard players get $t11 rs
|
|
3
|
-
scoreboard players operation $t12 rs = $question rs
|
|
4
|
-
scoreboard players operation $t12 rs += $const_1 rs
|
|
5
|
-
scoreboard players operation $question rs = $t12 rs
|
|
6
|
-
execute store result score @s quiz_question run scoreboard players get $t13 rs
|
|
7
|
-
function quiz:ask_question
|
|
8
|
-
scoreboard players operation $t14 rs = $ret rs
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: then_0
|
|
2
|
-
scoreboard players set $t3 rs 0
|
|
3
|
-
execute if score $choice rs = $const_1 rs run scoreboard players set $t3 rs 1
|
|
4
|
-
execute if score $t3 rs matches 1.. run function quiz:handle_answer/then_3
|
|
5
|
-
execute if score $t3 rs matches ..0 run function quiz:handle_answer/else_4
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: then_12
|
|
2
|
-
scoreboard players set $t9 rs 0
|
|
3
|
-
execute if score $choice rs = $const_2 rs run scoreboard players set $t9 rs 1
|
|
4
|
-
execute if score $t9 rs matches 1.. run function quiz:handle_answer/then_15
|
|
5
|
-
execute if score $t9 rs matches ..0 run function quiz:handle_answer/else_16
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: then_6
|
|
2
|
-
scoreboard players set $t6 rs 0
|
|
3
|
-
execute if score $choice rs = $const_2 rs run scoreboard players set $t6 rs 1
|
|
4
|
-
execute if score $t6 rs matches 1.. run function quiz:handle_answer/then_9
|
|
5
|
-
execute if score $t6 rs matches ..0 run function quiz:handle_answer/else_10
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# block: entry
|
|
2
|
-
scoreboard players operation $choice rs = $p0 rs
|
|
3
|
-
scoreboard players operation $choice rs = $p0 rs
|
|
4
|
-
execute store result score $t0 rs run scoreboard players get @s quiz_question
|
|
5
|
-
scoreboard players operation $question rs = $t0 rs
|
|
6
|
-
execute store result score $t1 rs run scoreboard players get @s quiz_score
|
|
7
|
-
scoreboard players operation $score rs = $t1 rs
|
|
8
|
-
scoreboard players set $t2 rs 0
|
|
9
|
-
execute if score $t0 rs = $const_1 rs run scoreboard players set $t2 rs 1
|
|
10
|
-
execute if score $t2 rs matches 1.. run function quiz:handle_answer/then_0
|
|
11
|
-
execute if score $t2 rs matches ..0 run function quiz:handle_answer/else_1
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: else_1
|
|
2
|
-
scoreboard players set $t2 rs 0
|
|
3
|
-
execute if score $choice rs = $const_2 rs run scoreboard players set $t2 rs 1
|
|
4
|
-
execute if score $t2 rs matches 1.. run function shop:complete_purchase/then_3
|
|
5
|
-
execute if score $t2 rs matches ..0 run function shop:complete_purchase/else_4
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: else_4
|
|
2
|
-
scoreboard players set $t3 rs 0
|
|
3
|
-
execute if score $choice rs = $const_3 rs run scoreboard players set $t3 rs 1
|
|
4
|
-
execute if score $t3 rs matches 1.. run function shop:complete_purchase/then_6
|
|
5
|
-
execute if score $t3 rs matches ..0 run function shop:complete_purchase/else_7
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# block: entry
|
|
2
|
-
execute store result score $t0 rs run scoreboard players get @s shop_choice
|
|
3
|
-
scoreboard players operation $choice rs = $t0 rs
|
|
4
|
-
scoreboard players set $t1 rs 0
|
|
5
|
-
execute if score $t0 rs = $const_1 rs run scoreboard players set $t1 rs 1
|
|
6
|
-
execute if score $t1 rs matches 1.. run function shop:complete_purchase/then_0
|
|
7
|
-
execute if score $t1 rs matches ..0 run function shop:complete_purchase/else_1
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# block: entry
|
|
2
|
-
summon minecraft:armor_stand 0 64 0 {Invisible:1b,Marker:1b,NoGravity:1b,Tags:["__rs_obj_0"]}
|
|
3
|
-
scoreboard players set @e[tag=__rs_obj_0,limit=1] rs 40
|
|
4
|
-
tag @e[tag=__rs_obj_0,limit=1] add turret
|
|
5
|
-
data modify storage rs:heap turretstate_state.health set value 40
|
|
6
|
-
execute store result score $t0 rs run data get storage rs:heap turretstate_state.health
|
|
7
|
-
execute store result score turret health run scoreboard players get $t1 rs
|
|
8
|
-
say Turret deployed.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# block: tick_skip
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# block: entry
|
|
2
|
-
scoreboard players add $__tick_turret_tick rs 1
|
|
3
|
-
execute store success score $__tick_turret_tick_check rs if score $__tick_turret_tick rs matches 20..
|
|
4
|
-
execute if score $__tick_turret_tick_check rs matches 1.. run function turret:turret_tick/tick_body
|
|
5
|
-
execute if score $__tick_turret_tick_check rs matches ..0 run function turret:turret_tick/tick_skip
|