Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ テレポーターの大改修 #1644

Merged
merged 29 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
22ab12d
:recycle: display 化に備えてテレポーターの実体を item_display に書き換える
ChenCMD Nov 22, 2024
88faee2
:children_crossing: テレポーター本体の描画を display に変更
ChenCMD Nov 22, 2024
54d35b6
:children_crossing: テレポーターの星の描画を display に変更
ChenCMD Nov 22, 2024
5a0c9c5
:boom: テレポーターの星の色の設定方法を修正
ChenCMD Nov 22, 2024
0a991d6
:adhesive_bandage: テレポーターの ActivationState 更新処理を修正
ChenCMD Nov 22, 2024
615c5d5
:technologist: テスト用の function を作成
ChenCMD Nov 22, 2024
cb0534b
:boom: テレポーター Color の指定方法を変更
ChenCMD Nov 22, 2024
3d62b06
:children_crossing: 開放していないテレポーターの星も表示されるように
ChenCMD Nov 22, 2024
a8dadc0
:children_crossing: テレポーターの星が点滅するように
ChenCMD Nov 22, 2024
eeb3b62
:bulb: コメントを追加
ChenCMD Nov 22, 2024
140e63e
:children_crossing: 点滅してから再度点滅するまでの感覚を延長
ChenCMD Nov 22, 2024
ea7f0d8
:recycle: テレポーターの一部処理をリファクタリング
ChenCMD Nov 22, 2024
9e67538
:recycle: 星の初期化処理の function 名を変更
ChenCMD Nov 22, 2024
d231999
:children_crossing: テレポーターの星の表示速度を倍に
ChenCMD Nov 22, 2024
a933eeb
:bug: api:teleporter/set_activation_state/from_nearest が上手く動作しないのを修正
ChenCMD Nov 22, 2024
81f4fe4
:children_crossing: 天使が近くに居るときにテレポーターが使えなくなるように
ChenCMD Nov 22, 2024
a8eec4c
:children_crossing: 星の召喚順をランダムに
ChenCMD Nov 22, 2024
e555b98
:bug: 一部状況下でテレポーターの星が消えないのを修正
ChenCMD Nov 22, 2024
f99f311
:recycle: テレポート時に commonMarker を利用せずに済むように
ChenCMD Nov 22, 2024
8e791db
:technologist: ディメンションを超えてテレポーターを使えるように
ChenCMD Nov 22, 2024
f338878
:children_crossing: ディメンションを跨ぐ星の色が自動で変わるように
ChenCMD Nov 22, 2024
2e7d60c
:technologist: 動作確認用 function を充実させる
ChenCMD Nov 22, 2024
dafc0d6
:sparkles: テレポーターが複数のグループに所属できるように
ChenCMD Nov 22, 2024
4b4795e
:technologist: 動作確認用 function を充実させる
ChenCMD Nov 22, 2024
8a130fb
:adhesive_bandage: 一定条件下で飛べる先がないのに星を表示できるのを修正
ChenCMD Nov 22, 2024
a839261
:adhesive_bandage: scoreholder の定義を移動し忘れていたのを修正
ChenCMD Nov 22, 2024
3824181
:adhesive_bandage: 不要な within を修正
ChenCMD Nov 22, 2024
da6753c
:fire: 不要なファイルを削除
ChenCMD Nov 22, 2024
c0f6fc7
:memo: Update TheSkyBlessing/data/asset/functions/teleporter/common/r…
ChenCMD Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
# @input storage api: Argument.ActivationState : string("InvisibleDeactivate","VisibleDeactivate","Activate")
# @api

