Merge pull request #8050 from VOREStation/Arokha/furtherghost

Redo respawning
This commit is contained in:
Aronai Sieyes
2020-05-25 11:37:51 -04:00
committed by GitHub
9 changed files with 121 additions and 56 deletions
+43 -33
View File
@@ -341,46 +341,56 @@
return
*/
/mob/proc/set_respawn_timer(var/time)
// Try to figure out what time to use
// Special cases, can never respawn
if(ticker?.mode?.deny_respawn)
time = -1
else if(!config.abandon_allowed)
time = -1
else if(!config.respawn)
time = -1
// Special case for observing before game start
else if(ticker?.current_state <= GAME_STATE_SETTING_UP)
time = 1 MINUTE
// Wasn't given a time, use the config time
else if(!time)
time = config.respawn_time
var/keytouse = ckey
// Try harder to find a key to use
if(!keytouse && key)
keytouse = ckey(key)
else if(!keytouse && mind?.key)
keytouse = ckey(mind.key)
GLOB.respawn_timers[keytouse] = world.time + time
/mob/observer/dead/set_respawn_timer()
if(config.antag_hud_restricted && has_enabled_antagHUD)
..(-1)
else
return // Don't set it, no need
/mob/verb/abandon_mob()
set name = "Respawn"
set name = "Return to Menu"
set category = "OOC"
if (!( config.abandon_allowed ))
to_chat(usr, "<span class='notice'>Respawn is disabled.</span>")
return
if ((stat != 2 || !( ticker )))
if(stat != DEAD || !ticker)
to_chat(usr, "<span class='notice'><B>You must be dead to use this!</B></span>")
return
if (ticker.mode && ticker.mode.deny_respawn) //BS12 EDIT
to_chat(usr, "<span class='notice'>Respawn is disabled for this roundtype.</span>")
return
else
var/deathtime = world.time - src.timeofdeath
if(istype(src,/mob/observer/dead))
var/mob/observer/dead/G = src
if(G.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
to_chat(usr, "<font color='blue'><B>By using the antagHUD you forfeit the ability to join the round.</B></font>")
return
var/deathtimeminutes = round(deathtime / 600)
var/pluralcheck = "minute"
if(deathtimeminutes == 0)
pluralcheck = ""
else if(deathtimeminutes == 1)
pluralcheck = " [deathtimeminutes] minute and"
else if(deathtimeminutes > 1)
pluralcheck = " [deathtimeminutes] minutes and"
var/deathtimeseconds = round((deathtime - deathtimeminutes * 600) / 10,1)
to_chat(usr, "You have been dead for[pluralcheck] [deathtimeseconds] seconds.")
if ((deathtime < (1 * 600)) && (ticker && ticker.current_state > GAME_STATE_PREGAME)) //VOREStation Edit: lower respawn timer
to_chat(usr, "You must wait 1 minute to respawn!")
// Final chance to abort "respawning"
if(mind && timeofdeath) // They had spawned before
var/choice = alert(usr, "Returning to the menu will prevent your character from being revived in-round. Are you sure?", "Confirmation", "No, wait", "Yes, leave")
if(choice == "No, wait")
return
else
to_chat(usr, "You can respawn now, enjoy your new life!")
log_game("[usr.name]/[usr.key] used abandon mob.")
to_chat(usr, "<font color='blue'><B>Make sure to play a different character, and please roleplay correctly!</B></font>")
// Beyond this point, you're going to respawn
to_chat(usr, config.respawn_message)
if(!client)
log_game("[usr.key] AM failed due to disconnect.")