Skip to content

Commit

Permalink
Improved death animation and respawn
Browse files Browse the repository at this point in the history
  • Loading branch information
VForiel committed Oct 11, 2023
1 parent 585654c commit 39d47d0
Show file tree
Hide file tree
Showing 34 changed files with 221 additions and 163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ tag @a[tag=player.item.can_have_book] remove player.item.can_have_book
# Time counter
scoreboard players add #game.time.tick timer 1

execute as @a[gamemode=!spectator,tag=!Respawning,scores={listener.death=0}] at @s store result score @s pos.x run data get entity @s Pos[0]
execute as @a[gamemode=!spectator,tag=!Respawning,scores={listener.death=0}] at @s store result score @s pos.y run data get entity @s Pos[1]
execute as @a[gamemode=!spectator,tag=!Respawning,scores={listener.death=0}] at @s store result score @s pos.z run data get entity @s Pos[2]

# +++++++++++++++++++++++++++++++++++++
# Mains
# +++++++++++++++++++++++++++++++++++++

function scaffolding_rush:game/death_detection
execute unless score #lava.period.tick options matches 0 run function scaffolding_rush:game/lava/__main__

execute if score #flag.take_over options matches 1 run function scaffolding_rush:game/flag/__main__
Expand Down Expand Up @@ -60,16 +55,31 @@ execute as @a[gamemode=!spectator] at @s run function scaffolding_rush:game/buil
execute if score #game.end data matches 0 run function scaffolding_rush:game/test_end

# Elimination if team exist, unless players in game, unless players are respawning
execute if entity @a[team=blue,tag=!TeamEliminated] unless entity @a[team=blue,gamemode=!spectator] unless entity @a[team=blue,tag=Respawning] unless entity @e[type=villager,tag=blue_villager,tag=respawn_villager] run function scaffolding_rush:game/elimination/blue
execute if entity @a[team=green,tag=!TeamEliminated] unless entity @a[team=green,gamemode=!spectator] unless entity @a[team=green,tag=Respawning] unless entity @e[type=villager,tag=green_villager,tag=respawn_villager] run function scaffolding_rush:game/elimination/green
execute if entity @a[team=red,tag=!TeamEliminated] unless entity @a[team=red,gamemode=!spectator] unless entity @a[team=red,tag=Respawning] unless entity @e[type=villager,tag=red_villager,tag=respawn_villager] run function scaffolding_rush:game/elimination/red
execute if entity @a[team=yellow,tag=!TeamEliminated] unless entity @a[team=yellow,gamemode=!spectator] unless entity @a[team=yellow,tag=Respawning] unless entity @e[type=villager,tag=yellow_villager,tag=respawn_villager] run function scaffolding_rush:game/elimination/yellow
execute if entity @a[team=blue,tag=!TeamEliminated] \
unless entity @a[team=blue,tag=!player.is_dead] \
unless entity @e[type=villager,tag=blue_villager,tag=respawn_villager] \
run function scaffolding_rush:game/elimination/blue

execute if entity @a[team=green,tag=!TeamEliminated] \
unless entity @a[team=green,tag=!player.is_dead] \
unless entity @e[type=villager,tag=green_villager,tag=respawn_villager] \
run function scaffolding_rush:game/elimination/green

execute if entity @a[team=red,tag=!TeamEliminated] \
unless entity @a[team=red,tag=!player.is_dead] \
unless entity @e[type=villager,tag=red_villager,tag=respawn_villager] \
run function scaffolding_rush:game/elimination/red

execute if entity @a[team=yellow,tag=!TeamEliminated] \
unless entity @a[team=yellow,tag=!player.is_dead] \
unless entity @e[type=villager,tag=yellow_villager,tag=respawn_villager] \
run function scaffolding_rush:game/elimination/yellow

# Revive players from changed gamemode
execute if entity @a[team=blue,tag=TeamEliminated,gamemode=!spectator] run tag @a[team=blue] remove TeamEliminated
execute if entity @a[team=green,tag=TeamEliminated,gamemode=!spectator] run tag @a[team=gree] remove TeamEliminated
execute if entity @a[team=red,tag=TeamEliminated,gamemode=!spectator] run tag @a[team=red] remove TeamEliminated
execute if entity @a[team=yellow,tag=TeamEliminated,gamemode=!spectator] run tag @a[team=yellow] remove TeamEliminated
execute if entity @e[type=villager,tag=red_villager,tag=respawn_villager] run tag @a[team=red] remove TeamEliminated
execute if entity @e[type=villager,tag=blue_villager,tag=respawn_villager] run tag @a[team=blue] remove TeamEliminated
execute if entity @e[type=villager,tag=green_villager,tag=respawn_villager] run tag @a[team=green] remove TeamEliminated
execute if entity @e[type=villager,tag=yellow_villager,tag=respawn_villager] run tag @a[team=yellow] remove TeamEliminated

