Skip to content

Commit

Permalink
add afterburner
Browse files Browse the repository at this point in the history
  • Loading branch information
uran247 committed Jul 7, 2023
1 parent d210c38 commit 1839997
Show file tree
Hide file tree
Showing 24 changed files with 143 additions and 36 deletions.
2 changes: 2 additions & 0 deletions data/constructor/functions/addscoreboard.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion data/constructor/functions/addstorage.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions data/plane-data/functions/plane-data_index.d.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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 #ミサイルであることを示す
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] ^ ^ ^
18 changes: 11 additions & 7 deletions data/plane-data/functions/saab29f/saab29f-storage.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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]}]}}
Expand Down
11 changes: 7 additions & 4 deletions data/plane-data/functions/saab29f/saab29f.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions data/plane-data/functions/util/culc-resistance.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion data/plane-data/functions/util/set-plane-score.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions data/plane/functions/_index.d.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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/**
Expand Down
22 changes: 16 additions & 6 deletions data/plane/functions/controll/flying.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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軸の現在の機体の角度とプレイヤーが向いている角度の差分を示す
Expand All @@ -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
Expand Down
24 changes: 17 additions & 7 deletions data/plane/functions/controll/rolling.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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軸の現在の機体の角度とプレイヤーが向いている角度の差分を示す
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions data/plane/functions/move/plane-move/flying.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 1839997

Please sign in to comment.