#Shield distance
function olink:ch1/find_linked
tp @e[type=#as,tag=shield,tag=1,tag=ch1_olinked,limit=1] ^2.5 ^0.5 ^
tp @e[type=#as,tag=shield,tag=2,tag=ch1_olinked,limit=1] ^ ^0.5 ^2.5
tp @e[type=#as,tag=shield,tag=3,tag=ch1_olinked,limit=1] ^-2.5 ^0.5 ^
tp @e[type=#as,tag=shield,tag=4,tag=ch1_olinked,limit=1] ^ ^0.5 ^-2.5

tp @e[type=marker,tag=shield_b,tag=1,tag=ch1_olinked,limit=1] ^2.2 ^0.3 ^-0.3
tp @e[type=marker,tag=shield_b,tag=2,tag=ch1_olinked,limit=1] ^0.3 ^0.3 ^2.2
tp @e[type=marker,tag=shield_b,tag=3,tag=ch1_olinked,limit=1] ^-2.2 ^0.3 ^0.3
tp @e[type=marker,tag=shield_b,tag=4,tag=ch1_olinked,limit=1] ^-0.3 ^0.3 ^-2.2

# Shields rotate
tp @s ~ ~ ~ ~10 ~

# Animation
execute if entity @s[scores={countdown=130..}] run function items:obj/earth_shield/animation/up
execute if entity @s[scores={countdown=..15}] run function items:obj/earth_shield/animation/down

# Colision
execute at @e[type=#as,tag=shield,tag=ch1_olinked,limit=4] as @e[distance=..0.8,tag=!unspellable,type=!player] run function items:obj/earth_shield/collision
