From e87cc2780333c3c5c7fb275db53192ac2ed6ada4 Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Tue, 15 Dec 2020 07:21:06 -0700
Subject: [PATCH] modifications
---
code/controllers/configuration/entries/respawns.dm | 5 +++++
code/game/machinery/cryopod.dm | 2 +-
code/modules/admin/topic.dm | 7 +++++--
code/modules/client/preferences.dm | 2 ++
code/modules/mob/dead/observer/observer.dm | 3 ++-
code/modules/mob/dead/observer/respawn.dm | 13 ++++++++++---
config/respawns.txt | 3 +++
7 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/code/controllers/configuration/entries/respawns.dm b/code/controllers/configuration/entries/respawns.dm
index b19c8bf9d8..d92f4ec394 100644
--- a/code/controllers/configuration/entries/respawns.dm
+++ b/code/controllers/configuration/entries/respawns.dm
@@ -7,6 +7,11 @@
config_entry_value = 15.0
integer = FALSE
+/// Minutes before allowing respawn, if user cryo'd.
+/datum/config_entry/number/respawn_delay_cryo
+ config_entry_value = 5.0
+ integer = FALSE
+
/// Allows respawning as non-assistant. Overrides all others of this type.
/datum/config_entry/flag/allow_non_assistant_respawn
config_entry_value = FALSE
diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm
index c9c555e331..31ae77848f 100644
--- a/code/game/machinery/cryopod.dm
+++ b/code/game/machinery/cryopod.dm
@@ -383,7 +383,7 @@
// Ghost and delete the mob.
if(!mob_occupant.get_ghost(1))
- mob_occupant.ghostize(FALSE, penalize = TRUE, voluntary = TRUE)
+ mob_occupant.ghostize(FALSE, penalize = TRUE, voluntary = TRUE, cryo = TRUE)
QDEL_NULL(occupant)
QDEL_LIST(destroy_later)
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index fd8204a296..e0434a6fea 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -1805,12 +1805,15 @@
if(alert(usr, "Send [key_name(M)] back to Lobby?", "Message", "Yes", "No") != "Yes")
return
- log_admin("[key_name(usr)] has sent [key_name(M)] back to the Lobby.")
- message_admins("[key_name(usr)] has sent [key_name(M)] back to the Lobby.")
+ log_admin("[key_name(usr)] has sent [key_name(M)] back to the Lobby, removing their respawn restrictions if they existed.")
+ message_admins("[key_name(usr)] has sent [key_name(M)] back to the Lobby, removing their respawn restrictions if they existed.")
var/mob/dead/new_player/NP = new()
NP.ckey = M.ckey
qdel(M)
+ if(GLOB.preferences_datums[NP.ckey])
+ var/datum/preferences/P = GLOB.preferences_datums[NP.ckey]
+ P.respawn_restrictions_active = FALSE
else if(href_list["tdome1"])
if(!check_rights(R_FUN))
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index a634810dbf..e97f6dc3f4 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -31,6 +31,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/respawn_time_of_death = -INFINITY
/// did they DNR? used to prevent respawns.
var/dnr_triggered = FALSE
+ /// did they cryo on their last ghost?
+ var/respawn_did_cryo = FALSE
// Intra-round persistence end
diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm
index 800f704ab6..9493d11792 100644
--- a/code/modules/mob/dead/observer/observer.dm
+++ b/code/modules/mob/dead/observer/observer.dm
@@ -264,7 +264,7 @@ Transfer_mind is there to check if mob is being deleted/not going to have a body
Works together with spawning an observer, noted above.
*/
-/mob/proc/ghostize(can_reenter_corpse = TRUE, special = FALSE, penalize = FALSE, voluntary = FALSE)
+/mob/proc/ghostize(can_reenter_corpse = TRUE, special = FALSE, penalize = FALSE, voluntary = FALSE, cryo = FALSE)
var/sig_flags = SEND_SIGNAL(src, COMSIG_MOB_GHOSTIZE, can_reenter_corpse, special, penalize)
penalize = !(sig_flags & COMPONENT_DO_NOT_PENALIZE_GHOSTING) && (suiciding || penalize) // suicide squad.
voluntary_ghosted = voluntary
@@ -282,6 +282,7 @@ Works together with spawning an observer, noted above.
if(P)
P.respawn_restrictions_active = TRUE
P.respawn_time_of_death = world.time
+ P.respawn_did_cryo = cryo
transfer_ckey(ghost, FALSE)
ghost.client.init_verbs()
if(penalize)
diff --git a/code/modules/mob/dead/observer/respawn.dm b/code/modules/mob/dead/observer/respawn.dm
index e2a85d11d8..53c6eef4c9 100644
--- a/code/modules/mob/dead/observer/respawn.dm
+++ b/code/modules/mob/dead/observer/respawn.dm
@@ -18,7 +18,10 @@
if(!I.client || !I.client.prefs.respawn_restrictions_active)
continue
valid["[I.ckey] - IN LOBBY"] = I.ckey
- var/ckey = valid[input(src, "Choose a player (only showing logged in players who have restrictions)", "Unrestricted Respawn") as null|anything in valid]
+ if(!valid.len)
+ to_chat(src, "No player found that is either a ghost or is in lobby with restrictions active.")
+ return
+ var/ckey = valid[input(src, "Choose a player (only showing logged in players who have restrictions)", "Unrestricted Respawn") as null|anything in valid
var/client/player = GLOB.directory[ckey]
if(!player)
to_chat(src, "Client not found.")
@@ -60,7 +63,11 @@
if(!I.client)
continue
valid["[I.ckey] - [I.name]"] = I
- var/mob/dead/observer/O = valid[input(src, "Choose a player (only showing logged in)", "Remove Respawn Timer") as null|anything in valid]
+
+ if(!valid.len)
+ to_chat(src, "No logged in ghosts found.")
+ return
+ var/mob/dead/observer/O = valid[input(src, "Choose a player (only showing logged in)", "Remove Respawn Timer") as null|anything in valid
if(!O.client)
to_chat(src, "[O] has no client.")
@@ -126,7 +133,7 @@
*/
/mob/dead/observer/verb/time_left_to_respawn()
ASSERT(client)
- return max(0, (CONFIG_GET(number/respawn_delay) MINUTES + client.prefs.respawn_time_of_death) - world.time)
+ return max(0, ((client.prefs.respawn_did_cryo? CONFIG_GET(number/respawn_delay_cryo) : CONFIG_GET(number/respawn_delay)) MINUTES + client.prefs.respawn_time_of_death) - world.time)
/**
* Handles respawning
diff --git a/config/respawns.txt b/config/respawns.txt
index 79eb53469c..46a4bb0e07 100644
--- a/config/respawns.txt
+++ b/config/respawns.txt
@@ -4,6 +4,9 @@ RESPAWNS_ENABLED
## Minutes delay before allowing respawns, either from death or observing. Not an integer.
RESPAWN_DELAY 15.0
+## Minutes delay before allowing respawns, if the user cryo'd. Not an integer.
+RESPAWN_DELAY_CRYO 5.0
+
## Allow respawning as anything but an assistant.
ALLOW_NON_ASSISTANT_RESPAWN