# Count active teams
scoreboard players set RemainingTeam data 0
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ execute if entity @s[tag=flagOne] run function scaffolding_rush:game/flag/drop/p
execute if entity @s[tag=flagTwo] run function scaffolding_rush:game/flag/drop/point/2
execute if entity @s[tag=flagFive] run function scaffolding_rush:game/flag/drop/point/5

#rise the summoned armor stand (the function is executed as the player)
# rise the summoned armor stand (the function is executed as the player)
scoreboard players operation @s fallDistance /= 100 const
execute unless score @s fallDistance matches 3.. run scoreboard players set @s fallDistance 3
scoreboard players operation @e[type=armor_stand,tag=new] data = @s fallDistance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ scoreboard players set #VolcanoPopNumber data 0
execute as @e[type=marker,tag=VolcanoPop] run scoreboard players add #VolcanoPopNumber data 1

execute if score #VolcanoPopNumber data matches 0..50 run summon marker ~ ~ ~ {Tags:["Volcano","VolcanoPop","VolcanoPopNew"]}
#
# summon block_display ~ ~ ~ {block_state:{Name:"minecraft:magma_block"},Tags:["Volcano","VolcanoPop","VolcanoPopNew"]}

scoreboard players set @e[type=marker,tag=VolcanoPopNew] glib.lifetime -100

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function scaffolding_rush:lobby/animation/__main__
execute as @e[type=marker,tag=lobbyLight] at @s if block ~ ~ ~ #scaffolding_rush:air run function scaffolding_rush:lobby/light

# Suffocation
execute as @a at @s if block ~ ~ ~ #scaffolding_rush:lobby_suffocation run function scaffolding_rush:lobby/suffocation
execute as @a[tag=!player.is_dead] at @s if block ~ ~ ~ #scaffolding_rush:lobby_suffocation run function scaffolding_rush:lobby/suffocation

# Start game
execute unless score #admin.exist options matches 1 as @a[scores={bellring=1..}] run scoreboard players set @s trigger.start_game 1
Expand All @@ -33,8 +33,6 @@ scoreboard players reset @a bellring
# interaction
function scaffolding_rush:lobby/interaction/__main__

execute as @a[gamemode=survival] at @s if block ~ ~-0.01 ~ magma_block run kill @s

execute as @a[scores={trigger.tutorial=1}] run function scaffolding_rush:tutorial/join

tag @a[tag=!player.item.can_have_book] add player.item.can_have_book
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ execute if score @s pos.y < 0 const run tp @s ~ 3 ~

#check Z
execute if score @s pos.z > WBbyTwo data run tp @s ~ ~ ~-2
execute if score @s pos.z < -WBbyTwo data run tp @s ~ ~ ~2

#suffocation
execute if score #game.running data matches 0 if block ~ ~ ~ #scaffolding_rush:lobby_suffocation run function scaffolding_rush:lobby/suffocation
execute if score @s pos.z < -WBbyTwo data run tp @s ~ ~ ~2
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

tp @s ~ ~1 ~
say @s suffocating
execute if block ~ ~ ~ #scaffolding_rush:lobby_suffocation positioned ~ ~1 ~ run function scaffolding_rush:lobby/suffocation
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
spreadplayers 0 0 0 5 false @s
execute at @s run teleport @s ~ ~-11 ~ 0 0
tag @s remove InGame
spawnpoint @a 1 24 1
gamemode adventure @s
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ function scaffolding_rush:player/items

# Death Management ------------------------------------------------------------

function scaffolding_rush:player/death/trigger
function scaffolding_rush:player/death/trigger

# Animated title
execute if entity @a[scores={player.animated_title.timer=1..}] run function scaffolding_rush:player/animated_title/animation

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Execute as & at the player
# Called by function scaffolding_rush:player/death/trigger

execute at @a[scores={player.death.animation=1..}] run particle lava ~ ~ ~ 0.5 0.5 0.5 0 3 normal
# Force ride and sink into lava
ride @s mount @e[tag=player.death.drown_in_lava.animation,limit=1,sort=nearest]
execute as @e[tag=player.death.drown_in_lava.animation,limit=1,sort=nearest] at @s run tp @s ~ ~-0.025 ~
execute at @s run particle lava ~ ~ ~ 0.5 0.5 0.5 0 3 normal

