Skip to content

Commit

Permalink
🚸 Prophunt: Better position indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
VForiel committed Jan 9, 2024
1 parent c6ed9b4 commit 9d34e29
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion minigames/data/prophunt/functions/taunt/main.mcfunction
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Executed globally
# tellraw @a {"text":"prophunt:taunt/main"}

scoreboard players remove @a[tag=prophunt.is_prop,scores={prophunt.taunt_timer=0..}] prophunt.taunt_timer 1
scoreboard players remove @a[tag=prophunt.is_prop] prophunt.taunt_timer 1

execute as @a[tag=prophunt.is_prop,scores={prophunt.taunt_timer=..0}] at @s run function prophunt:taunt/run

Expand Down
27 changes: 22 additions & 5 deletions minigames/data/prophunt/functions/taunt/run.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,31 @@

playsound entity.villager.yes master @a[distance=..30] ~ ~ ~ 2 2 0

execute at @a[tag=prophunt.is_hunter] run summon marker ~ ~ ~ {Tags:["prophunt.entity","prophunt.entity.new","prophunt.position_indicator"]}
tag @s add prophunt.taunt

execute at @e[tag=prophunt.is_hunter] as @s anchored eyes positioned ^ ^ ^1 facing entity @s feet as @e[tag=prophunt.entity.new,tag=prophunt.position_indicator] positioned ^ ^ ^2 positioned ~ ~0.5 ~ run tp @s ~ ~ ~
execute at @a[tag=prophunt.is_hunter] as @s anchored eyes positioned ^ ^ ^1 as @e[tag=prophunt.entity.new,tag=prophunt.position_indicator] run function prophunt:taunt/indicate_direction
# Getting the relative orientation of the hunter
execute as @a[tag=prophunt.is_hunter] at @s anchored eyes positioned ^ ^ ^ facing entity @p[tag=prophunt.taunt] feet run function #bs.position:get_rot_h {scale:1}
execute as @a[tag=prophunt.is_hunter] run scoreboard players operation @s ctx = @s bs.rot.h
execute as @a[tag=prophunt.is_hunter] at @s run function #bs.position:get_rot_h {scale:1}
execute as @a[tag=prophunt.is_hunter] run scoreboard players operation @s ctx -= @s bs.rot.h
execute as @a[tag=prophunt.is_hunter] run scoreboard players operation @s bs.rot.h = @s ctx
execute as @a[tag=prophunt.is_hunter] run function #bs.position:normalize_rot

# Show an arrow pointing to the prop
execute as @a[tag=prophunt.is_hunter] run title @s times 0 10 10
execute as @a[tag=prophunt.is_hunter,scores={bs.rot.h=..23}] run title @s title {"text":"⬆","color":"red"}
execute as @a[tag=prophunt.is_hunter,scores={bs.rot.h=24..68}] run title @s title {"text":"⬈","color":"red"}
execute as @a[tag=prophunt.is_hunter,scores={bs.rot.h=69..113}] run title @s title {"text":"âž¡","color":"red"}
execute as @a[tag=prophunt.is_hunter,scores={bs.rot.h=114..158}] run title @s title {"text":"⬊","color":"red"}
execute as @a[tag=prophunt.is_hunter,scores={bs.rot.h=159..203}] run title @s title {"text":"⬇","color":"red"}
execute as @a[tag=prophunt.is_hunter,scores={bs.rot.h=204..248}] run title @s title {"text":"⬋","color":"red"}
execute as @a[tag=prophunt.is_hunter,scores={bs.rot.h=249..293}] run title @s title {"text":"⬅","color":"red"}
execute as @a[tag=prophunt.is_hunter,scores={bs.rot.h=294..337}] run title @s title {"text":"⬉","color":"red"}
execute as @a[tag=prophunt.is_hunter,scores={bs.rot.h=338..}] run title @s title {"text":"⬆","color":"red"}

# Next taunt arrive randomly after 10 to 30 seconds
execute as @a[tag=prophunt.is_prop] store result score @s prophunt.taunt_timer run random value 0..400
scoreboard players add @a[tag=prophunt.is_prop] prophunt.taunt_timer 200

scoreboard players add @a[tag=prophunt.is_prop] prophunt.taunt_timer 200

kill @e[tag=prophunt.position_indicator]
tag @a[tag=prophunt.taunt] remove prophunt.taunt

0 comments on commit 9d34e29

Please sign in to comment.