execute if entity @e[type=marker,tag=Teleporter,distance=..5,limit=1] as @e[type=marker,tag=Teleporter,distance=..5] run function oh_my_dat:please
execute if entity @e[type=marker,tag=Teleporter,distance=..5,limit=1] run data modify storage api: Argument.ID set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.ID
execute if entity @e[type=marker,tag=Teleporter,distance=..5,limit=1] if data storage api: Argument.ID run function api:teleporter/set_activation_state/from_id
execute if entity @e[type=item_display,tag=Teleporter,distance=..5,limit=1] as @e[type=item_display,tag=Teleporter,distance=..5,sort=nearest,limit=1] run function oh_my_dat:please
execute if entity @e[type=item_display,tag=Teleporter,distance=..5,limit=1] run data modify storage api: Argument.ID set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.ID
execute if entity @e[type=item_display,tag=Teleporter,distance=..5,limit=1] if data storage api: Argument.ID run function api:teleporter/set_activation_state/from_id
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
#
# @input storage asset:teleporter
# ID : int
# GroupID : string
# GroupIDs : string
# ActivationState : string("InvisibleDeactivate","VisibleDeactivate","Activate")
# Color? : string("white","aqua")(default: "white")
# Dimension: string("minecraft:overworld","minecraft:the_nether","minecraft:the_end")
# Color? : int(default: 16776960)
ChenCMD marked this conversation as resolved.
Show resolved Hide resolved
# @within function asset:teleporter/*/register

# パラメータチェック
execute unless data storage asset:teleporter ID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" ID","color":"red"}]
execute unless data storage asset:teleporter GroupID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" GroupID","color":"red"}]
execute unless data storage asset:teleporter GroupIDs run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" GroupIDs","color":"red"}]
execute unless data storage asset:teleporter ActivationState run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" ActivationState","color":"red"}]
execute unless data storage asset:teleporter Color run data modify storage asset:teleporter Color set value "white"
execute unless data storage asset:teleporter Dimension run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません"},{"text":" Dimension","color":"red"}]
# 登録
function asset_manager:teleporter/register/
# リセット
data remove storage asset:teleporter ID
data remove storage asset:teleporter GroupID
data remove storage asset:teleporter GroupIDs
data remove storage asset:teleporter ActivationState
data remove storage asset:teleporter Color
data remove storage asset:teleporter Dimension
data remove storage asset:teleporter Color
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
data modify storage asset:teleporter GroupID set value "example"
# デフォルトの起動状態 ("InvisibleDeactivate" | "VisibleDeactivate" | "Activate")
data modify storage asset:teleporter ActivationState set value "Activate"
# 色 ("white" | "aqua")
data modify storage asset:teleporter Color set value "white"
# 色 (Optional)
# data modify storage asset:teleporter Color set value 16777215

# 登録
function asset:teleporter/common/register
function asset:teleporter/common/register
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
data modify storage asset:teleporter GroupID set value "example"
# デフォルトの起動状態 ("InvisibleDeactivate" | "VisibleDeactivate" | "Activate")
data modify storage asset:teleporter ActivationState set value "Activate"
# 色 ("white" | "aqua")
data modify storage asset:teleporter Color set value "white"
# 色 (Optional)
# data modify storage asset:teleporter Color set value 16777215

# 登録
function asset:teleporter/common/register
function asset:teleporter/common/register
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
data modify storage asset:teleporter GroupID set value "example"
# デフォルトの起動状態 ("InvisibleDeactivate" | "VisibleDeactivate" | "Activate")
data modify storage asset:teleporter ActivationState set value "Activate"
# 色 ("white" | "aqua")
data modify storage asset:teleporter Color set value "white"
# 色 (Optional)
# data modify storage asset:teleporter Color set value 16777215

# 登録
function asset:teleporter/common/register
function asset:teleporter/common/register
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
data modify storage asset:teleporter GroupID set value "example"
# デフォルトの起動状態 ("InvisibleDeactivate" | "VisibleDeactivate" | "Activate")
data modify storage asset:teleporter ActivationState set value "Activate"
# 色 ("white" | "aqua")
data modify storage asset:teleporter Color set value "white"
# 色 (Optional)
# data modify storage asset:teleporter Color set value 16777215

