Additional respawn refactoring.

Removes a non-utilized config setting.
Adds a config setting to set the respawn timer, defaults to 30 minutes as today.
Makes the MayRespawn() proc utilize this config setting. Makes more uses of MayRespawn() check the respawn delay.
This commit is contained in:
PsiOmegaDelta
2015-11-08 20:05:37 +01:00
parent 4ab55646a6
commit 6f559779b5
7 changed files with 24 additions and 58 deletions
+3 -3
View File
@@ -59,7 +59,7 @@ var/list/gamemode_cache = list()
var/allow_random_events = 0 // enables random events mid-round when set to 1
var/allow_ai = 1 // allow ai job
var/hostedby = null
var/respawn = 1
var/respawn_delay = 30
var/guest_jobban = 1
var/usewhitelist = 0
var/kick_inactive = 0 //force disconnect for inactive players after this many minutes, if non-0
@@ -379,8 +379,8 @@ var/list/gamemode_cache = list()
// if ("authentication")
// config.enable_authentication = 1
if ("norespawn")
config.respawn = 0
if ("respawn_delay")
config.respawn_delay = text2num(value)
if ("servername")
config.server_name = value
-2
View File
@@ -50,8 +50,6 @@ var/list/lastsignalers = list() // Keeps last 100 signals here in format: "[src]
var/list/lawchanges = list() // Stores who uploaded laws to which silicon-based lifeform, and what the law was.
var/list/reg_dna = list()
var/mouse_respawn_time = 5 // Amount of time that must pass between a player dying as a mouse and repawning as a mouse. In minutes.
var/list/monkeystart = list()
var/list/wizardstart = list()
var/list/newplayer_start = list()
+2 -2
View File
@@ -16,6 +16,7 @@ proc/populate_ghost_traps()
/datum/ghosttrap
var/object = "positronic brain"
var/minutes_since_death = 0 // If non-zero the ghost must have been dead for this many minutes to be allowed to spawn
var/list/ban_checks = list("AI","Cyborg")
var/pref_check = BE_AI
var/ghost_trap_message = "They are occupying a positronic brain now."
@@ -25,8 +26,7 @@ proc/populate_ghost_traps()
/datum/ghosttrap/proc/assess_candidate(var/mob/dead/observer/candidate)
if(!istype(candidate) || !candidate.client || !candidate.ckey)
return 0
if(!candidate.MayRespawn())
candidate << "You have made use of the AntagHUD and hence cannot enter play as \a [object]."
if(!candidate.MayRespawn(1, minutes_since_death))
return 0
if(islist(ban_checks))
for(var/bantype in ban_checks)
+9 -9
View File
@@ -462,7 +462,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
src << "<span class='warning'>Spawning as a mouse is currently disabled.</span>"
return
if(!MayRespawn(1))
if(!MayRespawn(1, round(config.respawn_delay / 6)))
return
var/turf/T = get_turf(src)
@@ -470,13 +470,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
src << "<span class='warning'>You may not spawn as a mouse on this Z-level.</span>"
return
var/timedifference = world.time - timeofdeath
if(timeofdeath && timedifference <= mouse_respawn_time * 600)
var/timedifference_text
timedifference_text = time2text(mouse_respawn_time * 600 - timedifference,"mm:ss")
src << "<span class='warning'>You may only spawn again as a mouse more than [mouse_respawn_time] minutes after your death. You have [timedifference_text] left.</span>"
return
var/response = alert(src, "Are you -sure- you want to become a mouse?","Are you sure you want to squeek?","Squeek!","Nope!")
if(response != "Squeek!") return //Hit the wrong key...again.
@@ -710,7 +703,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if (ghostimage)
client.images -= ghostimage //remove ourself
mob/dead/observer/MayRespawn(var/feedback = 0)
mob/dead/observer/MayRespawn(var/feedback = 0, var/respawn_time = 0)
if(!client)
return 0
if(mind && mind.current && mind.current.stat != DEAD && can_reenter_corpse)
@@ -721,6 +714,13 @@ mob/dead/observer/MayRespawn(var/feedback = 0)
if(feedback)
src << "<span class='warning'>antagHUD restrictions prevent you from respawning.</span>"
return 0
var/timedifference = world.time - timeofdeath
if(respawn_time && timeofdeath && timedifference < respawn_time MINUTES)
var/timedifference_text = time2text(respawn_time MINUTES - timedifference,"mm:ss")
src << "<span class='warning'>You must have been dead for [respawn_time] minute\s to respawn. You have [timedifference_text] left.</span>"
return 0
return 1
/atom/proc/extra_ghost_link()
@@ -109,23 +109,7 @@
usr << "<span class='danger'>You are banned from playing synthetics and cannot spawn as a drone.</span>"
return
if(!MayRespawn(1))
return
var/deathtime = world.time - src.timeofdeath
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)
if (deathtime < 6000)
usr << "You have been dead for[pluralcheck] [deathtimeseconds] seconds."
usr << "You must wait 10 minutes to respawn as a drone!"
if(!MayRespawn(1, round(config.respawn_delay / 3)))
return
var/list/all_fabricators = list()
+5 -24
View File
@@ -359,39 +359,20 @@
if (!( config.abandon_allowed ))
usr << "<span class='notice'>Respawn is disabled.</span>"
return
if ((stat != 2 || !( ticker )))
if ((stat != DEAD || !( ticker )))
usr << "<span class='notice'><B>You must be dead to use this!</B></span>"
return
if (ticker.mode.deny_respawn) //BS12 EDIT
usr << "<span class='notice'>Respawn is disabled for this roundtype.</span>"
return
else
var/deathtime = world.time - src.timeofdeath
if(istype(src,/mob/dead/observer))
var/mob/dead/observer/G = src
if(G.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
usr << "\blue <B>Upon using the antagHUD you forfeighted the ability to join the round.</B>"
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)
usr << "You have been dead for[pluralcheck] [deathtimeseconds] seconds."
else if(!MayRespawn(1, config.respawn_delay))
return
if (deathtime < 18000)
usr << "You must wait 30 minutes to respawn!"
return
else
usr << "You can respawn now, enjoy your new life!"
usr << "You can respawn now, enjoy your new life!"
log_game("[usr.name]/[usr.key] used abandon mob.")
usr << "\blue <B>Make sure to play a different character, and please roleplay correctly!</B>"
usr << "<span class='notice'><B>Make sure to play a different character, and please roleplay correctly!</B></span>"
if(!client)
log_game("[usr.key] AM failed due to disconnect.")
+4 -1
View File
@@ -348,7 +348,10 @@ EVENT_CUSTOM_START_MAJOR 80;100
## Uncomment to disable respawning by default.
#DISABLE_RESPAWN
## Strength of ambient star light. Set to 0 or less to turn off. A value of 1 is unlikely to have a noticeable effect in most lightning systems.
## Respawn delay in minutes before one may respawn as a crew member.
#RESPAWN_DELAY 30
## Strength of ambient star light. Set to 0 or less to turn off. A value of 1 is unlikely to have a noticeable effect in most lighting systems.
STARLIGHT 0
## Defines which races are allowed to join as ERT, in singular form. If unset, defaults to only human. Casing matters, separate using ;