minerace/data/emk/functions/turtle/update.mcfunction

78 lines
6.3 KiB
Mcfunction

scoreboard players set #tmp emk-id 0
scoreboard players set #tmp emk-handling 0
scoreboard players add @s emk-timer 1
execute positioned ^ ^ ^.2 if block ~-.5 ~1 ~-.5 #emk:transparent run scoreboard players add #tmp emk-id 2
execute positioned ^ ^ ^.2 if block ~-.5 ~ ~-.5 #emk:transparent run scoreboard players add #tmp emk-id 1
execute positioned ^ ^ ^.2 if block ~-.5 ~2 ~-.5 #emk:transparent run scoreboard players add #tmp emk-id 1
execute if score #tmp emk-id matches ..2 run scoreboard players add #tmp emk-handling 1
scoreboard players set #tmp emk-id 0
execute positioned ^ ^ ^.2 if block ~.5 ~1 ~-.5 #emk:transparent run scoreboard players add #tmp emk-id 2
execute positioned ^ ^ ^.2 if block ~.5 ~ ~-.5 #emk:transparent run scoreboard players add #tmp emk-id 1
execute positioned ^ ^ ^.2 if block ~.5 ~2 ~-.5 #emk:transparent run scoreboard players add #tmp emk-id 1
execute if score #tmp emk-id matches ..2 run scoreboard players add #tmp emk-handling 2
scoreboard players set #tmp emk-id 0
execute positioned ^ ^ ^.2 if block ~-.5 ~1 ~.5 #emk:transparent run scoreboard players add #tmp emk-id 2
execute positioned ^ ^ ^.2 if block ~-.5 ~ ~.5 #emk:transparent run scoreboard players add #tmp emk-id 1
execute positioned ^ ^ ^.2 if block ~-.5 ~2 ~.5 #emk:transparent run scoreboard players add #tmp emk-id 1
execute if score #tmp emk-id matches ..2 run scoreboard players add #tmp emk-handling 4
scoreboard players set #tmp emk-id 0
execute positioned ^ ^ ^.2 if block ~.5 ~1 ~.5 #emk:transparent run scoreboard players add #tmp emk-id 2
execute positioned ^ ^ ^.2 if block ~.5 ~ ~.5 #emk:transparent run scoreboard players add #tmp emk-id 1
execute positioned ^ ^ ^.2 if block ~.5 ~2 ~.5 #emk:transparent run scoreboard players add #tmp emk-id 1
execute if score #tmp emk-id matches ..2 run scoreboard players add #tmp emk-handling 8
execute if score #tmp emk-handling matches 15 run kill
#tmp id 0-2 is wall, 3-4 is clear
execute unless score #tmp emk-handling matches 0 run scoreboard players set #tmp emk-stun 18000
execute unless score #tmp emk-handling matches 0 store result score @s emk-rot run data get entity @s Rotation[0] 100
execute if score #tmp emk-handling matches 1 run scoreboard players add @s emk-rot 4500
execute if score #tmp emk-handling matches 2 run scoreboard players remove @s emk-rot 4500
execute if score #tmp emk-handling matches 4 run scoreboard players remove @s emk-rot 4500
execute if score #tmp emk-handling matches 5 run scoreboard players add @s emk-rot 9000
execute if score #tmp emk-handling matches 6..8 run scoreboard players add @s emk-rot 4500
execute if score #tmp emk-handling matches 9 run scoreboard players remove @s emk-rot 4500
execute if score #tmp emk-handling matches 10 run scoreboard players add @s emk-rot 9000
execute if score #tmp emk-handling matches 11 run scoreboard players remove @s emk-rot 4500
execute if score #tmp emk-handling matches 13 run scoreboard players remove @s emk-rot 4500
execute if score #tmp emk-handling matches 14 run scoreboard players add @s emk-rot 4500
execute unless score #tmp emk-handling matches 0 run scoreboard players operation #tmp emk-stun -= @s emk-rot
execute if score #tmp emk-handling matches 1 run scoreboard players remove #tmp emk-stun 4500
execute if score #tmp emk-handling matches 2 run scoreboard players add #tmp emk-stun 4500
execute if score #tmp emk-handling matches 4 run scoreboard players add #tmp emk-stun 4500
execute if score #tmp emk-handling matches 5 run scoreboard players remove #tmp emk-stun 9000
execute if score #tmp emk-handling matches 6..8 run scoreboard players remove #tmp emk-stun 4500
execute if score #tmp emk-handling matches 9 run scoreboard players add #tmp emk-stun 4500
execute if score #tmp emk-handling matches 10 run scoreboard players remove #tmp emk-stun 9000
execute if score #tmp emk-handling matches 11 run scoreboard players add #tmp emk-stun 4500
execute if score #tmp emk-handling matches 13 run scoreboard players add #tmp emk-stun 4500
execute if score #tmp emk-handling matches 14 run scoreboard players remove #tmp emk-stun 4500
execute unless score #tmp emk-handling matches 0 store result entity @s Rotation[0] float 0.01 run scoreboard players get #tmp emk-stun
execute unless score #tmp emk-handling matches 0 run playsound minecraft:entity.turtle.hurt master @a
execute unless score #tmp emk-handling matches 0 run scoreboard players add @s emk-distance 1
tp @s ^ ^ ^.2
scoreboard players set #tmp emk-speed 0
execute if score #tmp emk-id matches 3.. positioned ^ ^ ^.2 if block ~-.5 ~ ~-.5 #emk:transparent if block ~.5 ~ ~-.5 #emk:transparent if block ~-.5 ~ ~.5 #emk:transparent if block ~.5 ~ ~.5 #emk:transparent run scoreboard players set #tmp emk-speed 1
#1 is clear, 0 is a block
execute if score #tmp emk-handling matches 0 if score #tmp emk-speed matches 0 run tp @s ~ ~1 ~
#scoreboard players set #tmp emk-speed 0
#if 4 are non-slabs AND on a slab, don't move up (needs fix before use!)
#execute if score #tmp emk-id matches 3..4 unless blocks 1000 ~ 0 1000 ~ 0 1000 ~.5 0 all positioned ^ ^ ^.2 unless block ~-.5 ~ ~-.5 #emk:half unless block ~.5 ~ ~-.5 #emk:half unless block ~-.5 ~ ~.5 #emk:half unless block ~.5 ~ ~.5 #emk:half run scoreboard players set #tmp emk-speed 1
#execute if score #tmp emk-id matches 3..4 if score #tmp emk-speed matches 0 run tp @s ~ ~.5 ~
tag @s add emk-onground
execute positioned ^ ^ ^.2 if block ~-.5 ~-.001 ~-.5 #emk:transparent if block ~.5 ~-.001 ~-.5 #emk:transparent if block ~-.5 ~-.001 ~.5 #emk:transparent if block ~.5 ~-.001 ~.5 #emk:transparent run tag @s remove emk-onground
execute unless entity @s[tag=emk-onground] run scoreboard players remove @s emk-ymov 150
scoreboard players operation @s emk-distancey += @s emk-ymov
execute if score @s emk-distancey matches ..-1000 at @s run function emk:kart/moveyd
tag @s add emk-sel2
execute positioned ^ ^ ^.2 as @e[tag=emk-slime,distance=...95] run function emk:slime/hit
execute positioned ^ ^ ^.2 run tag @e[tag=emk-kart,scores={emk-star=0,emk-stun=0},distance=..1] add emk-sel3
scoreboard players set @e[tag=emk-sel3] emk-stun 30
execute if entity @e[tag=emk-sel3] run kill
tag @e remove emk-sel3
tag @e[tag=emk-turtle,tag=!emk-sel2,distance=..1] add emk-sel3
execute if entity @e[tag=emk-sel3] run kill
kill @e[tag=emk-sel3]
tag @s remove emk-sel2
kill @s[scores={emk-stun=1..}]
kill @s[scores={emk-timer=4000..}]
kill @s[scores={emk-distance=50..}]
execute if block 1000 ~ 0 minecraft:barrel run kill