# 登録
function asset:teleporter/common/register
function asset:teleporter/common/register
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
data modify storage asset:teleporter GroupID set value "example"
# デフォルトの起動状態 ("InvisibleDeactivate" | "VisibleDeactivate" | "Activate")
data modify storage asset:teleporter ActivationState set value "Activate"
# 色 ("white" | "aqua")
data modify storage asset:teleporter Color set value "aqua"
# 色 (Optional)
data modify storage asset:teleporter Color set value 53706

# 登録
function asset:teleporter/common/register
function asset:teleporter/common/register
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#> Teleporter
# @within
# core:tick/
# asset_manager:teleporter/**
# api:teleporter/set_activation_state/from_nearest
#declare tag Teleporter
Expand All @@ -20,19 +21,14 @@
#declare tag TeleporterInitialized
#declare tag TeleporterInitializing
#declare tag TPStar
#declare tag TPStar.White
#declare tag TPStar.Aqua
#declare tag TPStar.Active
#declare tag SuppressTeleport
#declare tag TPCancel

#> for Init
# @within asset_manager:teleporter/tick/star_init/*
# @within asset_manager:teleporter/tick/summon_star/**
#declare tag TPStarInit

#> OpenDeclares
# @within asset_manager:island/dispel/register_tp
#declare tag Teleporter

#> TeleporterExists
# @within asset_manager:teleporter/update_activation_state/*
#declare score_holder $TeleporterExists
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#> asset_manager:teleporter/common/increment_activation_state_version
#
#
#
# @within function
# asset_manager:teleporter/update_activation_state/
# asset_manager:teleporter/tick/angel_protection/*

#> Private
# @private
#declare score_holder $Version

# 現在値取得
scoreboard players set $Version Temporary 0
execute store result score $Version Temporary run data get storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.ActivationStateVersion
# 加算
scoreboard players add $Version Temporary 1
# 更新
execute store result storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.ActivationStateVersion int 1 run scoreboard players get $Version Temporary
# リセット
scoreboard players reset $Version Temporary
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset_manager:teleporter/common/update_display_state
#
#
#
# @within function
# asset_manager:teleporter/register/
# asset_manager:teleporter/tick/global

execute if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{ActivationState:"Activate"} if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{AngelProtection: true} run data modify entity @s item set value {id:"minecraft:leather_horse_armor",Count:1b,tag:{display:{color:16711680},CustomModelData:20329}}
execute if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{ActivationState:"Activate"} unless data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{AngelProtection:true} run data modify entity @s item set value {id:"minecraft:leather_horse_armor",Count:1b,tag:{display:{color:53706},CustomModelData:20329}}
execute if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{ActivationState:"VisibleDeactivate"} run data modify entity @s item set value {id:"minecraft:leather_horse_armor",Count:1b,tag:{display:{color:3092271},CustomModelData:20329}}
execute if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{ActivationState:"InvisibleDeactivate"} run data modify entity @s item set value {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@
# @within function asset:teleporter/common/register

# ベースエンティティを設定する
summon marker ~ ~ ~ {Tags:["Teleporter","Object","Uninterferable"]}
summon item_display ~ ~ ~ {Tags:["Teleporter","Object","Uninterferable"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0.281f,-0.363f,-0.117f,0.881f],translation:[0f,0.001f,0f],scale:[1f,1f,0f]},item:{},brightness:{sky:15,block:15},Rotation:[0f,-90f],teleport_duration:1}
# データ取得
execute as @e[type=marker,tag=Teleporter,distance=..0.01,limit=1] run function oh_my_dat:please
execute as @e[type=item_display,tag=Teleporter,distance=..0.01,limit=1] run function oh_my_dat:please
# 直接入れるやつ
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.ID set from storage asset:teleporter ID
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.GroupID set from storage asset:teleporter GroupID
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.GroupIDs set from storage asset:teleporter GroupIDs
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.ActivationState set from storage asset:teleporter ActivationState
# グループ側に入れるやつ
data modify storage asset:teleporter Teleporters append value {}
data modify storage asset:teleporter Teleporters[-1].ID set from storage asset:teleporter ID
data modify storage asset:teleporter Teleporters[-1].GroupID set from storage asset:teleporter GroupID
data modify storage asset:teleporter Teleporters[-1].GroupIDs set from storage asset:teleporter GroupIDs
data modify storage asset:teleporter Teleporters[-1].Data.ActivationState set from storage asset:teleporter ActivationState
data modify storage asset:teleporter Teleporters[-1].Data.Color set from storage asset:teleporter Color
data modify storage asset:teleporter Teleporters[-1].Pos set from entity @e[type=marker,tag=Teleporter,distance=..0.01,limit=1] Pos
execute if data storage asset:teleporter Color run function asset_manager:teleporter/register/calculate_and_insert_color_data
data modify storage asset:teleporter Teleporters[-1].Dimension set from storage asset:teleporter Dimension
data modify storage asset:teleporter Teleporters[-1].Pos set from entity @e[type=item_display,tag=Teleporter,distance=..0.01,limit=1] Pos
# 参照情報を保存する
data modify storage asset:teleporter TeleporterOMDMap append value {}
data modify storage asset:teleporter TeleporterOMDMap[-1].TeleporterID set from storage asset:teleporter ID
execute store result storage asset:teleporter TeleporterOMDMap[-1].OhMyDatID int 1 run scoreboard players get @e[type=marker,tag=Teleporter,distance=..0.01,limit=1] OhMyDatID
execute store result storage asset:teleporter TeleporterOMDMap[-1].OhMyDatID int 1 run scoreboard players get @e[type=item_display,tag=Teleporter,distance=..0.01,limit=1] OhMyDatID
# 状態を item_display に反映させる
execute as @e[type=item_display,tag=Teleporter,distance=..0.01,limit=1] run function asset_manager:teleporter/common/update_display_state
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#> asset_manager:teleporter/register/calculate_and_insert_color_data
#
#
#
# @within function asset_manager:teleporter/register/