execute as @a[scores={player.death.animation=1..}] at @s anchored eyes positioned ^ ^ ^ if block ~1 ~ ~ magma_block on vehicle at @s run tp @s ~ ~1 ~
execute as @a[scores={player.death.animation=1..}] at @s anchored eyes positioned ^ ^ ^ if block ~-1 ~ ~ magma_block on vehicle at @s run tp @s ~ ~1 ~
execute as @a[scores={player.death.animation=1..}] at @s anchored eyes positioned ^ ^ ^ if block ~ ~ ~1 magma_block on vehicle at @s run tp @s ~ ~1 ~
execute as @a[scores={player.death.animation=1..}] at @s anchored eyes positioned ^ ^ ^ if block ~ ~ ~-1 magma_block on vehicle at @s run tp @s ~ ~1 ~
# Prevent new lava layer to make the player suffocate
execute at @s anchored eyes positioned ^ ^ ^ if block ~1 ~ ~ magma_block on vehicle at @s run tp @s ~ ~1 ~
execute at @s anchored eyes positioned ^ ^ ^ if block ~-1 ~ ~ magma_block on vehicle at @s run tp @s ~ ~1 ~
execute at @s anchored eyes positioned ^ ^ ^ if block ~ ~ ~1 magma_block on vehicle at @s run tp @s ~ ~1 ~
execute at @s anchored eyes positioned ^ ^ ^ if block ~ ~ ~-1 magma_block on vehicle at @s run tp @s ~ ~1 ~

execute as @e[tag=player.death.animation.vehicle] at @s run tp @s ~ ~-0.025 ~
execute as @a[scores={player.death.animation=1..}] at @s run ride @s mount @e[tag=player.death.animation.vehicle,limit=1,sort=nearest]

kill @e[tag=player.death.animation.vehicle,scores={player.death.animation=1}]
execute as @a[scores={player.death.animation=1}] at @s run function scaffolding_rush:player/death/kill

scoreboard players remove @e[scores={player.death.animation=1..}] player.death.animation 1
# End of animation
kill @e[tag=player.death.drown_in_lava.animation,scores={player.death.animation=..1}]
execute if score @s player.death.animation matches 1 run function scaffolding_rush:player/death/respawn/start
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
# Execute as & at the player
# Called by function scaffolding_rush:player/death/trigger

execute if score DevelopementMode data matches 1 run say player/death/kill/lava
function scaffolding_rush:player/death/just_died

execute if entity @s run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"selector":"@s"},{"text":" fell into the lava","color":"gray"}]
execute if entity @s run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"selector":"@s"},{"text":" est tombé·e dans la lave","color":"gray"}]

effect give @s resistance 3 127 true
effect give @s fire_resistance 3 127 true

playsound minecraft:entity.player.hurt_on_fire ambient @s ~ ~ ~

playsound blazing_scaffolding:lava_drown master @a[distance=..30] ~ ~ ~ 1 1 0

summon armor_stand ~ ~ ~ {Tags:["player.death.animation.vehicle","player.death.animation.vehicle.new"],NoGravity:1,Small:1,Marker:1,Invisible:1}
summon armor_stand ~ ~ ~ {Tags:["player.death.drown_in_lava.animation","player.death.drown_in_lava.animation.new"],NoGravity:1,Small:1,Marker:1,Invisible:1}

tp @e[tag=player.death.animation.vehicle.new,limit=1,sort=nearest] @s
ride @s mount @e[tag=player.death.animation.vehicle.new,limit=1,sort=nearest]
tp @e[tag=player.death.drown_in_lava.animation.new,limit=1,sort=nearest] @s
ride @s mount @e[tag=player.death.drown_in_lava.animation.new,limit=1,sort=nearest]

scoreboard players set @e[tag=player.death.animation.vehicle.new] player.death.animation 40
scoreboard players set @e[tag=player.death.drown_in_lava.animation.new] player.death.animation 40
scoreboard players set @s player.death.animation 40
tag @s add player.death.drown_in_lava

tag @e[tag=player.death.drown_in_lava.animation.new] remove player.death.drown_in_lava.animation.new
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Execute as & at the player
# Called by functions scaffolding_rush:player/death/<type>/start

tag @s add player.is_dead

# Drop the flag
summon marker ~ ~ ~ {Tags:["last_death"]}
execute store result entity @e[type=marker,tag=last_death,limit=1] Pos[0] double 1.0 run scoreboard players get @s pos.x
execute store result entity @e[type=marker,tag=last_death,limit=1] Pos[1] double 1.0 run scoreboard players get @s pos.y
execute store result entity @e[type=marker,tag=last_death,limit=1] Pos[2] double 1.0 run scoreboard players get @s pos.z
execute unless score #flag.take_over options matches 0 if entity @s[tag=flag_carry] positioned as @e[type=marker,tag=last_death,limit=1] run function scaffolding_rush:game/flag/drop/any
kill @e[type=marker,tag=last_death]

