Skip to content

Commit

Permalink
add b-17g test version
Browse files Browse the repository at this point in the history
  • Loading branch information
uran247 committed Nov 22, 2021
1 parent b973709 commit 2eac3a4
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 1 deletion.
3 changes: 2 additions & 1 deletion data/constructor/functions/addstorage.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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.2.1.20210829.6"
execute store success score #is-different-data vp.reg1 run data modify storage minecraft:plane-datapack data-version set value "0.2.1.20211008.1"

#航空機個別ストレージ作成
execute if score #is-different-data vp.reg1 matches 1 run function plane-data:a5m/a5m-storage
Expand All @@ -45,6 +45,7 @@ execute if score #is-different-data vp.reg1 matches 1 run function plane-data:bf
execute if score #is-different-data vp.reg1 matches 1 run function plane-data:ju87b/ju87b-storage
execute if score #is-different-data vp.reg1 matches 1 run function plane-data:p-38l/p38l-storage
execute if score #is-different-data vp.reg1 matches 1 run function plane-data:me262a-1a/me262a1a-storage
execute if score #is-different-data vp.reg1 matches 1 run function plane-data:b-17g/b17g-storage


execute if score #is-different-data vp.reg1 matches 1 run say "storage data renewed"
Expand Down
1 change: 1 addition & 0 deletions data/item/functions/plane2item/plane2item.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ execute as @s[tag=pe2] at @s run function plane-data:pe-2/pe2-2-item
execute as @s[tag=bf109g] at @s run function plane-data:bf109g/bf109g-2-item
execute as @s[tag=ju87b] at @s run function plane-data:ju87b/ju87b-2-item
execute as @s[tag=p38l] at @s run function plane-data:p-38l/p38l-2-item
execute as @s[tag=b17g] at @s run function plane-data:b-17g/b17g-2-item

#ロバチェスト内のアイテム放出
data merge block 0 1 0 {Items:[]}
Expand Down
13 changes: 13 additions & 0 deletions data/plane-data/functions/b-17g/b-17g-position.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#> plane-data:b-17g/b-17g-position
#
# plane-seatの位置を調整する
#
# @input
# executer @e[tag=plane-root]
#
# @within plane:position/position

#seatの位置修正
execute at @s[tag=has-rider] run tp @e[tag=plane-seat,tag=target-parts,distance=..32] ^ ^1.5 ^-5
execute at @s[tag=!has-rider] run tp @e[tag=plane-seat,tag=target-parts,distance=..32] ^ ^ ^6.5

65 changes: 65 additions & 0 deletions data/plane-data/functions/b-17g/b-17g.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#> plane-data:b-17g/b-17g
#
# @within
# plane:**
# weapon:**
#declare tag b17g-hitbox
#declare tag b17g-body

#> public
# @public
#declare tag b17g

#> private
# @private
#declare tag plane-rightwing #右主翼を示す
#declare tag plane-leftwing #左主翼を示す
#declare tag plane-tail #機体後部を示す
#declare tag plane-init #初期化処理中のエンティティであることを示す