#> Private
# @private
#declare score_holder $R
#declare score_holder $G
#declare score_holder $B
#declare score_holder $Color

# 色情報取得
execute store result score $R Temporary run data get storage asset:teleporter Color[0] 1
execute store result score $G Temporary run data get storage asset:teleporter Color[1] 1
execute store result score $B Temporary run data get storage asset:teleporter Color[2] 1

# カラーコード(10) を計算する
scoreboard players operation $Color Temporary = $R Temporary
scoreboard players operation $Color Temporary *= $256 Const
scoreboard players operation $Color Temporary += $G Temporary
scoreboard players operation $Color Temporary *= $256 Const
scoreboard players operation $Color Temporary += $B Temporary

# storage にいれる
execute store result storage asset:teleporter Teleporters[-1].Data.Color int 1 run scoreboard players get $Color Temporary
data modify storage asset:teleporter Teleporters[-1].Data.ColorPart set from storage asset:teleporter Color

# リセット
scoreboard players reset $R Temporary
scoreboard players reset $G Temporary
scoreboard players reset $B Temporary
scoreboard players reset $Color Temporary
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
# 接地しているかの取得
function api:data_get/on_ground
# 初期化
execute if data storage api: {OnGround:true} if entity @s[tag=!TeleporterInitializing,tag=!TeleporterInitialized] run function asset_manager:teleporter/tick/star_init/
execute if data storage api: {OnGround:true} if entity @s[tag=!TeleporterInitializing,tag=!TeleporterInitialized] run function asset_manager:teleporter/tick/summon_star/init/
# 初期化中
execute if data storage api: {OnGround:true} if entity @s[tag=TeleporterInitializing] run function asset_manager:teleporter/tick/star_init/summon_once
execute if data storage api: {OnGround:true} if entity @s[tag=TeleporterInitializing] run function asset_manager:teleporter/tick/summon_star/summon/
execute if data storage api: {OnGround:true} if entity @s[tag=TeleporterInitializing] run function asset_manager:teleporter/tick/summon_star/summon/
# ジャンプ検知
execute if data storage api: {OnGround:false} unless entity @s[tag=!TeleporterInitializing,tag=!TeleporterInitialized] run function asset_manager:teleporter/tick/tp/
# VFX
summon area_effect_cloud ~ ~ ~ {Duration:6,Age:4,effects:[{id:"blindness",amplifier:0b,duration:25,show_particles:0b}]}
execute anchored eyes positioned ^ ^ ^ as @e[type=marker,tag=TPStar,distance=..1.8] if score @s TPStarFromUserID = @p[tag=this] UserID facing entity @s feet positioned as @s run function asset_manager:teleporter/tick/vfx/star/
execute anchored eyes positioned ^ ^ ^ as @e[type=item_display,tag=TPStar,distance=..1.8] if score @s TPStarFromUserID = @p[tag=this] UserID facing entity @s feet positioned as @s run function asset_manager:teleporter/tick/vfx/star/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:teleporter/tick/angel_protection/disable
#
#
#
# @within function asset_manager:teleporter/tick/global

