Skip to content

Commit

Permalink
πŸ’« add outside tvscreen death animation when player dies in fight (#238)
Browse files Browse the repository at this point in the history
* ♻️ rename `show_custom_death_message` flag to `player_died`

* πŸ› fix players in creative/spectator at low health triggering custom death message

* 🍱 add sounds for death animation

* πŸ’« add outside tvscreen death animation

* πŸŽ₯ run death animation on outside tvscreen upon player death

* πŸ§‘β€πŸ’» add manual test to see outside tvscreen death animation

* πŸ› add act button interaction advancement to build
  • Loading branch information
TheAfroOfDoom authored Oct 24, 2024
1 parent 74a43c7 commit 2fad8a6
Show file tree
Hide file tree
Showing 41 changed files with 613 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# player Steve spawn
execute as Steve run function omegaflowey.entity:directorial/boss_fight/summit/player/queue/join
execute as Steve run function omegaflowey.entity:directorial/boss_fight/summit/player/queue/prompt_next_player/show_prompt/confirm
gamemode adventure Steve
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# If player is going to die to this hit, disable `showDeathMessages` temporarily and display a custom death message
scoreboard players set #omegaflowey.bossfight.show_custom_death_message omegaflowey.global.flag 0
scoreboard players set #omegaflowey.bossfight.player_died omegaflowey.global.flag 0
$execute \
if entity @s[gamemode=!creative, gamemode=!spectator] \
if score @s omegaflowey.player.health matches ..$(damage) \
unless data entity @s active_effects[{ amplifier: 4b, duration: -1, id: "minecraft:resistance" }] \
run scoreboard players set #omegaflowey.bossfight.show_custom_death_message omegaflowey.global.flag 1
execute if score #omegaflowey.bossfight.show_custom_death_message omegaflowey.global.flag matches 1 store result score @s omegaflowey.math.0 run gamerule showDeathMessages
execute if score #omegaflowey.bossfight.show_custom_death_message omegaflowey.global.flag matches 1 \
if score @s omegaflowey.math.0 matches 1 run gamerule showDeathMessages false
run scoreboard players set #omegaflowey.bossfight.player_died omegaflowey.global.flag 1
execute \
if score #omegaflowey.bossfight.player_died omegaflowey.global.flag matches 1 \
store result score @s omegaflowey.math.0 \
run gamerule showDeathMessages
execute \
if score #omegaflowey.bossfight.player_died omegaflowey.global.flag matches 1 \
if score @s omegaflowey.math.0 matches 1 \
run gamerule showDeathMessages false

# TODO(39): remove these `unless entity @e[tag=boss_fight]`/`if entity @e[tag=boss_fight]` checks when boss fight is fully setup
# we have it here for development so that the boss entity (omega-flowey)
Expand All @@ -32,7 +38,7 @@ schedule function omegaflowey.entity:utils/damage/reset_immunity_flag 10t replac

# Show custom death message
# TAG_SUMMIT_HARDCODED_GLOBAL_VOLUME
execute if score #omegaflowey.bossfight.show_custom_death_message omegaflowey.global.flag matches 1 run \
execute if score #omegaflowey.bossfight.player_died omegaflowey.global.flag matches 1 run \
tellraw @a[ \
x=-186, dx=91, y=12, dy=93, z=12, dz=95, \
tag=omegaflowey.player \
Expand All @@ -42,6 +48,10 @@ execute if score #omegaflowey.bossfight.show_custom_death_message omegaflowey.gl
{ "text": "Omega Flowey", "color": "green" } \
]

# Run outside tvscreen death animation
execute if score #omegaflowey.bossfight.player_died omegaflowey.global.flag matches 1 run \
function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation with storage omegaflowey:decorative

# Re-enable `showDeathMessages` if it was enabled previously
execute if score #omegaflowey.bossfight.show_custom_death_message omegaflowey.global.flag matches 1 \
execute if score #omegaflowey.bossfight.player_died omegaflowey.global.flag matches 1 \
if score @s omegaflowey.math.0 matches 1 run gamerule showDeathMessages true
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ scoreboard objectives add omegaflowey.boss-fight.progress.phase.total dummy
scoreboard objectives add omegaflowey.boss-fight.warn.clock.i dummy
scoreboard objectives add omegaflowey.boss-fight.warn.clock.total dummy

scoreboard objectives add omegaflowey.decorative.clock.i dummy

scoreboard objectives add omegaflowey.global.flag dummy

scoreboard objectives add omegaflowey.group.id dummy
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function omegaflowey.main:summit/room/outside/setup/tv_screen/set_screen/clear
$execute as $(outside_tvscreen_uuid) run tag @s remove is_active_death_animation
function omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_shared/macro_set_static with storage omegaflowey:decorative
schedule function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_idle/scheduled 10t replace
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$execute as $(outside_tvscreen_uuid) at @s \
run function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_break/macro/as_root
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function animated_java:omegaflowey_tv_screen/variants/soul_break/apply
playsound omega-flowey:decorative.soul.break ambient @a[distance=..64] ~ ~ ~ 4
schedule function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_shatter/scheduled 26t replace
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_break/macro \
with storage omegaflowey:decorative
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$execute as $(outside_tvscreen_uuid) at @s \
run function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_idle/macro/as_root
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
stopsound @a[distance=..64] ambient omega-flowey:decorative.static
function animated_java:omegaflowey_tv_screen/variants/soul_idle/apply
playsound omega-flowey:decorative.soul.show ambient @a[distance=..64] ~ ~ ~ 4
schedule function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_break/scheduled 30t replace
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_idle/macro \
with storage omegaflowey:decorative
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
execute unless entity @s[tag=tv_screen.outside, tag=is_active_death_animation] run return 0

scoreboard players add @s omegaflowey.decorative.clock.i 1
execute if score @s omegaflowey.decorative.clock.i matches 38 run return run tag @s remove is_active_death_animation

execute if score @s omegaflowey.decorative.clock.i matches 0 run playsound omega-flowey:decorative.soul.shatter ambient @a[distance=..64] ~ ~ ~ 4
execute if score @s omegaflowey.decorative.clock.i matches 0 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_0/apply

execute if score @s omegaflowey.decorative.clock.i matches 1 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_1/apply
execute if score @s omegaflowey.decorative.clock.i matches 2 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_2/apply
execute if score @s omegaflowey.decorative.clock.i matches 3 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_3/apply
execute if score @s omegaflowey.decorative.clock.i matches 4 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_4/apply
execute if score @s omegaflowey.decorative.clock.i matches 5 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_5/apply
execute if score @s omegaflowey.decorative.clock.i matches 6 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_6/apply
execute if score @s omegaflowey.decorative.clock.i matches 7 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_7/apply
execute if score @s omegaflowey.decorative.clock.i matches 8 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_8/apply
execute if score @s omegaflowey.decorative.clock.i matches 9 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_9/apply
execute if score @s omegaflowey.decorative.clock.i matches 10 run return run function animated_java:omegaflowey_tv_screen/variants/soul_shatter_10/apply
execute if score @s omegaflowey.decorative.clock.i matches 11 run return run function animated_java:omegaflowey_tv_screen/variants/default/apply
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$execute as $(outside_tvscreen_uuid) at @s \
run function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_shatter/macro/as_root
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
schedule function omegaflowey.main:summit/room/outside/setup/tv_screen/reset_variant 40t replace
scoreboard players set @s omegaflowey.decorative.clock.i -1
tag @s add is_active_death_animation
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
function omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_shatter/macro \
with storage omegaflowey:decorative
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
function omegaflowey.main:summit/room/outside/setup/tv_screen/set_screen/clear
function omegaflowey.main:summit/room/outside/setup/tv_screen/reset_variant/macro with storage omegaflowey:decorative
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$execute as $(outside_tvscreen_uuid) at @s \
run function omegaflowey.main:summit/room/outside/setup/tv_screen/reset_variant/macro/as_root
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Don't switch to day/night variant if in the middle of another animation
execute if entity @s[tag=is_active_death_animation] run return 0

# Check current time of day and play set_variant_day/night accordingly
execute store result score @s omegaflowey.math.0 run time query daytime
execute unless score @s omegaflowey.math.0 matches 13500..23000 run tag @s add is_daytime

execute if entity @s[tag=is_daytime] run function omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_day
execute unless entity @s[tag=is_daytime] run function omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_night

tag @s remove is_daytime
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
schedule clear omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_break/scheduled
schedule clear omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_idle/scheduled
schedule clear omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_shatter/macro/as_root/reset_variant
schedule clear omegaflowey.main:summit/room/outside/setup/tv_screen/death_animation/soul_shatter/scheduled
schedule clear omegaflowey.main:summit/room/outside/setup/tv_screen/reset_variant
schedule clear omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_day/scheduled
schedule clear omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_night/scheduled

execute as @a[distance=..64] run function omegaflowey.main:summit/room/outside/setup/tv_screen/set_screen/clear/as_nearby_players
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
stopsound @s ambient omega-flowey:decorative.static
stopsound @s ambient omega-flowey:decorative.soul.break
stopsound @s ambient omega-flowey:decorative.soul.shatter
stopsound @s ambient omega-flowey:decorative.soul.show
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
function omegaflowey.main:summit/room/outside/setup/tv_screen/set_screen/clear
function omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_shared/macro_set_static with storage omegaflowey:decorative
schedule function omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_day/scheduled 10t
schedule function omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_day/scheduled 10t replace
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
function omegaflowey.main:summit/room/outside/setup/tv_screen/set_screen/clear
function omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_shared/macro_set_static with storage omegaflowey:decorative
schedule function omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_night/scheduled 10t
schedule function omegaflowey.main:summit/room/outside/setup/tv_screen/set_variant_night/scheduled 10t replace
4 changes: 4 additions & 0 deletions package-scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const getSummitDatapackPaths = () => {
'advancement/player_interacted_with_feedback_form_link.json',
'advancement/player_interacted_with_github_description.json',
'advancement/player_interacted_with_join_queue.json',
'advancement/player_interacted_with_soul_act_button_locator.json',
...prefixPaths('function/', [
...bossFightPaths,
'decorative',
Expand Down Expand Up @@ -243,9 +244,12 @@ const getSummitResourcepackPaths = () => {
'mus_sfx_yowl',
'snd_bombfall',
'snd_bombsplosion',
'snd_break1',
'snd_break2',
'snd_break2_c',
'snd_heal_c',
'snd_impact',
'snd_noise',
'snd_select',
'snd_shakerbreaker',
],
Expand Down
Loading

0 comments on commit 2fad8a6

Please sign in to comment.