#機体召喚
summon armor_stand ~ ~ ~ {Invisible:1b,NoGravity:0b,Tags:[b17g,plane-init,plane-root,plane,entity-nohit,need-calc-offset,delay-rotation,tier3,bomber],DisabledSlots:256}
summon armor_stand ~ ~ ~ {Invisible:1b,NoGravity:0b,Tags:[b17g,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:[b17g,plane-init,plane,plane-seat,entity-nohit]}],DisabledSlots:256}
summon armor_stand ~ ~ ~ {Tags:["plane-body","b17g",plane-init,plane,has-model,model-changeable,plane-parts,entity-nohit],NoGravity:1b,Invisible:1b,HandItems:[{id:"minecraft:diamond_sword",Count:1b,tag:{CustomModelData:150,Unbreakable:1b}},{}],Pose:{LeftArm:[0f,0f,0f],RightArm:[0f,0f,0f]},DisabledSlots:256}
summon armor_stand ~ ~ ~ {Tags:["plane-tail","b17g",plane-init,plane,has-model,model-changeable,plane-parts,entity-nohit],NoGravity:1b,Invisible:1b,HandItems:[{id:"minecraft:diamond_sword",Count:1b,tag:{CustomModelData:153,Unbreakable:1b}},{}],Pose:{LeftArm:[0f,0f,0f],RightArm:[0f,0f,0f]},DisabledSlots:256}
summon armor_stand ~ ~ ~ {Tags:["plane-rightwing","b17g",plane-init,plane,has-model,model-changeable,has-offset,plane-parts,entity-nohit],NoGravity:1b,Invisible:1b,HandItems:[{id:"minecraft:diamond_sword",Count:1b,tag:{CustomModelData:156,Unbreakable:1b}},{}],Pose:{LeftArm:[0f,0f,0f],RightArm:[0f,0f,0f]},DisabledSlots:256}
summon armor_stand ~ ~ ~ {Tags:["plane-leftwing","b17g",plane-init,plane,has-model,model-changeable,has-offset,plane-parts,entity-nohit],NoGravity:1b,Invisible:1b,HandItems:[{id:"minecraft:diamond_sword",Count:1b,tag:{CustomModelData:159,Unbreakable:1b}},{}],Pose:{LeftArm:[0f,0f,0f],RightArm:[0f,0f,0f]},DisabledSlots:256}

#hitbox召喚
summon armor_stand ~ ~ ~ {Tags:["b17g",plane-init,plane,plane-hitbox,body,offset-base],NoGravity:1b,Invisible:1b,Marker:1b,Health:80f,Attributes:[{Name:"generic.max_health",Base:80d}]}
summon armor_stand ~ ~ ~ {Tags:["b17g",plane-init,plane,has-offset,plane-hitbox,engine-r,engine,offset-base],NoGravity:1b,Invisible:1b,Marker:1b,Health:60f,Attributes:[{Name:"generic.max_health",Base:60d}]}
summon armor_stand ~ ~ ~ {Tags:["b17g",plane-init,plane,has-offset,plane-hitbox,engine-l,engine,offset-base],NoGravity:1b,Invisible:1b,Marker:1b,Health:60f,Attributes:[{Name:"generic.max_health",Base:60d}]}
summon armor_stand ~ ~ ~ {Tags:["b17g",plane-init,plane,has-offset,plane-hitbox,aileron-r,aileron,offset-base],NoGravity:1b,Invisible:1b,Marker:1b,Health:70f,Attributes:[{Name:"generic.max_health",Base:70d}]}
summon armor_stand ~ ~ ~ {Tags:["b17g",plane-init,plane,has-offset,plane-hitbox,aileron-l,aileron,offset-base],NoGravity:1b,Invisible:1b,Marker:1b,Health:70f,Attributes:[{Name:"generic.max_health",Base:70d}]}
summon armor_stand ~ ~ ~ {Tags:["b17g",plane-init,plane,has-offset,plane-hitbox,elevator-r,elevetor,offset-base],NoGravity:1b,Invisible:1b,Marker:1b,Health:60f,Attributes:[{Name:"generic.max_health",Base:60d}]}
summon armor_stand ~ ~ ~ {Tags:["b17g",plane-init,plane,has-offset,plane-hitbox,elevator-l,elevetor,offset-base],NoGravity:1b,Invisible:1b,Marker:1b,Health:60f,Attributes:[{Name:"generic.max_health",Base:60d}]}
summon armor_stand ~ ~ ~ {Tags:["b17g",plane-init,plane,has-offset,plane-hitbox,radder,offset-base],NoGravity:1b,Invisible:1b,Marker:1b,Health:70f,Attributes:[{Name:"generic.max_health",Base:70d}]}
summon armor_stand ~ ~ ~ {Tags:["b17g",plane-init,plane,has-offset,plane-hitbox,cockpit,offset-base],NoGravity:1b,Invisible:1b,Marker:1b,Health:1024f,Attributes:[{Name:"generic.max_health",Base:1024d}]}

#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

#飛行機データのストレージ設定
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].plane-data set from storage voxel-planes:plane b17g.plane-data

