Round Rejoining (#30342)

* very simple functionality test

* formatting fix

* adapt 220 code, add logging, adjust config

* fixes

* appeases review overlords

* fixes

* 25 min respawn delay, warning is more noticable

* 10 minute respawn delay, cant respawn during wiz or nukies

* more logging + logging fix

* species logging, revert accidental config change

* antag logging + formatting

* pleases review overlords again

* linters

* uses CSS for warning

Co-authored-by: warriorstar-orion <orion@snowfrost.garden>
Signed-off-by: Ahzpy <88119260+Ahzpy@users.noreply.github.com>

* deconflicts paradise.dme?

* fixes runtime with destroyed bodies

* you cant respawn for ragin mages silly

* adds respawn button to ghost hud

* standardize new ghost button coloring

* remove you are not an admin message

* muscle memory fixer

* update hud locations

---------

Signed-off-by: Ahzpy <88119260+Ahzpy@users.noreply.github.com>
Co-authored-by: warriorstar-orion <orion@snowfrost.garden>
This commit is contained in:
Ahzpy
2025-10-11 08:37:45 -07:00
committed by GitHub
parent ae9e36a155
commit d2b092dad5
7 changed files with 92 additions and 9 deletions
@@ -342,6 +342,67 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
GLOB.ghost_hud_panel.ui_interact(src)
/mob/dead/observer/verb/respawn_character()
set name = "Respawn as New Character"
set category = "Ghost"
var/mob/dead/observer/O = usr
if(!isobserver(O))
to_chat(O, "<span class='warning'>You are not dead!</span>")
return
if(!SSticker || SSticker.current_state < GAME_STATE_PLAYING)
to_chat(O, "<span class='warning'>You can't respawn before the game starts!</span>")
return
if(GAMEMODE_IS_WIZARD || GAMEMODE_IS_NUCLEAR || GAMEMODE_IS_RAGIN_MAGES)
to_chat(O, "<span class='warning'>You can't respawn for this gamemode.</span>")
return
var/death_time = world.time - O.timeofdeath
if(!HAS_TRAIT(O, TRAIT_RESPAWNABLE) && !check_rights(R_ADMIN, FALSE))
to_chat(O, "<span class='warning'>You don't have respawnability!</span>")
return
var/death_time_minutes = round(death_time / 600)
var/plural_check = "minutes"
if(death_time_minutes == 0)
plural_check = ""
else if(death_time_minutes == 1)
plural_check = "[death_time_minutes] minute and"
else if(death_time_minutes > 1)
plural_check = "[death_time_minutes] minutes and"
var/death_time_seconds = round((death_time - death_time_minutes * 600) / 10, 1)
if(death_time_minutes < GLOB.configuration.general.respawn_delay / 600 && !check_rights(R_ADMIN, FALSE))
to_chat(O, "<span class='notice'>You have been dead for [plural_check] [death_time_seconds] second\s.</span>")
to_chat(O, "<span class='warning'>You must wait [GLOB.configuration.general.respawn_delay / 600] minute\s before you can respawn.</span>")
return
if(!O.check_ahud_rejoin_eligibility())
to_chat(O, "<span class='warning'>Upon using the antagHUD you forfeited the ability to join the round.</span>")
return FALSE
if(tgui_alert(O, "Are you sure you want to respawn?\n(If you do this, you won't be able to be cloned!)", "Respawn?", list("Yes", "No")) != "Yes")
return
log_and_message_admins("[key_name(O)][O.mind?.current? (O.mind.current.mind.special_role? " (<font color='red'>[O.mind.current.mind.special_role]</font>)" : "") : ""] has chosen to respawn as a new character.")
var/list/warning = list()
warning.Add("<span class='big'>You have chosen to respawn as a new character!</span>")
warning.Add("<b>You will not remember anything from your previous life or time as a ghost.</b>")
warning.Add("<span class='boldwarning'>You MUST choose a different character slot to respawn as!</span>")
to_chat(O, chat_box_notice(warning.Join("<br>")))
if(!O.client)
log_game("[key_name(O)] respawn failed due to disconnect.")
return
var/mob/new_player/NP = new()
GLOB.non_respawnable_keys -= O.ckey
NP.ckey = O.ckey
qdel(O)
NP.chose_respawn = TRUE
/**
* Toggles on all HUDs for the ghost player.
*
+5 -1
View File
@@ -1,6 +1,8 @@
/mob/new_player
var/ready = FALSE
var/spawning = FALSE //Referenced when you want to delete the new_player later on in the code.
/// Has this player chosen to respawn as a new character?
var/chose_respawn = FALSE
universal_speak = TRUE
invisibility = 101
@@ -329,7 +331,9 @@
var/mob/living/character = create_character() //creates the human and transfers vars and mind
character = SSjobs.AssignRank(character, rank, TRUE) //equips the human
if(chose_respawn)
SSblackbox.record_feedback("tally", "player_respawn", 1, "[thisjob]")
log_and_message_admins("[character.ckey] has respawned as [character.real_name], \a [character.dna?.species ? character.dna.species : "Undefined species"] [rank].")
// AIs don't need a spawnpoint, they must spawn at an empty core
if(character.mind.assigned_role == "AI")
var/mob/living/silicon/ai/ai_character = character.AIize() // AIize the character, but don't move them yet