From 1839997f2e50a013a077330d5cc8a112d81146d9 Mon Sep 17 00:00:00 2001 From: uran247 Date: Sat, 8 Jul 2023 01:14:26 +0900 Subject: [PATCH] add afterburner --- .../functions/addscoreboard.mcfunction | 2 ++ .../functions/addstorage.mcfunction | 2 +- .../functions/plane-data_index.d.mcfunction | 1 + .../saab29f/saab29f-position.mcfunction | 2 +- .../saab29f/saab29f-storage.mcfunction | 18 +++++++----- .../functions/saab29f/saab29f.mcfunction | 11 ++++--- .../util/culc-deaccelerate.mcfunction | 1 + .../functions/util/culc-resistance.mcfunction | 1 + .../functions/util/set-plane-score.mcfunction | 4 ++- data/plane/functions/_index.d.mcfunction | 1 + .../functions/controll/flying.mcfunction | 22 ++++++++++---- .../functions/controll/rolling.mcfunction | 24 ++++++++++----- .../move/plane-move/flying.mcfunction | 1 + .../plane-move/flying/flying-sound.mcfunction | 1 + .../move/plane-move/rolling.mcfunction | 1 + .../rolling/rolling-sound.mcfunction | 1 + data/plane/functions/plane-info.mcfunction | 9 ++++-- .../functions/position/position.mcfunction | 10 ++++--- .../util/calc-displacement.mcfunction | 7 ++++- .../position/util/modify-angle.mcfunction | 3 +- .../position/util/set-translation.mcfunction | 5 ++++ .../util/toggle-afterburner.mcfunction | 22 ++++++++++++++ .../summon/summon-afterburner.mcfunction | 29 +++++++++++++++++++ data/plane/functions/tick.mcfunction | 1 + 24 files changed, 143 insertions(+), 36 deletions(-) create mode 100644 data/plane/functions/position/util/toggle-afterburner.mcfunction create mode 100644 data/plane/functions/summon/summon-afterburner.mcfunction diff --git a/data/constructor/functions/addscoreboard.mcfunction b/data/constructor/functions/addscoreboard.mcfunction index 9eff200f..d265b3fe 100644 --- a/data/constructor/functions/addscoreboard.mcfunction +++ b/data/constructor/functions/addscoreboard.mcfunction @@ -56,9 +56,11 @@ scoreboard objectives add vp.body dummy scoreboard objectives add vp.max-engine dummy scoreboard objectives add vp.horse-power dummy scoreboard objectives add vp.thrust dummy +scoreboard objectives add vp.wep-thrust dummy scoreboard objectives add vp.weight dummy scoreboard objectives add vp.add-weight dummy scoreboard objectives add vp.throttle dummy +scoreboard objectives add vp.use-wep dummy scoreboard objectives add vp.yaw-gap dummy scoreboard objectives add vp.pitch-gap dummy scoreboard objectives add vp.sound dummy diff --git a/data/constructor/functions/addstorage.mcfunction b/data/constructor/functions/addstorage.mcfunction index d971949c..d685e818 100644 --- a/data/constructor/functions/addstorage.mcfunction +++ b/data/constructor/functions/addstorage.mcfunction @@ -19,7 +19,7 @@ data merge storage minecraft:plane-datapack {temporary:{Pos:[0.0d,0.0d,0.0d]},It data merge storage minecraft:plane-datapack-weapon {gun-data:[{plane-id:0,Pos:[0.0,0.0,0.0],speed:[0.0,0.0,0.0]}]} #data version指定 -execute store success score #is-different-data vp.reg1 run data modify storage minecraft:plane-datapack data-version set value "0.9.1.000000115" +execute store success score #is-different-data vp.reg1 run data modify storage minecraft:plane-datapack data-version set value "0.9.1.000000121" #航空機個別ストレージ作成 execute if score #is-different-data vp.reg1 matches 1 run function #constructor:add-storage diff --git a/data/plane-data/functions/plane-data_index.d.mcfunction b/data/plane-data/functions/plane-data_index.d.mcfunction index 3a6cab49..efcd0676 100644 --- a/data/plane-data/functions/plane-data_index.d.mcfunction +++ b/data/plane-data/functions/plane-data_index.d.mcfunction @@ -42,6 +42,7 @@ #declare tag plane-bomb #爆弾であることを示す #declare tag plane-rocket #ロケット弾であることを示す #declare tag plane-torpedo #ロケット弾であることを示す + #declare tag plane-afterburner #アフターバーナーの見た目であることを示す #declare tag has-torpedo #魚雷を持っていることを示す #declare tag has-rocket #ロケット弾を持っていることを示す #declare tag plane-missile #ミサイルであることを示す diff --git a/data/plane-data/functions/saab29f/saab29f-position.mcfunction b/data/plane-data/functions/saab29f/saab29f-position.mcfunction index daceddc4..fcc5ea65 100644 --- a/data/plane-data/functions/saab29f/saab29f-position.mcfunction +++ b/data/plane-data/functions/saab29f/saab29f-position.mcfunction @@ -8,5 +8,5 @@ # @within plane:position/position-individual #seatの位置修正 -execute at @s[tag=has-rider] run tp @e[tag=plane-seat,tag=target-parts,distance=..32] ^ ^ ^ +execute at @s[tag=has-rider] run tp @e[tag=plane-seat,tag=target-parts,distance=..32] ^ ^0.8 ^-8 execute at @s[tag=!has-rider] run tp @e[tag=plane-seat,tag=target-parts,distance=..32] ^ ^ ^ \ No newline at end of file diff --git a/data/plane-data/functions/saab29f/saab29f-storage.mcfunction b/data/plane-data/functions/saab29f/saab29f-storage.mcfunction index d535cd9c..91e1cb94 100644 --- a/data/plane-data/functions/saab29f/saab29f-storage.mcfunction +++ b/data/plane-data/functions/saab29f/saab29f-storage.mcfunction @@ -11,18 +11,22 @@ data modify storage voxel-planes:plane saab29f.plane-data.plane-type set value f data modify storage voxel-planes:plane saab29f.plane-data.tier set value 5 data modify storage voxel-planes:plane saab29f.plane-data.flight-model.weight set value 6060 data modify storage voxel-planes:plane saab29f.plane-data.flight-model.speed set value {max-speed:1060f,cruise-speed:800f,climb-rate:32.1f,stall-speed:200f} -data modify storage voxel-planes:plane saab29f.plane-data.flight-model.engine set value {type:jet,thrust:2270f,wep-thrust:2800f,number:1} +data modify storage voxel-planes:plane saab29f.plane-data.flight-model.engine set value {type:jet,thrust:2270f,wep-thrust:2800f,number:1,wep-time:1200,wep-reload:1200} data modify storage voxel-planes:plane saab29f.plane-data.flight-model.turn-rate set value {pitch:25f,yaw:17.5f,roll:163.6f} data modify storage voxel-planes:plane saab29f.plane-data.flight-model.energy-loss-rate set value 0.5 data modify storage voxel-planes:plane saab29f.plane-data.model-data.body set value {parking-cmd:211,rolling-cmd:211,flying-cmd:212} data modify storage voxel-planes:plane saab29f.plane-data.model-data.landing-pitch set value -1 +data modify storage voxel-planes:plane saab29f.plane-data.model-data.scale set value [1f,1f,1f] +data modify storage voxel-planes:plane saab29f.plane-data.model-data.translation set value [0f,0f,0f] +data modify storage voxel-planes:plane saab29f.plane-data.model-data.central-axis-offset set value 1.375 +data modify storage voxel-planes:plane saab29f.plane-data.model-data.afterburner set value [{scale:[0.5f,0.5f,1.8f],translation:[-0.25f,-0.4f,-8f]}] data modify storage voxel-planes:plane saab29f.plane-data.hitbox set value {} -data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {engine:{max-hp:200,offset:[0d,0d,0d]}} -data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {aileron-r:{max-hp:200,offset:[-3d,0d,0d]},aileron-l:{max-hp:200,offset:[3d,0d,0d]}} -data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {elevator-r:{max-hp:170,offset:[-1d,0d,-4d]},elevator-l:{max-hp:170,offset:[1d,0d,-4d]}} -data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {radder:{max-hp:180,offset:[0d,3d,-4d]}} -data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {cockpit:{offset:[0d,1d,1d]}} -data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {body:{max-hp:220,offset:[0d,0d,0d]}} +data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {engine:{max-hp:200,offset:[0d,-0.5d,-3d],width:1.2,height:1.2}} +data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {aileron-r:{max-hp:200,offset:[-3d,-0.4d,-2.8d],width:1.5,height:1.5},aileron-l:{max-hp:200,offset:[3d,-0.4d,-2.8d],width:1.5,height:1.5}} +data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {elevator-r:{max-hp:170,offset:[-1d,0.8d,-7.6d],width:1,height:1},elevator-l:{max-hp:170,offset:[1d,0.8d,-7.6d],width:1,height:1}} +data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {radder:{max-hp:180,offset:[0d,1.7d,-7.3d],width:0.8,height:0.8}} +data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {cockpit:{offset:[0d,0.8d,0d],width:0.5,height:0.5}} +data modify storage voxel-planes:plane saab29f.plane-data.hitbox merge value {body:{max-hp:220,offset:[0d,-0.6d,-1d],width:1.2,height:1.2}} #デフォルト機銃データセット data modify storage voxel-planes:weapon saab29f.base.gun set value {data:{name:"20mm",type:gun,size:20mm,max-ammunition:180,current-ammunition:180,max-cooltime:2,current-cooltime:0,max-reload:280,current-reload:0,tracer:"yellow",damage:150,speed:10.5f,bullets:[{offset:[-0.5d,-0.5d,1.5d]},{offset:[0.5d,-0.5d,1.5d]},{offset:[-1d,-0.5d,1d]},{offset:[1d,-0.5d,1d]}]}} diff --git a/data/plane-data/functions/saab29f/saab29f.mcfunction b/data/plane-data/functions/saab29f/saab29f.mcfunction index 7173a657..2ce34087 100644 --- a/data/plane-data/functions/saab29f/saab29f.mcfunction +++ b/data/plane-data/functions/saab29f/saab29f.mcfunction @@ -21,12 +21,9 @@ #機体召喚 summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,NoGravity:0b,Tags:[saab29f,plane-init,plane-root,plane,entity-nohit,need-calc-offset,delay-rotation,tier1],DisabledSlots:256} summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,NoGravity:0b,Tags:[saab29f,plane-init,plane,entity-nohit,plane-seat],Passengers:[{id:"donkey",Attributes:[{Name:"generic.max_health",Base:20d}],Invulnerable:1b,DeathLootTable:"minecraft:entities/bat",SaddleItem:{id:"minecraft:saddle",Count:1b},Tame:1b,NoAI:1b,Silent:1b,ChestedHorse:1b,ActiveEffects:[{Id:14b,Amplifier:0b,Duration:1000000,ShowParticles:0b}],Tags:[saab29f,plane-init,plane,plane-seat,entity-nohit]}],DisabledSlots:256} -summon armor_stand ~ ~ ~ {Tags:[plane-body,saab29f,plane-init,plane,has-model,model-changeable,entity-nohit],NoGravity:1b,Invisible:1b,HandItems:[{id:"minecraft:diamond_sword",Count:1b,tag:{CustomModelData:85,Unbreakable:1b}},{}],Pose:{LeftArm:[0f,0f,0f],RightArm:[-12f,0f,0f]},DisabledSlots:256} +summon item_display ~ ~ ~ {Tags:[plane-body,saab29f,plane-init,plane,has-model,model-changeable,entity-nohit],NoGravity:1b,item:{id:"minecraft:diamond_sword",Count:1b,tag:{CustomModelData:85,Unbreakable:1b}},interpolation_duration:0,view_range:4.0f,transformation:{right_rotation:{angle:0f,axis:[0f,1f,0f]},left_rotation:{angle:0f,axis:[0f,0f,1f]},scale:[1f,1f,1f],translation:[0f,1.5f,0f]},item_display:"thirdperson_righthand"} ride @e[tag=plane-init,tag=plane-body,distance=..1,limit=1] mount @e[tag=plane-init,tag=plane-root,distance=..1,limit=1] -#ID付与 -execute as @e[tag=plane-init,tag=plane-root,distance=..1,limit=1] at @s run function plane:summon/set-plane-id - #ohmydat呼び出し execute as @e[tag=plane-init,tag=plane-root,distance=..1] run function oh_my_dat:please @@ -35,6 +32,12 @@ data remove storage voxel-planes:input input data modify storage voxel-planes:input input set from storage voxel-planes:plane saab29f.plane-data function plane-data:util/set-plane-sotrage +#afterburner召喚 +execute if data storage voxel-planes:input input.model-data.afterburner as @e[tag=plane-init,tag=plane-root,distance=..1,limit=1] run function plane:summon/summon-afterburner + +#ID付与 +execute as @e[tag=plane-init,tag=plane-root,distance=..1,limit=1] at @s run function plane:summon/set-plane-id + #飛行スコアセット execute as @e[tag=plane-init,tag=plane-root,distance=..1] run function plane-data:util/set-plane-score execute as @e[type=donkey,tag=plane-init,distance=..1] run function plane-data:util/set-plane-maxhp diff --git a/data/plane-data/functions/util/culc-deaccelerate.mcfunction b/data/plane-data/functions/util/culc-deaccelerate.mcfunction index 15ad15c0..5feb560f 100644 --- a/data/plane-data/functions/util/culc-deaccelerate.mcfunction +++ b/data/plane-data/functions/util/culc-deaccelerate.mcfunction @@ -24,6 +24,7 @@ execute store result score #weight vp.reg1 run data get storage voxel-planes:input input.flight-model.weight execute store result score #horse-power vp.reg1 run data get storage voxel-planes:input input.flight-model.engine.horse-power execute store result score #thrust vp.reg1 run data get storage voxel-planes:input input.flight-model.engine.thrust +execute if score #thrust vp.reg1 matches 0 store result score #thrust vp.reg1 run data get storage voxel-planes:input input.flight-model.engine.wep-thrust execute store result score #engine-number vp.reg1 run data get storage voxel-planes:input input.flight-model.engine.number execute store result score #cruise-speed vp.reg1 run data get storage voxel-planes:input input.flight-model.speed.cruise-speed 34.72 scoreboard players set #deaccelerate vp.return 1837500 diff --git a/data/plane-data/functions/util/culc-resistance.mcfunction b/data/plane-data/functions/util/culc-resistance.mcfunction index 1bca0782..524543a8 100644 --- a/data/plane-data/functions/util/culc-resistance.mcfunction +++ b/data/plane-data/functions/util/culc-resistance.mcfunction @@ -35,6 +35,7 @@ scoreboard players operation #resistance vp.return /= #max-speed vp.reg1 # for jet execute store result score #thrust vp.reg1 run data get storage voxel-planes:input input.flight-model.engine.thrust +execute if score #thrust vp.reg1 matches 0 store result score #thrust vp.reg1 run data get storage voxel-planes:input input.flight-model.engine.wep-thrust scoreboard players set #jet-resistance vp.return 245 scoreboard players operation #jet-resistance vp.return *= #thrust vp.reg1 scoreboard players operation #jet-resistance vp.return *= #engine-number vp.reg1 diff --git a/data/plane-data/functions/util/set-plane-score.mcfunction b/data/plane-data/functions/util/set-plane-score.mcfunction index b0b4a681..410dda93 100644 --- a/data/plane-data/functions/util/set-plane-score.mcfunction +++ b/data/plane-data/functions/util/set-plane-score.mcfunction @@ -69,10 +69,12 @@ execute as @e[tag=plane-init,tag=has-model,distance=..1] run data modify entity execute store result score @s vp.model-offset-y run data get storage voxel-planes:input input.model-data.translation[1] 1000 execute store result score @s vp.central-axis-offset-y run data get storage voxel-planes:input input.model-data.central-axis-offset 1000 -#エンジン数、馬力、推力設定 +#エンジン数、馬力、推力、WEP有無設定 execute store result score @s vp.max-engine run data get storage voxel-planes:input input.flight-model.engine.number execute store result score @s vp.horse-power run data get storage voxel-planes:input input.flight-model.engine.horse-power execute store result score @s vp.thrust run data get storage voxel-planes:input input.flight-model.engine.thrust +execute store result score @s vp.wep-thrust run data get storage voxel-planes:input input.flight-model.engine.wep-thrust +execute if score @s vp.wep-thrust matches 1.. run tag @s add has-wep #機体重量設定 execute store result score @s vp.weight run data get storage voxel-planes:input input.flight-model.weight diff --git a/data/plane/functions/_index.d.mcfunction b/data/plane/functions/_index.d.mcfunction index 8a8cb554..6939b6ed 100644 --- a/data/plane/functions/_index.d.mcfunction +++ b/data/plane/functions/_index.d.mcfunction @@ -3,6 +3,7 @@ # @within function plane:** #declare tag need-change-weapon #武器変更を実行するフラグが立っていることを示す #declare tag need-use-weapon #武器使用フラグが立っていることを示す + #declare tag use-wep #WEP使用フラグが立っていることを示す #> weapon # @within function plane:weapon/** diff --git a/data/plane/functions/controll/flying.mcfunction b/data/plane/functions/controll/flying.mcfunction index 711755ed..46c16308 100644 --- a/data/plane/functions/controll/flying.mcfunction +++ b/data/plane/functions/controll/flying.mcfunction @@ -16,6 +16,7 @@ #> private # @private #declare tag overlook #旋回をロックしていることを示す + #declare tag throttle-change-lock #スロットル変更をロックしていることを示す #declare score_holder #source-rot #プレイヤーの向いている角度[degree*100]を示す #declare score_holder #target-rot #機体の向いている角度[degree*100]を示す #declare score_holder #defference #Y軸の現在の機体の角度とプレイヤーが向いている角度の差分を示す @@ -40,13 +41,22 @@ execute if entity @s[tag=!overlook] run scoreboard players operation @e[tag=cont #execute if entity @s[scores={vp.key-input=6}] as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players remove @s[scores={vp.throttle=1..}] vp.throttle 1 #W押下でthrottleが+1,S押下で-1 -execute if entity @s[scores={vp.key-storoke=1..2}] as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players add @s[scores={vp.throttle=..19}] vp.throttle 1 -execute if entity @s[scores={vp.key-storoke=8}] as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players add @s[scores={vp.throttle=..19}] vp.throttle 1 -execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players remove @s[scores={vp.throttle=1..}] vp.throttle 1 +execute if entity @s[scores={vp.key-storoke=1..2}] as @e[tag=controll-target,tag=!throttle-change-lock,distance=..1,limit=1] run scoreboard players add @s[scores={vp.throttle=..19}] vp.throttle 1 +execute if entity @s[scores={vp.key-storoke=8}] as @e[tag=controll-target,tag=!throttle-change-lock,distance=..1,limit=1] run scoreboard players add @s[scores={vp.throttle=..19}] vp.throttle 1 +execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,tag=!throttle-change-lock,tag=!use-wep,distance=..1,limit=1] run scoreboard players remove @s[scores={vp.throttle=1..}] vp.throttle 1 -#稼働エンジン数に応じてスロットル減衰 スロットル×稼働エンジン数/最大エンジン数 -#execute as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players operation @s vp.throttle *= @s vp.engine -#execute as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players operation @s vp.throttle /= @s vp.max-engine +#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 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 + +execute if entity @s[scores={vp.key-storoke=0}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run scoreboard players set @s vp.use-wep 0 +execute if entity @s[scores={vp.key-storoke=3..7}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run scoreboard players set @s vp.use-wep 0 +execute if entity @s[scores={vp.key-storoke=0..3}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run tag @s remove throttle-change-lock +execute if entity @s[scores={vp.key-storoke=7..8}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run tag @s remove throttle-change-lock #墜落してた場合スロットル0 scoreboard players set @e[tag=controll-target,tag=destroyed,distance=..1,limit=1] vp.throttle 0 diff --git a/data/plane/functions/controll/rolling.mcfunction b/data/plane/functions/controll/rolling.mcfunction index 454a0fc6..b4bf665b 100644 --- a/data/plane/functions/controll/rolling.mcfunction +++ b/data/plane/functions/controll/rolling.mcfunction @@ -15,6 +15,7 @@ #> private # @private #declare tag overlook #旋回をロックしていることを示す + #declare tag throttle-change-lock #スロットル変更をロックしていることを示す #declare score_holder #source-rot #プレイヤーの向いている角度[degree*100]を示す #declare score_holder #target-rot #機体の向いている角度[degree*100]を示す #declare score_holder #defference #Y軸の現在の機体の角度とプレイヤーが向いている角度の差分を示す @@ -27,13 +28,22 @@ tag @s[scores={vp.key-input=8}] add overlook #execute if entity @s[scores={vp.key-input=6}] as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players remove @s[scores={vp.throttle=1..}] vp.throttle 1 #W押下でthrottleが+1,S押下で-1 -execute if entity @s[scores={vp.key-storoke=1..2}] as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players add @s[scores={vp.throttle=..19}] vp.throttle 1 -execute if entity @s[scores={vp.key-storoke=8}] as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players add @s[scores={vp.throttle=..19}] vp.throttle 1 -execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players remove @s[scores={vp.throttle=1..}] vp.throttle 1 - -#稼働エンジン数に応じてスロットル減衰 スロットル×稼働エンジン数/最大エンジン数 -#execute as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players operation @s vp.throttle *= @s vp.engine -#execute as @e[tag=controll-target,distance=..1,limit=1] run scoreboard players operation @s vp.throttle /= @s vp.max-engine +execute if entity @s[scores={vp.key-storoke=1..2}] as @e[tag=controll-target,tag=!throttle-change-lock,distance=..1,limit=1] run scoreboard players add @s[scores={vp.throttle=..19}] vp.throttle 1 +execute if entity @s[scores={vp.key-storoke=8}] as @e[tag=controll-target,tag=!throttle-change-lock,distance=..1,limit=1] run scoreboard players add @s[scores={vp.throttle=..19}] vp.throttle 1 +execute if entity @s[scores={vp.key-storoke=4..6}] as @e[tag=controll-target,tag=!throttle-change-lock,tag=!use-wep,distance=..1,limit=1] run scoreboard players remove @s[scores={vp.throttle=1..}] vp.throttle 1 + +#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 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 + +execute if entity @s[scores={vp.key-storoke=0}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run scoreboard players set @s vp.use-wep 0 +execute if entity @s[scores={vp.key-storoke=3..7}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run scoreboard players set @s vp.use-wep 0 +execute if entity @s[scores={vp.key-storoke=0..3}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run tag @s remove throttle-change-lock +execute if entity @s[scores={vp.key-storoke=7..8}] as @e[tag=controll-target,scores={vp.throttle=20},distance=..1,limit=1] run tag @s remove throttle-change-lock #墜落してた場合スロットル0 scoreboard players set @e[tag=controll-target,tag=destroyed,distance=..1,limit=1] vp.throttle 0 diff --git a/data/plane/functions/move/plane-move/flying.mcfunction b/data/plane/functions/move/plane-move/flying.mcfunction index 09bbd61d..3d96675f 100644 --- a/data/plane/functions/move/plane-move/flying.mcfunction +++ b/data/plane/functions/move/plane-move/flying.mcfunction @@ -44,6 +44,7 @@ execute if score #speed vp.input < #half-cruise-speed vp.reg1 run scoreboard pla scoreboard players operation #horse-power vp.input = @s vp.horse-power scoreboard players operation #horse-power vp.input *= @s vp.engine scoreboard players operation #thrust vp.input = @s vp.thrust +execute if entity @s[tag=use-wep] unless score @s vp.wep-thrust matches ..0 run scoreboard players operation #thrust vp.input = @s vp.wep-thrust scoreboard players operation #thrust vp.input *= @s vp.engine scoreboard players operation #weight vp.input = @s vp.weight scoreboard players operation #weight vp.input += @s vp.add-weight diff --git a/data/plane/functions/move/plane-move/flying/flying-sound.mcfunction b/data/plane/functions/move/plane-move/flying/flying-sound.mcfunction index 45339cf4..0a512f5f 100644 --- a/data/plane/functions/move/plane-move/flying/flying-sound.mcfunction +++ b/data/plane/functions/move/plane-move/flying/flying-sound.mcfunction @@ -13,6 +13,7 @@ execute if entity @s[scores={vp.sound=1,vp.speed=-1..}] at @s if data storage oh execute if entity @s[scores={vp.sound=1,vp.speed=-1..}] at @s if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine{type:jet} run playsound minecraft:plane.engine.jet-flying ambient @a[distance=..128] ~ ~ ~ 2 1 0.4 execute if entity @s[scores={vp.sound=1,vp.speed=-1..}] at @s if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine{type:jet} run playsound minecraft:plane.engine.jet-flying ambient @a[distance=128..256] ~ ~ ~ 0.2 1 0.2 +execute if entity @s[tag=use-wep,scores={vp.sound=1,vp.speed=-1..}] at @s if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine{type:jet} run playsound minecraft:plane.engine.jet-flying ambient @a[distance=..128] ~ ~ ~ 2 0.66 0.4 scoreboard players add @s vp.sound 1 #tellraw @p [{"score":{"name":"@s","objective":"vp.reg1"}}] diff --git a/data/plane/functions/move/plane-move/rolling.mcfunction b/data/plane/functions/move/plane-move/rolling.mcfunction index 10b6cfce..75935c25 100644 --- a/data/plane/functions/move/plane-move/rolling.mcfunction +++ b/data/plane/functions/move/plane-move/rolling.mcfunction @@ -31,6 +31,7 @@ scoreboard players operation #speed vp.input /= #2 vp.Num scoreboard players operation #horse-power vp.input = @s vp.horse-power scoreboard players operation #horse-power vp.input *= @s vp.engine scoreboard players operation #thrust vp.input = @s vp.thrust +execute if entity @s[tag=use-wep] unless score @s vp.wep-thrust matches ..0 run scoreboard players operation #thrust vp.input = @s vp.wep-thrust scoreboard players operation #thrust vp.input *= @s vp.engine scoreboard players operation #weight vp.input = @s vp.weight scoreboard players operation #weight vp.input += @s vp.add-weight diff --git a/data/plane/functions/move/plane-move/rolling/rolling-sound.mcfunction b/data/plane/functions/move/plane-move/rolling/rolling-sound.mcfunction index bddd1ba7..6a88f366 100644 --- a/data/plane/functions/move/plane-move/rolling/rolling-sound.mcfunction +++ b/data/plane/functions/move/plane-move/rolling/rolling-sound.mcfunction @@ -10,5 +10,6 @@ scoreboard players set @s[scores={vp.sound=10..}] vp.sound 0 execute if entity @s[scores={vp.sound=1,vp.speed=1..}] at @s if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine{type:recipro} run playsound minecraft:plane.engine.recipro-rolling ambient @a[distance=..128] ~ ~ ~ 2 1 0.4 execute if entity @s[scores={vp.sound=1,vp.speed=1..}] at @s if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine{type:jet} run playsound minecraft:plane.engine.jet-rolling ambient @a[distance=..128] ~ ~ ~ 2 1 0.4 +execute if entity @s[tag=use-wep,scores={vp.sound=1,vp.speed=-1..}] at @s if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data.flight-model.engine{type:jet} run playsound minecraft:plane.engine.jet-flying ambient @a[distance=..128] ~ ~ ~ 2 0.66 0.4 scoreboard players add @s vp.sound 1 diff --git a/data/plane/functions/plane-info.mcfunction b/data/plane/functions/plane-info.mcfunction index 984c0ef6..b2b8c6fa 100644 --- a/data/plane/functions/plane-info.mcfunction +++ b/data/plane/functions/plane-info.mcfunction @@ -34,8 +34,11 @@ execute if score @s vp.speed < @s vp.gear-ret run data modify storage plane-data execute if score @s vp.speed >= @s vp.gear-ret run data modify storage plane-datapack plane-info[0] set value "[{\"score\":{\"name\":\"#speed\",\"objective\":\"vp.reg1\"},\"color\":\"red\"},{\"text\":\"km/h\",\"color\":\"red\"}]" #throt計算 -scoreboard players operation #throttle vp.reg1 = @s vp.throttle -scoreboard players operation #throttle vp.reg1 *= #5 vp.Num +data remove storage minecraft:plane-datapack temporary.throttle-num +execute unless entity @s[tag=use-wep] store result storage minecraft:plane-datapack temporary.throttle-num int 5 run scoreboard players get @s vp.throttle +data remove storage minecraft:plane-datapack temporary.throttle +execute unless entity @s[tag=use-wep] run data modify storage minecraft:plane-datapack temporary.throttle set value "% Alt:" +execute if entity @s[tag=use-wep] run data modify storage minecraft:plane-datapack temporary.throttle set value "WEP Alt:" #高度取得 scoreboard players operation #altitude vp.reg1 = @s vp.PosY @@ -77,7 +80,7 @@ execute unless score #weapon-number vp.reg1 matches 5.. run data modify storage data modify storage plane-datapack plane-info append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list[{current-weapon:1b}].data.name #飛行機情報表示 -title @p[tag=plane-rider] actionbar ["",{"nbt":"plane-info[0]","storage":"plane-datapack","interpret":true},{"text":" Throt:","color":"red"},{"score":{"name":"#throttle","objective":"vp.reg1"},"color":"red"},{"text":"% Alt:","color":"red"},{"score":{"name":"#altitude","objective":"vp.reg1"},"color":"red"},{"text":" Wpn:","color":"yellow"},{"nbt":"plane-info[6]","storage":"plane-datapack","color":"yellow"},{"text":" Ammo:{","color":"green"},{"nbt":"plane-info[1]","storage":"plane-datapack","interpret":true},{"nbt":"plane-info[2]","storage":"plane-datapack","interpret":true},{"nbt":"plane-info[3]","storage":"plane-datapack","interpret":true},{"nbt":"plane-info[4]","storage":"plane-datapack","interpret":true},{"text":"}","color":"green"}] +title @p[tag=plane-rider] actionbar ["",{"nbt":"plane-info[0]","storage":"plane-datapack","interpret":true},{"text":" Throt:","color":"red"},{"nbt":"temporary.throttle-num","storage":"plane-datapack","color":"red"},{"nbt":"temporary.throttle","storage":"plane-datapack","color":"red"},{"score":{"name":"#altitude","objective":"vp.reg1"},"color":"red"},{"text":" Wpn:","color":"yellow"},{"nbt":"plane-info[6]","storage":"plane-datapack","color":"yellow"},{"text":" Ammo:{","color":"green"},{"nbt":"plane-info[1]","storage":"plane-datapack","interpret":true},{"nbt":"plane-info[2]","storage":"plane-datapack","interpret":true},{"nbt":"plane-info[3]","storage":"plane-datapack","interpret":true},{"nbt":"plane-info[4]","storage":"plane-datapack","interpret":true},{"text":"}","color":"green"}] #失速してたら警告表示 execute if entity @s[tag=stall] run title @p[tag=plane-rider] times 0 1 1 diff --git a/data/plane/functions/position/position.mcfunction b/data/plane/functions/position/position.mcfunction index 56ee7609..31941789 100644 --- a/data/plane/functions/position/position.mcfunction +++ b/data/plane/functions/position/position.mcfunction @@ -47,7 +47,6 @@ execute as @s at @s run function util:parts-health #体力表示更新 execute at @s as @e[type=minecraft:donkey,tag=target-parts,tag=plane-seat,distance=..30] run function plane:position/util/renew-health-display - #移動力補正スコア収集 execute as @s at @s run function plane:position/util/get-corret-param @@ -71,12 +70,15 @@ scoreboard players operation @s[tag=need-calc-offset] vp.cos = #cos vp.return execute if entity @s[tag=need-calc-offset] run scoreboard players operation #model-offset-y vp.input = @s vp.model-offset-y execute if entity @s[tag=need-calc-offset] run scoreboard players operation #central-axis-offset-y vp.input = @s vp.central-axis-offset-y execute at @s[tag=need-calc-offset] as @e[tag=has-offset,tag=target-parts,distance=..30] run function plane:position/util/calc-displacement -execute at @s[tag=need-calc-offset] as @e[type=!item_display,tag=has-offset,tag=target-parts,distance=..30] at @s rotated ~ ~ run function plane:position/calc-offset -execute at @s as @e[type=!item_display,tag=has-offset,tag=target-parts,distance=..30] run function plane:position/util/move-parts +execute at @s[tag=need-calc-offset] as @e[type=!item_display,type=!block_display,tag=has-offset,tag=target-parts,distance=..30] at @s rotated ~ ~ run function plane:position/calc-offset +execute at @s as @e[type=!item_display,type=!block_display,tag=has-offset,tag=target-parts,distance=..30] run function plane:position/util/move-parts execute on passengers if entity @s[type=item_display,tag=has-offset] run function plane:position/util/set-translation - +execute on passengers if entity @s[type=block_display,tag=has-offset] run function plane:position/util/set-translation tag @s remove need-calc-offset +#afterburner on/off +function plane:position/util/toggle-afterburner + #角度スコアが変化していた場合ベクトル計算 execute if entity @s[tag=!angle-not-changed] run function math:vector diff --git a/data/plane/functions/position/util/calc-displacement.mcfunction b/data/plane/functions/position/util/calc-displacement.mcfunction index 05d8ab6c..91386683 100644 --- a/data/plane/functions/position/util/calc-displacement.mcfunction +++ b/data/plane/functions/position/util/calc-displacement.mcfunction @@ -40,8 +40,13 @@ scoreboard players operation @s vp.new-offsetY += #sin-x-offsetX vp.reg1 scoreboard players operation @s vp.new-offsetX /= #1000 vp.Num scoreboard players operation @s vp.new-offsetY /= #1000 vp.Num -#対象がitem_displayかinteractionの場合model-offset-yを足してtranslationによるずれを補正する +#対象がitem_displayかblock_displayの場合model-offset-yを足してtranslationによるずれを補正する execute if entity @s[type=item_display] run scoreboard players operation @s vp.new-offsetY += #model-offset-y vp.input +#対象がblock_displayの場合model-offset-yと原点のずれを足してtranslationによるずれを補正する +execute if entity @s[type=block_display] run scoreboard players operation @s vp.new-offsetY += #model-offset-y vp.input +#execute if entity @s[type=block_display] store result score #block-origin vp.reg1 run data get entity @s transformation.scale[1] 250 +#execute if entity @s[type=block_display] run scoreboard players operation @s vp.new-offsetY += #block-origin vp.reg1 + #対象がinteractionの場合中心軸オフセットを足して、Z回転中心軸とエンティティ原点のずれを補正する execute if entity @s[type=interaction] run scoreboard players operation @s vp.new-offsetY += #central-axis-offset-y vp.input diff --git a/data/plane/functions/position/util/modify-angle.mcfunction b/data/plane/functions/position/util/modify-angle.mcfunction index bfa1a1c7..fcf0fac7 100644 --- a/data/plane/functions/position/util/modify-angle.mcfunction +++ b/data/plane/functions/position/util/modify-angle.mcfunction @@ -21,6 +21,7 @@ scoreboard players operation #ang-z vp.reg1 = @s vp.AngZ data modify storage minecraft:plane-datapack temporary.Angle set value {angle:0,axis:[0f,0f,1f]} execute store result storage minecraft:plane-datapack temporary.Angle.angle float 0.0001745 run scoreboard players get #ang-z vp.reg1 execute as @e[type=item_display,tag=has-model,tag=target-parts,distance=..10] run data modify entity @s transformation.left_rotation set from storage minecraft:plane-datapack temporary.Angle +execute as @e[type=block_display,tag=target-parts,distance=..10] run data modify entity @s transformation.right_rotation set from storage minecraft:plane-datapack temporary.Angle #Rootの向き修正 execute store result entity @s Rotation[0] float 0.01 run scoreboard players get @s vp.AngY @@ -28,4 +29,4 @@ execute store result entity @s Rotation[1] float 0.01 run scoreboard players get #パーツのX角度補正 scoreboard players operation #ang-z vp.reg1 = @s vp.AngZ -execute as @e[type=!item_display,tag=target-parts,distance=..32] store result entity @s Rotation[1] float 0.01 run scoreboard players get #ang-z vp.reg1 +execute as @e[type=!item_display,type=!block_display,tag=target-parts,distance=..32] store result entity @s Rotation[1] float 0.01 run scoreboard players get #ang-z vp.reg1 diff --git a/data/plane/functions/position/util/set-translation.mcfunction b/data/plane/functions/position/util/set-translation.mcfunction index da222a77..01a5c791 100644 --- a/data/plane/functions/position/util/set-translation.mcfunction +++ b/data/plane/functions/position/util/set-translation.mcfunction @@ -19,3 +19,8 @@ execute store result storage minecraft:plane-datapack temporary.translation[1] f execute store result storage minecraft:plane-datapack temporary.translation[2] float 0.001 run scoreboard players get @s vp.offsetZ data modify entity @s transformation.translation set from storage minecraft:plane-datapack temporary.translation + + #tellraw @p [{"score" : {"name":"@s", "objective":"vp.new-offsetY"}}] + #tellraw @p [{"score" : {"name":"@s", "objective":"vp.new-offsetX"}}] + #tellraw @p [{"nbt":"transformation.translation","entity": "@s"}] + diff --git a/data/plane/functions/position/util/toggle-afterburner.mcfunction b/data/plane/functions/position/util/toggle-afterburner.mcfunction new file mode 100644 index 00000000..423c85c9 --- /dev/null +++ b/data/plane/functions/position/util/toggle-afterburner.mcfunction @@ -0,0 +1,22 @@ +#> plane:position/util/toggle-afterburner +# +# @input +# executer +# +# @within function plane:position/position + +#> prv +# @private + #declare tag afterburner-off + #declare tag afterburner-on + +execute if entity @s[tag=!use-wep] on passengers if entity @s[tag=plane-afterburner,tag=!afterburner-off] run data modify entity @s block_state.Name set value "minecraft:air" +execute if entity @s[tag=!use-wep] on passengers if entity @s[tag=plane-afterburner,tag=!afterburner-off] run tag @s remove afterburner-on +execute if entity @s[tag=!use-wep] on passengers if entity @s[tag=plane-afterburner,tag=!afterburner-off] run tag @s add afterburner-off + +execute if entity @s[tag=use-wep] on passengers if entity @s[tag=plane-afterburner,tag=!afterburner-on] run data modify entity @s block_state.Name set value "minecraft:fire" +execute if entity @s[tag=use-wep] on passengers if entity @s[tag=plane-afterburner,tag=!afterburner-on] run tag @s remove afterburner-off +execute if entity @s[tag=use-wep] on passengers if entity @s[tag=plane-afterburner,tag=!afterburner-on] run tag @s add afterburner-on + + #execute if entity @s[tag=use-wep] on passengers if entity @s[tag=plane-afterburner,tag=afterburner-on] run say on + #execute if entity @s[tag=!use-wep] on passengers if entity @s[tag=plane-afterburner,tag=afterburner-off] run say off \ No newline at end of file diff --git a/data/plane/functions/summon/summon-afterburner.mcfunction b/data/plane/functions/summon/summon-afterburner.mcfunction new file mode 100644 index 00000000..ce566db4 --- /dev/null +++ b/data/plane/functions/summon/summon-afterburner.mcfunction @@ -0,0 +1,29 @@ +#> plane:summon/summon-afterburner +# +# @input +# execute @e[tag=plane-root,tag=plane-init] +# storage voxel-planes:input input +# +# @within function plane-data:** + #declare tag plane-init + #declare tag plane-afterburner1 + #declare tag plane-afterburner2 + +#afteburner召喚 +execute if data storage voxel-planes:input input.model-data.afterburner[0] run summon block_display ~ ~ ~ {Tags:[plane-afterburner,plane-afterburner1,plane-init,plane,has-offset,entity-nohit],block_state:{Name:"minecraft:air",Properties:{east:"true",north:"true",south:"true",west:"true",up:"true"}},interpolation_duration:0,view_range:4.0f,transformation:{left_rotation:{angle:0f,axis:[1f,0f,0f]},right_rotation:{angle:0f,axis:[0f,0f,1f]},scale:[1f,1f,1f],translation:[0f,1.5f,0f]}} +execute if data storage voxel-planes:input input.model-data.afterburner[1] run summon block_display ~ ~ ~ {Tags:[plane-afterburner,plane-afterburner2,plane-init,plane,has-offset,entity-nohit],block_state:{Name:"minecraft:air",Properties:{east:"true",north:"true",south:"true",west:"true",up:"true"}},interpolation_duration:0,view_range:4.0f,transformation:{left_rotation:{angle:0f,axis:[1f,0f,0f]},right_rotation:{angle:0f,axis:[0f,0f,1f]},scale:[1f,1f,1f],translation:[0f,1.5f,0f]}} + +#afterburnerの表示情報設定 +execute if data storage voxel-planes:input input.model-data.afterburner[0] as @e[tag=plane-init,tag=plane-afterburner1,distance=..1] store result score @s vp.offsetX run data get storage voxel-planes:input input.model-data.afterburner[0].translation[0] 1000 +execute if data storage voxel-planes:input input.model-data.afterburner[0] as @e[tag=plane-init,tag=plane-afterburner1,distance=..1] store result score @s vp.offsetY run data get storage voxel-planes:input input.model-data.afterburner[0].translation[1] 1000 +execute if data storage voxel-planes:input input.model-data.afterburner[0] as @e[tag=plane-init,tag=plane-afterburner1,distance=..1] store result score @s vp.offsetZ run data get storage voxel-planes:input input.model-data.afterburner[0].translation[2] 1000 +execute if data storage voxel-planes:input input.model-data.afterburner[0] as @e[tag=plane-init,tag=plane-afterburner1,distance=..1] run data modify entity @s transformation.scale set from storage voxel-planes:input input.model-data.afterburner[0].scale + +execute if data storage voxel-planes:input input.model-data.afterburner[1] as @e[tag=plane-init,tag=plane-afterburner2,distance=..1] store result score @s vp.offsetX run data get storage voxel-planes:input input.model-data.afterburner[1].translation[0] 1000 +execute if data storage voxel-planes:input input.model-data.afterburner[1] as @e[tag=plane-init,tag=plane-afterburner2,distance=..1] store result score @s vp.offsetY run data get storage voxel-planes:input input.model-data.afterburner[1].translation[1] 1000 +execute if data storage voxel-planes:input input.model-data.afterburner[1] as @e[tag=plane-init,tag=plane-afterburner2,distance=..1] store result score @s vp.offsetZ run data get storage voxel-planes:input input.model-data.afterburner[1].translation[2] 1000 +execute if data storage voxel-planes:input input.model-data.afterburner[1] as @e[tag=plane-init,tag=plane-afterburner2,distance=..1] run data modify entity @s transformation.scale set from storage voxel-planes:input input.model-data.afterburner[1].scale + +#afterburner ride +execute if data storage voxel-planes:input input.model-data.afterburner[0] run ride @e[tag=plane-init,tag=plane-afterburner1,distance=..1,limit=1] mount @s +execute if data storage voxel-planes:input input.model-data.afterburner[1] run ride @e[tag=plane-init,tag=plane-afterburner2,distance=..1,limit=1] mount @s \ No newline at end of file diff --git a/data/plane/functions/tick.mcfunction b/data/plane/functions/tick.mcfunction index 164af2a7..ffd18a08 100644 --- a/data/plane/functions/tick.mcfunction +++ b/data/plane/functions/tick.mcfunction @@ -9,6 +9,7 @@ # plane:** # plane-data:** #declare tag has-rider #飛行機にパイロットがいるかどうか + #declare tag has-wep #WEPがあるかどうか #declare tag has-dummy-rider #飛行機に偽パイロットがいるかどうか #declare tag has-ai #偽パイロットにAIがあるかどうか #declare tag plane-root #planeのrootを示すタグ