#飛行スコアセット
data remove storage voxel-planes:input input
data modify storage voxel-planes:input input set from storage voxel-planes:plane b17g.plane-data
execute as @e[tag=plane-init,tag=plane-root,distance=..1] run function plane-data:util/set-plane-score
execute as @e[tag=plane-init,tag=plane-hitbox,distance=..1] run function plane-data:util/set-hitbox-data
execute as @e[tag=plane-init,tag=has-model,tag=has-offset,distance=..1] run function plane-data:util/set-model-offset
execute as @e[type=donkey,tag=plane-init,distance=..1] run function plane-data:util/set-plane-maxhp

#武器データセット
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon set value {current-weapon-index:0}
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list set value []
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list append from storage voxel-planes:weapon b17g.base.bomb

#プレイヤーと同じAngYにする
schedule function plane:summon/util/delay-rotation 2

#処理終了
tag @e[tag=plane-init,distance=..1] remove plane-init
5 changes: 5 additions & 0 deletions data/plane-data/functions/b-17g/b17g-2-item.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#入力 entity:ki21-root pos:@s
#処理 ki21をアイテム化

#アイテムをsummon
loot spawn ~ ~ ~ loot plane-data:ki-49
36 changes: 36 additions & 0 deletions data/plane-data/functions/b-17g/b17g-equip.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#> plane-data:b-17g/b17g-equip
#
# 装備の変更処理
# @input
# executer @e[tag=plane-root]
#
# @within function plane:equip/equip-manager

#> private
# @private
#declare score_holder #500kg #500kg爆弾アイテムを装備していることを示す
#declare score_holder #kill-weapon #現在装備中の爆弾を消すべきであるとのフラグ
#declare score_holder #remove-500kg #800kg爆弾を外したことを示す
#declare score_holder #remove-250kg #250kg爆弾を外したことを示す

#装備品チェック
execute store success score #500kg vp.reg1 if entity @e[type=minecraft:donkey,tag=target-parts,nbt={Items:[{tag:{item-type:500kg-bomb}}]},distance=..30]

#ストレージリセット
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list[{data:{type:bomb}}] set from storage voxel-planes:weapon b17g.base.bomb

#weapon-listに武器データアペンド
execute if score #500kg vp.reg1 matches 1.. run data remove storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list[{data:{type:bomb}}].data.bombs[{kind:250kg}]
execute if score #500kg vp.reg1 matches 1.. run data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list[{data:{type:bomb}}].data.bombs append from storage voxel-planes:weapon b17g.additional.500kg[]

#弾数変更
execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list[{data:{type:bomb}}].data.current-ammunition int 1 run data get storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list[{data:{type:bomb}}].data.bombs
execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list[{data:{type:bomb}}].data.max-ammunition int 1 run data get storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].weapon.weapon-list[{data:{type:bomb}}].data.bombs

#不要爆弾削除
execute unless score #500kg vp.reg1 matches 1.. if entity @e[tag=target-parts,tag=500kg,tag=normal,distance=..32] run kill @e[tag=target-parts,tag=plane-bomb]
execute if score #500kg vp.reg1 matches 1.. if entity @e[tag=target-parts,tag=250kg,tag=normal,distance=..32] run kill @e[tag=target-parts,tag=plane-bomb]

#ステータス変更
#装備に応じて右記ステータス変更:最高速度 巡航速度 旋回力

36 changes: 36 additions & 0 deletions data/plane-data/functions/b-17g/b17g-storage.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#> plane-data:b-17g/b17g-storage
#
# @within function constructor:addstorage

data modify storage voxel-planes:weapon b17g set value {base:{},additional:{}}
data modify storage voxel-planes:plane b17g set value {}

