mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-24 21:57:53 +01:00
Merge pull request #8050 from VOREStation/Arokha/furtherghost
Redo respawning
This commit is contained in:
@@ -229,6 +229,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
var/mob/observer/dead/ghost = ghostize(0) // 0 parameter is so we can never re-enter our body, "Charlie, you can never come baaaack~" :3
|
||||
if(ghost)
|
||||
ghost.timeofdeath = world.time // Because the living mob won't have a time of death and we want the respawn timer to work properly.
|
||||
ghost.set_respawn_timer()
|
||||
announce_ghost_joinleave(ghost)
|
||||
|
||||
/mob/observer/dead/can_use_hands() return 0
|
||||
@@ -304,6 +305,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
var/response = alert(src, "If you turn this on, you will not be able to take any part in the round.","Are you sure you want to turn this feature on?","Yes","No")
|
||||
if(response == "No") return
|
||||
can_reenter_corpse = FALSE
|
||||
set_respawn_timer(-1) // Foreeeever
|
||||
if(!has_enabled_antagHUD && !client.holder)
|
||||
has_enabled_antagHUD = TRUE
|
||||
|
||||
|
||||
@@ -100,7 +100,8 @@
|
||||
if(mind) mind.store_memory("Time of death: [stationtime2text()]", 0)
|
||||
living_mob_list -= src
|
||||
dead_mob_list |= src
|
||||
|
||||
|
||||
set_respawn_timer()
|
||||
updateicon()
|
||||
handle_regular_hud_updates()
|
||||
handle_vision()
|
||||
|
||||
@@ -29,4 +29,5 @@ var/global/list/empty_playable_ai_cores = list()
|
||||
global_announcer.autosay("[src] has been moved to intelligence storage.", "Artificial Intelligence Oversight")
|
||||
|
||||
//Handle job slot/tater cleanup.
|
||||
set_respawn_timer()
|
||||
clear_client()
|
||||
+43
-33
@@ -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.")
|
||||
|
||||
@@ -120,8 +120,9 @@
|
||||
new_player_panel_proc()
|
||||
|
||||
if(href_list["observe"])
|
||||
var/alert_time = ticker?.current_state <= GAME_STATE_SETTING_UP ? 1 : round(config.respawn_time/10/60)
|
||||
|
||||
if(alert(src,"Are you sure you wish to observe? You will have to wait 60 seconds before being able to respawn!","Player Setup","Yes","No") == "Yes") //Vorestation edit - Rykka corrected to 60 seconds to match current spawn time
|
||||
if(alert(src,"Are you sure you wish to observe? You will have to wait up to [alert_time] minute\s before being able to spawn into the game!","Player Setup","Yes","No") == "Yes")
|
||||
if(!client) return 1
|
||||
|
||||
//Make a new mannequin quickly, and allow the observer to take the appearance
|
||||
@@ -143,7 +144,6 @@
|
||||
observer.forceMove(O.loc)
|
||||
else
|
||||
to_chat(src, "<span class='danger'>Could not locate an observer spawn point. Use the Teleport verb to jump to the station map.</span>")
|
||||
observer.timeofdeath = world.time // Set the time of death so that the respawn timer works correctly.
|
||||
|
||||
announce_ghost_joinleave(src)
|
||||
|
||||
@@ -154,6 +154,7 @@
|
||||
if(!client.holder && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed.
|
||||
observer.verbs -= /mob/observer/dead/verb/toggle_antagHUD // Poor guys, don't know what they are missing!
|
||||
observer.key = key
|
||||
observer.set_respawn_timer(time_till_respawn()) // Will keep their existing time if any, or return 0 and pass 0 into set_respawn_timer which will use the defaults
|
||||
qdel(src)
|
||||
|
||||
return 1
|
||||
@@ -163,6 +164,13 @@
|
||||
if(!ticker || ticker.current_state != GAME_STATE_PLAYING)
|
||||
to_chat(usr, "<font color='red'>The round is either not ready, or has already finished...</font>")
|
||||
return
|
||||
|
||||
var/time_till_respawn = time_till_respawn()
|
||||
if(time_till_respawn == -1) // Special case, never allowed to respawn
|
||||
to_chat(usr, "<span class='warning'>Respawning is not allowed!</span>")
|
||||
else if(time_till_respawn) // Nonzero time to respawn
|
||||
to_chat(usr, "<span class='warning'>You can't respawn yet! You need to wait another [round(time_till_respawn/10/60, 0.1)] minutes.</span>")
|
||||
return
|
||||
/*
|
||||
if(client.prefs.species != "Human" && !check_rights(R_ADMIN, 0)) //VORESTATION EDITS: THE COMMENTED OUT AREAS FROM LINE 154 TO 178
|
||||
if (config.usealienwhitelist)
|
||||
@@ -341,6 +349,23 @@
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/mob/new_player/proc/time_till_respawn()
|
||||
if(!ckey)
|
||||
return -1 // What?
|
||||
|
||||
var/timer = GLOB.respawn_timers[ckey]
|
||||
// No timer at all
|
||||
if(!timer)
|
||||
return 0
|
||||
// Special case, infinite timer
|
||||
if(timer == -1)
|
||||
return -1
|
||||
// Timer expired
|
||||
if(timer <= world.time)
|
||||
GLOB.respawn_timers -= ckey
|
||||
return 0
|
||||
// Timer still going
|
||||
return timer - world.time
|
||||
|
||||
/mob/new_player/proc/IsJobAvailable(rank)
|
||||
var/datum/job/job = job_master.GetJob(rank)
|
||||
|
||||
Reference in New Issue
Block a user