From d7773fc2af6d4cd3823ece2a84c90188f8b26998 Mon Sep 17 00:00:00 2001 From: uran247 Date: Sun, 9 Jul 2023 17:15:25 +0900 Subject: [PATCH] add afterburner --- data/plane/functions/_index.d.mcfunction | 1 + .../functions/controll/flying.mcfunction | 2 +- .../functions/controll/rolling.mcfunction | 2 +- .../move/plane-afterburner.mcfunction | 33 +++++++++++++++++++ .../functions/move/plane-move.mcfunction | 4 +++ 5 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 data/plane/functions/move/plane-afterburner.mcfunction diff --git a/data/plane/functions/_index.d.mcfunction b/data/plane/functions/_index.d.mcfunction index 6939b6ed..d03fa5b5 100644 --- a/data/plane/functions/_index.d.mcfunction +++ b/data/plane/functions/_index.d.mcfunction @@ -4,6 +4,7 @@ #declare tag need-change-weapon #武器変更を実行するフラグが立っていることを示す #declare tag need-use-weapon #武器使用フラグが立っていることを示す #declare tag use-wep #WEP使用フラグが立っていることを示す + #declare tag reloading-wep #WEPリロードフラグが立っていることを示す #> weapon # @within function plane:weapon/** diff --git a/data/plane/functions/controll/flying.mcfunction b/data/plane/functions/controll/flying.mcfunction index 46c16308..2b5312bf 100644 --- a/data/plane/functions/controll/flying.mcfunction +++ b/data/plane/functions/controll/flying.mcfunction @@ -48,7 +48,7 @@ execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,tag #throttle20の時Wを3tick押下でWEP、WEP時Sを3tick押下でWEP解除、WEP解除後にSを押しっぱなしにしてもスロットルを下げないようにロック execute if entity @s[scores={vp.key-storoke=1..2}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run scoreboard players add @s vp.use-wep 1 execute if entity @s[scores={vp.key-storoke=8}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run scoreboard players add @s vp.use-wep 1 -execute as @e[tag=controll-target,tag=has-wep,scores={vp.use-wep=3..},distance=..1,limit=1] run tag @s add use-wep +execute as @e[tag=controll-target,tag=has-wep,tag=!reloading-wep,scores={vp.use-wep=3..},distance=..1,limit=1] run tag @s add use-wep execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,tag=use-wep,scores={vp.throttle=20},distance=..1,limit=1] run tag @s add throttle-change-lock execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,tag=use-wep,scores={vp.throttle=20},distance=..1,limit=1] run tag @s remove use-wep diff --git a/data/plane/functions/controll/rolling.mcfunction b/data/plane/functions/controll/rolling.mcfunction index b4bf665b..c89d49c4 100644 --- a/data/plane/functions/controll/rolling.mcfunction +++ b/data/plane/functions/controll/rolling.mcfunction @@ -35,7 +35,7 @@ execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,tag #throttle20の時Wを3tick押下でWEP、WEP時Sを3tick押下でWEP解除、WEP解除後にSを押しっぱなしにしてもスロットルを下げないようにロック execute if entity @s[scores={vp.key-storoke=1..2}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run scoreboard players add @s vp.use-wep 1 execute if entity @s[scores={vp.key-storoke=8}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run scoreboard players add @s vp.use-wep 1 -execute as @e[tag=controll-target,tag=has-wep,scores={vp.use-wep=3..},distance=..1,limit=1] run tag @s add use-wep +execute as @e[tag=controll-target,tag=has-wep,tag=!reloading-wep,scores={vp.use-wep=3..},distance=..1,limit=1] run tag @s add use-wep execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,tag=use-wep,scores={vp.throttle=20},distance=..1,limit=1] run tag @s add throttle-change-lock execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,tag=use-wep,scores={vp.throttle=20},distance=..1,limit=1] run tag @s remove use-wep diff --git a/data/plane/functions/move/plane-afterburner.mcfunction b/data/plane/functions/move/plane-afterburner.mcfunction new file mode 100644 index 00000000..9a2e83a5 --- /dev/null +++ b/data/plane/functions/move/plane-afterburner.mcfunction @@ -0,0 +1,33 @@ +#> plane:move/plane-afterburner +# +# @input +# execute @e[tag=plane-root] +# +# @within function plane:move/plane-move + +#> prv +# @private + #declare score_holder #wep-time + #declare score_holder #wep-reload + +#WEPリロード減算 +execute if entity @s[tag=reloading-wep] store result score #wep-reload vp.reg1 store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine.wep-reload int 1 run data get storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine.wep-reload 0.9999999999999999 +execute if entity @s[tag=reloading-wep] if score #wep-reload vp.reg1 matches ..0 run data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine.wep-time set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine.max-wep-time + + execute if entity @s[tag=reloading-wep] if score #wep-reload vp.reg1 matches ..0 run say reload-end + +execute if entity @s[tag=reloading-wep] if score #wep-reload vp.reg1 matches ..0 run tag @s remove reloading-wep + + + +#wep時間減算 +execute if entity @s[tag=use-wep,tag=!reloading-wep] store result score #wep-time vp.reg1 store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine.wep-time int 1 run data get storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine.wep-time 0.9999999999999999 +execute if entity @s[tag=use-wep,tag=!reloading-wep] if score #wep-time vp.reg1 matches ..0 run data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine.wep-reload set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine.max-wep-reload + + execute if entity @s[tag=use-wep,tag=!reloading-wep] if score #wep-time vp.reg1 matches ..0 run say reloading + +execute if entity @s[tag=use-wep,tag=!reloading-wep] if score #wep-time vp.reg1 matches ..0 run tag @s add reloading-wep +execute if entity @s[tag=use-wep,tag=reloading-wep] if score #wep-time vp.reg1 matches ..0 run tag @s remove use-wep + + + diff --git a/data/plane/functions/move/plane-move.mcfunction b/data/plane/functions/move/plane-move.mcfunction index 9b4d8bac..c396e66f 100644 --- a/data/plane/functions/move/plane-move.mcfunction +++ b/data/plane/functions/move/plane-move.mcfunction @@ -14,6 +14,9 @@ tag @s add plane-move-executer #scoreboard players operation #plane-id vp.reg1 = @s plane-id #execute as @e[distance=..20,tag=plane] if score @s plane-id = #plane-id vp.reg1 run tag @s add target-parts +#afterburner処理 +function plane:move/plane-afterburner + #飛行・滑走実行 execute if entity @s[tag=!flying] run function plane:move/plane-move/rolling execute if entity @s[tag=flying] run function plane:move/plane-move/flying @@ -22,6 +25,7 @@ execute if entity @s[tag=flying] run function plane:move/plane-move/flying execute if entity @s[tag=!flying] run function plane:move/plane-move/turn-rolling execute if entity @s[tag=flying] run function plane:move/plane-move/turn-flying + #title @a times 0 80 20 #title @a subtitle [{"text":"加速力:","color":"yellow","bold":false},{"score" : {"name":"#base-accelerate", "objective":"vp.reg1"}},{"text":" 旋回速度","color":"yellow","bold":false},{"score" : {"name":"#max-yaw", "objective":"vp.reg1"}}] #title @a title {"text":" "}