#飛行機データセット
data modify storage voxel-planes:plane b17g.plane-data.plane-type set value fighter
data modify storage voxel-planes:plane b17g.plane-data.tier set value 3
data modify storage voxel-planes:plane b17g.plane-data.flight-model.weight set value 9680
data modify storage voxel-planes:plane b17g.plane-data.flight-model.speed set value {max-speed:492f,cruise-speed:350f,climb-rate:6.1f,stall-speed:175f}
data modify storage voxel-planes:plane b17g.plane-data.flight-model.engine set value {type:recipro,horse-power:1520f,number:2}
data modify storage voxel-planes:plane b17g.plane-data.flight-model.turn-rate set value {pitch:25f,yaw:19f,roll:18f}
data modify storage voxel-planes:plane b17g.plane-data.flight-model.energy-loss-rate set value 0.6
data modify storage voxel-planes:plane b17g.plane-data.model-data.body set value {parking-cmd:150,rolling-cmd:151,flying-cmd:152}
data modify storage voxel-planes:plane b17g.plane-data.model-data.tail set value {parking-cmd:153,rolling-cmd:153,flying-cmd:154}
data modify storage voxel-planes:plane b17g.plane-data.model-data.rightwing set value {parking-cmd:155,rolling-cmd:156,flying-cmd:156,offset:[-3.1d,0d,0d]}
data modify storage voxel-planes:plane b17g.plane-data.model-data.leftwing set value {parking-cmd:158,rolling-cmd:159,flying-cmd:159,offset:[3.1d,0d,0d]}
data modify storage voxel-planes:plane b17g.plane-data.model-data.landing-pitch set value -7.0
data modify storage voxel-planes:plane b17g.plane-data.hp set value {engine:60d,body:80d,aileron:70d,elevetor:60d,radder:70d}
data modify storage voxel-planes:plane b17g.plane-data.hitbox set value {}
data modify storage voxel-planes:plane b17g.plane-data.hitbox merge value {engine-r:{offset:[-2.6d,0.25d,6.3d]},engine-l:{offset:[2.6d,0.25d,6.3d]}}
data modify storage voxel-planes:plane b17g.plane-data.hitbox merge value {aileron-r:{offset:[-7.4d,0.8d,3.2d]},aileron-l:{offset:[7.4d,0.8d,3.2d]}}
data modify storage voxel-planes:plane b17g.plane-data.hitbox merge value {elevator-r:{offset:[-2.3d,0.6d,-5.7d]},elevator-l:{offset:[2.3d,0.6d,-5.7d]}}
data modify storage voxel-planes:plane b17g.plane-data.hitbox merge value {radder:{offset:[0d,2.4d,-5.8d]}}
data modify storage voxel-planes:plane b17g.plane-data.hitbox merge value {cockpit:{offset:[0d,1.1d,6.6d]}}

#デフォルト爆弾データセット
data modify storage voxel-planes:weapon b17g.base.bomb.data set value {name:bomb,type:bomb,max-ammunition:4,current-ammunition:4,max-reload:600,current-reload:0,bombs:[]}
data modify storage voxel-planes:weapon b17g.base.bomb.data.bombs append value {kind:250kg,type:normal,offset:[-0.5d,0d,4d],damage:1250,weight:250,cmd:77}
data modify storage voxel-planes:weapon b17g.base.bomb.data.bombs append value {kind:250kg,type:normal,offset:[0.5d,0d,4d],damage:1250,weight:250,cmd:77}
data modify storage voxel-planes:weapon b17g.base.bomb.data.bombs append value {kind:250kg,type:normal,offset:[-0.5d,0d,2d],damage:1250,weight:250,cmd:77}
data modify storage voxel-planes:weapon b17g.base.bomb.data.bombs append value {kind:250kg,type:normal,offset:[0.5d,0d,2d],damage:1250,weight:250,cmd:77}
data modify storage voxel-planes:weapon b17g.additional.500kg set value [{kind:500kg,type:normal,offset:[0d,0d,1d],damage:2500,weight:500,cmd:118}]
data modify storage voxel-planes:weapon b17g.additional.500kg append value {kind:500kg,type:normal,offset:[0d,0d,4d],damage:2500,weight:500,cmd:118}
4 changes: 4 additions & 0 deletions data/plane-data/functions/util/set-plane-score.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#declare tag plane-init
#declare tag plane-body
#declare tag plane-rightwing
#declare tag plane-leftwing
#declare tag plane-tail

