68 lines
7.4 KiB
Mcfunction
68 lines
7.4 KiB
Mcfunction
scoreboard players set @s[scores={emk-stun=1..}] emk-speed 0
|
|
scoreboard players set @s[scores={emk-stun=1..}] emk-distance 0
|
|
scoreboard players set #tmp emk-id 0
|
|
#execute store success score #tmp emk-speed positioned ~.5 ~ ~.5 if block ^ ^ ^.1 #emk:transparent positioned ~-1 ~ ~ if block ^ ^ ^.1 #emk:transparent positioned ~ ~ ~-1 if block ^ ^ ^.1 #emk:transparent positioned ~1 ~ ~ if block ^ ^ ^.1 #emk:transparent positioned ~-.5 ~ ~.5 run tp @s ^ ^ ^.1
|
|
execute positioned ^ ^ ^.1 if block ~.5 ~1 ~.5 #emk:transparent if block ~.5 ~1 ~-.5 #emk:transparent if block ~-.5 ~1 ~-.5 #emk:transparent if block ~-.5 ~1 ~.5 #emk:transparent run scoreboard players add #tmp emk-id 2
|
|
execute positioned ^ ^ ^.1 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 add #tmp emk-id 1
|
|
execute positioned ^ ^ ^.1 if block ~.5 ~2 ~.5 #emk:transparent if block ~.5 ~2 ~-.5 #emk:transparent if block ~-.5 ~2 ~-.5 #emk:transparent if block ~-.5 ~2 ~.5 #emk:transparent run scoreboard players add #tmp emk-id 1
|
|
#0-2 is wall, 3-4 is clear
|
|
execute if score @s emk-distance matches 1000.. if score #tmp emk-id matches ..2 unless score @s emk-collision matches 1 run playsound minecraft:block.anvil.place master @a ~ ~ ~ .5 .75
|
|
execute if score @s emk-distance matches 1000.. if score #tmp emk-id matches ..2 run scoreboard players set @s emk-collision 1
|
|
execute if score @s emk-distance matches 1000.. if score #tmp emk-id matches ..2 run scoreboard players set @s emk-speed 0
|
|
execute if score @s emk-distance matches 1000.. if score #tmp emk-id matches ..2 if block ^.25 ^ ^.7 #emk:transparent if block ^.25 ^1 ^.7 #emk:transparent run scoreboard players remove @s emk-rot 10000
|
|
execute if score @s emk-distance matches 1000.. if score #tmp emk-id matches ..2 if block ^-.25 ^ ^.7 #emk:transparent if block ^-.25 ^1 ^.7 #emk:transparent run scoreboard players add @s emk-rot 10000
|
|
execute if score @s emk-distance matches 1000.. if score #tmp emk-id matches ..2 run scoreboard players set @s emk-distance 0
|
|
execute if score @s emk-distance matches 1000.. if score #tmp emk-id matches 3.. run scoreboard players set @s emk-collision 0
|
|
scoreboard players set #tmp emk-speed 0
|
|
execute if score #tmp emk-id matches 3.. 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
|
|
scoreboard players set #tmp emk-item 0
|
|
execute if score #tmp emk-id matches 3.. if score #tmp emk-speed matches 0 run scoreboard players set #tmp emk-item 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 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 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
|
|
#these lines can be moved to kart/update if performance is a problem, at the cost of less accuracy.
|
|
execute if block ~ ~-1 ~ minecraft:gold_block run scoreboard players set @s emk-ymov 5000
|
|
execute if block ~ ~-2 ~ minecraft:gold_block run scoreboard players set @s emk-ymov 5000
|
|
execute if block ~ ~-1 ~ minecraft:gold_block run scoreboard players set @s[scores={emk-speed=..1500}] emk-speed 1500
|
|
execute if block ~ ~-2 ~ minecraft:gold_block run scoreboard players set @s[scores={emk-speed=..1500}] emk-speed 1500
|
|
execute if score @s emk-star matches 1.. as @e[tag=emk-slime,distance=...95] run function emk:slime/hit
|
|
execute if score @s emk-star matches 1.. run kill @e[tag=emk-turtle,distance=1]
|
|
tag @s add emk-sel2
|
|
execute positioned ~ ~.9 ~ as @e[tag=emk-box,distance=...95] unless score @s emk-timer matches 1.. at @s run function emk:box/open
|
|
execute if score @s emk-star matches 0 as @e[tag=emk-slime,distance=...95] run function emk:slime/hit
|
|
#{ hit other kart
|
|
execute run tag @e[tag=emk-kart,tag=!emk-sel2,tag=!emk-finished,scores={emk-stun=0,emk-star=0},sort=nearest,distance=..1,limit=1] add emk-sel3
|
|
execute if score @s emk-star matches 1.. as @e[tag=emk-sel3] run function emk:kart/explode
|
|
execute if score @s emk-star matches 1.. if entity @e[tag=emk-sel3] run playsound minecraft:entity.generic.explode master @a ~ ~ ~ 1.5 .8
|
|
execute if score @s emk-star matches 0 if entity @e[tag=emk-sel3] run playsound minecraft:block.anvil.place master @a ~ ~ ~ .5 .8
|
|
#execute if score @s emk-star matches 0 if entity @e[tag=emk-sel3] facing entity @e[tag=emk-sel3,limit=1] feet rotated ~ 0 run tp @s ^ ^ ^-.1
|
|
#execute if score @s emk-star matches 0 if entity @e[tag=emk-sel3] at @e[tag=emk-sel3] facing entity @s feet rotated ~ 0 run tp @e[tag=emk-sel3] ^ ^ ^-.1
|
|
scoreboard players set #tmp emk-star 2
|
|
#bad but works
|
|
tag @s[scores={emk-star=0}] add emk-sel3
|
|
execute if score @s emk-star matches 0 positioned ^ ^ ^1.5 run scoreboard players operation @e[tag=emk-sel3,sort=furthest,limit=1] emk-speed /= #tmp emk-star
|
|
execute if score @s emk-star matches 0 positioned ^ ^ ^1.5 run scoreboard players operation @e[tag=emk-sel3,sort=nearest,limit=1] emk-speed += @e[tag=emk-sel3,sort=furthest,limit=1] emk-speed
|
|
tag @e remove emk-sel3
|
|
#} end hit other kart
|
|
tag @s remove emk-sel2
|
|
#scoreboard players operation #tmp emk-race = @s emk-race
|
|
execute if score @s emk-chkpnt matches 0..99 if block ~ 0 ~ minecraft:white_wool run function emk:kart/lap
|
|
execute if score @s emk-chkpnt matches 100..199 if block ~ 0 ~ minecraft:orange_wool run function emk:kart/cpnt1
|
|
execute if score @s emk-chkpnt matches 200..299 if block ~ 0 ~ minecraft:magenta_wool run function emk:kart/cpnt2
|
|
execute if score @s emk-chkpnt matches 300..399 if block ~ 0 ~ minecraft:light_blue_wool run function emk:kart/cpnt3
|
|
execute if score @s emk-chkpnt matches 400..499 if block ~ 0 ~ minecraft:yellow_wool run function emk:kart/cpnt4
|
|
execute if score @s emk-chkpnt matches 500..599 if block ~ 0 ~ minecraft:lime_wool run function emk:kart/cpnt5
|
|
execute if score @s emk-chkpnt matches 600..699 if block ~ 0 ~ minecraft:pink_wool run function emk:kart/cpnt6
|
|
execute if score @s emk-chkpnt matches 700..799 if block ~ 0 ~ minecraft:gray_wool run function emk:kart/cpnt7
|
|
execute if score @s emk-chkpnt matches 800..899 if block ~ 0 ~ minecraft:light_gray_wool run function emk:kart/cpnt8
|
|
execute if score @s emk-chkpnt matches 900..999 if block ~ 0 ~ minecraft:cyan_wool run function emk:kart/cpnt9
|
|
execute if score @s emk-chkpnt matches 1000..1099 if block ~ 0 ~ minecraft:purple_wool run function emk:kart/cpnt10
|
|
execute if score @s emk-chkpnt matches 1100..1199 if block ~ 0 ~ minecraft:blue_wool run function emk:kart/cpnt11
|
|
execute if score @s emk-chkpnt matches 1200..1299 if block ~ 0 ~ minecraft:brown_wool run function emk:kart/cpnt12
|
|
execute if score @s emk-chkpnt matches 1300..1399 if block ~ 0 ~ minecraft:green_wool run function emk:kart/cpnt13
|
|
execute if score @s emk-chkpnt matches 1400..1499 if block ~ 0 ~ minecraft:red_wool run function emk:kart/cpnt14
|
|
execute if score @s emk-chkpnt matches 1500..1599 if block ~ 0 ~ minecraft:black_wool run function emk:kart/cpnt15 |