
# -> If player has never been downed then send the tip message
execute unless score #or.setting.tips OverlyRealistic.Settings.ArbitrarySetting matches 0 run \
    tellraw @s[tag=!OverlyRealistic.Player.HasBeenDownedOnce] \
        [\
            {\
                text:"\n"\
            },\
            {\
                text:"\u0037",\
                "font":"overlyrealistic:icons"\
            },\
            {\
                text:" Tip: You can be helped up by having another player crouch near you!\n",\
                color: "#ffc444"\
            }\
        ]


# -> Tag player
tag @s add OverlyRealistic.Player.IsDowned
tag @s add OverlyRealistic.Player.HasBeenDownedBefore
tag @s add OverlyRealistic.Player.HasBeenDownedOnce

# -> Create death ID
execute store result score @s OverlyRealistic.Player.DeathID run \
    scoreboard players add #or.global OverlyRealistic.Player.DeathID 1

# -> Create downing entity and sit player down
function overly_realistic:general/downing/downing_ents

# -> Set timers
scoreboard players set @s OverlyRealistic.Player.DeathTimer 0
scoreboard players set @s OverlyRealistic.Player.HelpTimer 0

scoreboard players set @s OverlyRealistic.Player.DeathTimer_Minutes 2
scoreboard players set @s OverlyRealistic.Player.DeathTimer_Seconds 0
scoreboard players set @s OverlyRealistic.Player.DeathTimer_Ticks 0

scoreboard players set @s OverlyRealistic.Player.HelpTimer_Minutes 1
scoreboard players set @s OverlyRealistic.Player.HelpTimer_Seconds 0
scoreboard players set @s OverlyRealistic.Player.HelpTimer_Ticks 0

# -> Attributes
#attribute @s movement_speed modifier add overly_realistic:downed_player_movement_speed -100.0 add_value
#attribute @s jump_strength modifier add overly_realistic:downed_player_jump_strength -100.0 add_value
#attribute @s gravity base set 0

# -> Start loop
schedule function overly_realistic:general/downing/downing_main_1t 1t append