data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.AngelProtection set value false
function asset_manager:teleporter/common/increment_activation_state_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset_manager:teleporter/tick/angel_protection/enable
#
#
#
# @within function asset_manager:teleporter/tick/global

data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.AngelProtection set value true
function asset_manager:teleporter/common/increment_activation_state_version
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# storage呼び出し
function oh_my_dat:please
# リセット
execute anchored eyes positioned ^ ^ ^ positioned ~ ~-0.41 ~ as @e[type=marker,tag=TPStar,distance=..1.8] if score @s TPStarFromUserID = @p[tag=this] UserID run kill @s
execute anchored eyes positioned ^ ^ ^ positioned ~ ~-0.41 ~ as @e[type=item_display,tag=TPStar] if score @s TPStarFromUserID = @p[tag=this] UserID run kill @s
data remove storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Temp.Teleporters
tag @s remove TeleporterInitializing
tag @s remove TeleporterInitialized
tag @s remove TPCancel
tag @s remove TPCancel
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
#
# @within function asset_manager:teleporter/tick/player

# テレポーターの EntityStorage 取得
execute as @e[type=item_display,tag=FromTeleporter,distance=..1,limit=1] run function oh_my_dat:please
# 戦闘中になったら
execute if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{AngelProtection:true} run tag @s add TPCancel
execute unless data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{ActivationState:"Activate"} run tag @s add TPCancel
# スニークを解除したら
execute unless predicate lib:is_sneaking run tag @s add TPCancel
# 地面がなくなったら
function api:data_get/on_ground
execute if data storage api: {OnGround:false} run tag @s add TPCancel
# 動いたら
execute if predicate lib:is_player_moving run tag @s add TPCancel
execute if predicate lib:is_player_moving run tag @s add TPCancel
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,25 @@
#
# @within function core:tick/

execute as @e[type=marker,tag=Teleporter] at @s if entity @p[distance=..50] run function asset_manager:teleporter/tick/vfx/teleporter/
#> Private
# @private
#declare score_holder $Version

# EntityStorage 呼び出し
function oh_my_dat:please

# 天使確認
execute if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{AngelProtection: true} unless entity @e[type=#lib:living,tag=Enemy.Boss,distance=..120] run function asset_manager:teleporter/tick/angel_protection/disable
execute unless data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData{AngelProtection: true} if entity @e[type=#lib:living,tag=Enemy.Boss,distance=..120] run function asset_manager:teleporter/tick/angel_protection/enable

# 更新処理
scoreboard players set $Version Temporary 0
execute store result score $Version Temporary run data get storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].TeleporterData.ActivationStateVersion
execute unless score @s TeleporterActivationStateVersion = $Version Temporary run function asset_manager:teleporter/common/update_display_state
scoreboard players operation @s TeleporterActivationStateVersion = $Version Temporary

# VFX
function asset_manager:teleporter/tick/vfx/teleporter/

# リセット
scoreboard players reset $Version Temporary
Loading
Loading