#最高、巡航、失速、離陸速度設定
Expand Down Expand Up @@ -53,6 +54,9 @@ execute store result score @e[tag=plane-init,tag=plane-body,tag=model-changeable
execute store result score @e[tag=plane-init,tag=plane-rightwing,tag=model-changeable,distance=..1] vp.parking-cmd run data get storage voxel-planes:input input.model-data.rightwing.parking-cmd
execute store result score @e[tag=plane-init,tag=plane-rightwing,tag=model-changeable,distance=..1] vp.rolling-cmd run data get storage voxel-planes:input input.model-data.rightwing.rolling-cmd
execute store result score @e[tag=plane-init,tag=plane-rightwing,tag=model-changeable,distance=..1] vp.flying-cmd run data get storage voxel-planes:input input.model-data.rightwing.flying-cmd
execute store result score @e[tag=plane-init,tag=plane-leftwing,tag=model-changeable,distance=..1] vp.parking-cmd run data get storage voxel-planes:input input.model-data.leftwing.parking-cmd
execute store result score @e[tag=plane-init,tag=plane-leftwing,tag=model-changeable,distance=..1] vp.rolling-cmd run data get storage voxel-planes:input input.model-data.leftwing.rolling-cmd
execute store result score @e[tag=plane-init,tag=plane-leftwing,tag=model-changeable,distance=..1] vp.flying-cmd run data get storage voxel-planes:input input.model-data.leftwing.flying-cmd
execute store result score @e[tag=plane-init,tag=plane-tail,tag=model-changeable,distance=..1] vp.parking-cmd run data get storage voxel-planes:input input.model-data.tail.parking-cmd
execute store result score @e[tag=plane-init,tag=plane-tail,tag=model-changeable,distance=..1] vp.rolling-cmd run data get storage voxel-planes:input input.model-data.tail.rolling-cmd
execute store result score @e[tag=plane-init,tag=plane-tail,tag=model-changeable,distance=..1] vp.flying-cmd run data get storage voxel-planes:input input.model-data.tail.flying-cmd
Expand Down
32 changes: 32 additions & 0 deletions data/plane-data/loot_tables/b-17g.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "item",
"name": "minecraft:bat_spawn_egg",
"weight": 1,
"functions": [
{
"function":"set_name",
"name":{"text":"B-17G Flying Fortress"}
},
{
"function":"set_lore",
"lore":[
{"translate":"爆撃機","color":"green","bold":true},
{"translate":" 武装"},
{"translate":" 250kg爆弾×4","color":"blue"}
]
},
{
"function": "minecraft:set_nbt",
"tag":"{item-type:b-17g,tier:3,CustomModelData:14,CanPlaceOn:[\"minecraft:stone\",\"minecraft:grass_path\"],HideFlags:18,EntityTag:{Silent:1b,Tags:[b17g-spawner,plane-spawner],ActiveEffects:[{Id:14b,Amplifier:1b,Duration:100,ShowParticles:0b}]}}"
}
]
}
]
}
]
}
1 change: 1 addition & 0 deletions data/plane/functions/equip/equip-manager.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ execute if entity @s[tag=bf109g] run function plane-data:bf109g/bf109g-equip
#execute if entity @s[tag=ju87b] run function plane-data:ju87b/ju87b-equip
#execute if entity @s[tag=p38l] run function plane-data:p-38l/p38l-equip
execute if entity @s[tag=me262a1a] run function plane-data:me262a-1a/me262a1a-equip
#execute if entity @s[tag=b17g] run function plane-data:b-17g/b17g-equip
2 changes: 2 additions & 0 deletions data/plane/functions/summon/spawner-manager.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#declare tag pe2-spawner
#declare tag bf109g-spawner
#declare tag ju87b-spawner
#declare tag b17g-spawner

execute at @s[tag=a5m-spawner] as @p run function plane-data:a5m/a5m
execute at @s[tag=d3a-spawner] as @p run function plane-data:d3a/d3a
Expand All @@ -60,5 +61,6 @@ execute at @s[tag=pe2-spawner] as @p run function plane-data:pe-2/pe-2
execute at @s[tag=bf109g-spawner] as @p run function plane-data:bf109g/bf109g
execute at @s[tag=ju87b-spawner] as @p run function plane-data:ju87b/ju87b
execute at @s[tag=p38l-spawner] as @p run function plane-data:p-38l/p38l
execute at @s[tag=b17g-spawner] as @p run function plane-data:b-17g/b-17g

kill @s

0 comments on commit 2eac3a4

Please sign in to comment.