Skip to content

Commit

Permalink
initial_commit (#13978)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barnet2 authored Sep 20, 2023
1 parent 8dc43b0 commit 185e6cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
if(!. || can_reenter_corpse || aghosting)
return
var/mob/ghost = .
if(tier != XENO_TIER_MINION)
if(tier != XENO_TIER_MINION && hivenumber == XENO_HIVE_NORMAL)
GLOB.key_to_time_of_xeno_death[ghost.key] = world.time //If you ghost as a xeno that is not a minion, sets respawn timer


Expand Down
21 changes: 9 additions & 12 deletions code/modules/mob/living/carbon/xenomorph/hive_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -933,16 +933,6 @@ to_chat will check for valid clients itself already so no need to double check f
if((xeno_job.total_positions - xeno_job.current_positions) < 0)
return FALSE

if(XENODEATHTIME_CHECK(xeno_candidate))
if(!check_other_rights(xeno_candidate.client, R_ADMIN, FALSE))
XENODEATHTIME_MESSAGE(xeno_candidate)
return FALSE
if(tgui_alert(xeno_candidate, "You wouldn't normally qualify for this respawn. Are you sure you want to bypass it with your admin powers?", "Bypass Respawn", list("Yes", "No")) != "Yes")
XENODEATHTIME_MESSAGE(xeno_candidate)
return FALSE
log_admin("[key_name(xeno_candidate)] used his admin power to bypass respawn before his timer was over")
message_admins("[key_name(xeno_candidate)] used his admin power to bypass respawn before his timer was over")

var/list/possible_mothers = list()
var/list/possible_silos = list()
SEND_SIGNAL(src, COMSIG_HIVE_XENO_MOTHER_PRE_CHECK, possible_mothers, possible_silos) //List variable passed by reference, and hopefully populated.
Expand Down Expand Up @@ -1096,7 +1086,7 @@ to_chat will check for valid clients itself already so no need to double check f
var/list/possible_mothers = list()
var/list/possible_silos = list()
SEND_SIGNAL(src, COMSIG_HIVE_XENO_MOTHER_PRE_CHECK, possible_mothers, possible_silos)
if(stored_larva > 0 && !LAZYLEN(candidate) && (length(possible_mothers) || length(possible_silos) || (SSticker.mode?.flags_round_type & MODE_SILO_RESPAWN && SSmonitor.gamestate == SHUTTERS_CLOSED)))
if(stored_larva > 0 && !LAZYLEN(candidate) && !XENODEATHTIME_CHECK(observer) && (length(possible_mothers) || length(possible_silos) || (SSticker.mode?.flags_round_type & MODE_SILO_RESPAWN && SSmonitor.gamestate == SHUTTERS_CLOSED)))
attempt_to_spawn_larva(observer)
return
if(LAZYFIND(candidate, observer))
Expand All @@ -1105,7 +1095,8 @@ to_chat will check for valid clients itself already so no need to double check f
LAZYADD(candidate, observer)
RegisterSignal(observer, COMSIG_QDELETING, PROC_REF(clean_observer))
observer.larva_position = LAZYLEN(candidate)
to_chat(observer, span_warning("There are no burrowed Larvae or no silos. You are in position [observer.larva_position] to become a Xenomorph."))
to_chat(observer, span_warning("There are either no burrowed larva, you are on your xeno respawn timer, or there are no silos. You are in position [observer.larva_position] to become a Xenomorph."))
give_larva_to_next_in_queue() //Updates the queue for xeno respawn timer
return TRUE

/// Remove an observer from the larva candidate queue
Expand Down Expand Up @@ -1137,14 +1128,20 @@ to_chat will check for valid clients itself already so no need to double check f
if(!xeno_job.occupy_job_positions(slot_occupied))
return
var/mob/dead/observer/observer_in_queue
var/oldest_death = 0
while(stored_larva > 0 && LAZYLEN(candidate))
for(var/i in 1 to LAZYLEN(candidate))
observer_in_queue = LAZYACCESS(candidate, i)
if(!XENODEATHTIME_CHECK(observer_in_queue))
break
var/candidate_death_time = (GLOB.key_to_time_of_xeno_death[observer_in_queue.key] + SSticker.mode?.xenorespawn_time) - world.time
if(oldest_death > candidate_death_time || !oldest_death)
oldest_death = candidate_death_time
observer_in_queue = null //Deathtimer still running

if(!observer_in_queue) //No valid candidates in the queue
if(oldest_death)
addtimer(CALLBACK(src, PROC_REF(give_larva_to_next_in_queue)), oldest_death + 1 SECONDS) //Will update the queue once timer is up, spawning them in if there is a burrowed
break

LAZYREMOVE(candidate, observer_in_queue)
Expand Down

0 comments on commit 185e6cd

Please sign in to comment.