effect clear @s
clear @s
tag @s remove player.item.can_have_items

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Execute as & at the player
# Called by function scaffolding_rush:player/death/trigger

# Force spectate camera
spectate @e[tag=player.death.killed_by_player.animation,limit=1,sort=nearest] @s[scores={player.death.animation=1..39}]
execute as @e[tag=player.death.killed_by_player.animation,limit=1,sort=nearest] at @s run tp @s ^ ^ ^-0.05 ~ ~1

# End of animation
kill @e[tag=player.death.killed_by_player.animation,scores={player.death.animation=..1}]
execute if score @s player.death.animation matches 1 run function scaffolding_rush:player/death/respawn/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Execute as & at the player
# Called by function scaffolding_rush:player/death/trigger

function scaffolding_rush:player/death/just_died

execute if entity @s run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"selector":"@s"},{"text":" was killed","color":"gray"}]
execute if entity @s run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"selector":"@s"},{"text":" a été tué","color":"gray"}]

summon armor_stand ~ ~ ~ {Tags:["player.death.killed_by_player.animation","player.death.killed_by_player.animation.new"],NoGravity:1,Small:1,Marker:1,Invisible:1}

tp @e[tag=player.death.killed_by_player.animation.new,limit=1,sort=nearest] @s
gamemode spectator @s
# spectate @e[tag=player.death.killed_by_player.animation.new,limit=1,sort=nearest] @s

scoreboard players set @e[tag=player.death.killed_by_player.animation.new] player.death.animation 40
scoreboard players set @s player.death.animation 40
tag @s add player.death.killed_by_player

scoreboard players set @s listener.death 0

tag @e[tag=player.death.killed_by_player.animation.new] remove player.death.killed_by_player.animation.new

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Title when the player is respawning

# say player/death/respawn/animation @s

title @s[scores={option.language=0}] title ["",{"text":"Respawning...","color":"red"}]
title @s[scores={option.language=1}] title ["",{"text":"Réapparition...","color":"red"}]

# Progress bar ----------------------------------------------------------------

scoreboard players operation #seconds tmp = @s respawn.timer
scoreboard players operation #seconds tmp *= 10 const
Expand All @@ -12,4 +18,13 @@ execute if score #seconds tmp matches 5 run title @s subtitle ["",{"text":"\u25c
execute if score #seconds tmp matches 4 run title @s subtitle ["",{"text":"\u25c6\u25c6\u25c6\u25c6","color":"dark_red"},{"text":"\u25c6\u25c6\u25c6\u25c6\u25c6","color":"gray"}]
execute if score #seconds tmp matches 3 run title @s subtitle ["",{"text":"\u25c6\u25c6\u25c6","color":"dark_red"},{"text":"\u25c6\u25c6\u25c6\u25c6\u25c6\u25c6","color":"gray"}]
execute if score #seconds tmp matches 2 run title @s subtitle ["",{"text":"\u25c6\u25c6","color":"dark_red"},{"text":"\u25c6\u25c6\u25c6\u25c6\u25c6\u25c6\u25c6","color":"gray"}]
execute if score #seconds tmp matches 1 run title @s subtitle ["",{"text":"\u25c6","color":"dark_red"},{"text":"\u25c6\u25c6\u25c6\u25c6\u25c6\u25c6\u25c6\u25c6","color":"gray"}]
execute if score #seconds tmp matches 1 run title @s subtitle ["",{"text":"\u25c6","color":"dark_red"},{"text":"\u25c6\u25c6\u25c6\u25c6\u25c6\u25c6\u25c6\u25c6","color":"gray"}]

# Force spectate villager -----------------------------------------------------

spectate @e[type=villager,tag=respawn_villager,tag=red_villager,limit=1,sort=nearest] @s[team=red]
spectate @e[type=villager,tag=respawn_villager,tag=blue_villager,limit=1,sort=nearest] @s[team=blue]
spectate @e[type=villager,tag=respawn_villager,tag=green_villager,limit=1,sort=nearest] @s[team=green]
spectate @e[type=villager,tag=respawn_villager,tag=yellow_villager,limit=1,sort=nearest] @s[team=yellow]

execute if score @s respawn.timer matches 1 at @s run function scaffolding_rush:player/death/respawn/stop
Loading

0 comments on commit 39d47d0

Please sign in to comment.