From 29d54c2ab1d129b517dba2675e72d3d9d80b1a0f Mon Sep 17 00:00:00 2001 From: DrCelt Date: Sun, 18 Dec 2016 08:39:35 -0800 Subject: [PATCH] Fixes #6968, Spawn Alien Larva adminbus event now actually works (#12819) --- code/game/gamemodes/events.dm | 35 +++++++++++-------- code/modules/admin/topic.dm | 5 +-- code/modules/admin/verbs/one_click_antag.dm | 7 ++-- code/modules/events/alien_infestation.dm | 3 +- .../mob/living/carbon/alien/larva/larva.dm | 8 ++++- 5 files changed, 35 insertions(+), 23 deletions(-) diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index 17493db4112b..62f165296278 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -184,31 +184,36 @@ //command_alert("Unidentified lifesigns detected coming aboard [station_name()]. Secure any exterior access, including ducting and ventilation.", "Lifesign Alert") // world << sound('sound/AI/aliens.ogg') var/list/vents = list() + var/success = FALSE for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in atmos_machines) if(temp_vent.loc.z == map.zMainStation && !temp_vent.welded && temp_vent.network && temp_vent.canSpawnMice) if(temp_vent.network.normal_members.len > 50) // Stops Aliens getting stuck in small networks. See: Security, Virology vents += temp_vent - var/list/candidates = get_active_candidates(ROLE_ALIEN,buffer=ALIEN_SELECT_AFK_BUFFER, poll=1) + var/list/mob/dead/observer/candidates = get_active_candidates(ROLE_ALIEN, buffer=ALIEN_SELECT_AFK_BUFFER, poll="HEY KID, YOU WANNA BE AN ALIEN LARVA?") - if(prob(40)) - spawncount++ //sometimes, have two larvae spawn instead of one - while((spawncount >= 1) && vents.len && candidates.len) + if(candidates.len) + shuffle(candidates) + if(prob(40)) + spawncount++ //sometimes, have two larvae spawn instead of one + while((spawncount >= 1) && vents.len && candidates.len) + var/obj/vent = pick(vents) + var/mob/dead/observer/candidate = pick(candidates) - var/obj/vent = pick(vents) - var/candidate = pick(candidates) + if(istype(candidate) && candidate.client && candidate.key) + var/mob/living/carbon/alien/larva/new_xeno = new(vent.loc) + new_xeno.transfer_personality(candidate.client) + success = TRUE - var/mob/living/carbon/alien/larva/new_xeno = new(vent.loc) - new_xeno.key = candidate - new_xeno << sound('sound/voice/alienspawn.ogg') + candidates -= candidate + vents -= vent + spawncount-- - candidates -= candidate - vents -= vent - spawncount-- - - spawn(rand(5000, 6000)) //Delayed announcements to keep the crew on their toes. - command_alert(/datum/command_alert/xenomorphs) + if(success) + spawn(rand(5000, 6000)) //Delayed announcements to keep the crew on their toes. + command_alert(/datum/command_alert/xenomorphs) + return success /proc/high_radiation_event() diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index a204a3720f43..5a0acf7d4d54 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -39,11 +39,12 @@ to_chat(usr, "Unfortunately there weren't enough candidates available.") if("9") log_admin("[key_name(usr)] has spawned aliens.") - src.makeAliens() + if(!src.makeAliens()) + to_chat(usr, "Unfortunately, there were no candidates available.") if("10") log_admin("[key_name(usr)] has spawned a death squad.") if(!makeDeathsquad()) - to_chat(usr, "Unfortunately, there were no candidates available") + to_chat(usr, "Unfortunately, there were no candidates available.") if("11") log_admin("[key_name(usr)] has spawned vox raiders.") if(!src.makeVoxRaiders()) diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index 507134bb9877..2238eea82a05 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -294,11 +294,10 @@ client/proc/one_click_antag() +/datum/admins/proc/makeAliens() + return alien_infestation(3) -/datum/admins/proc/makeAliens() - alien_infestation(3) - return 1 /datum/admins/proc/makeDeathsquad() var/list/mob/dead/observer/candidates = list() var/mob/dead/observer/theghost = null @@ -475,4 +474,4 @@ client/proc/one_click_antag() ticker.mode.traitors += new_vox.mind new_vox.equip_vox_raider() - return new_vox \ No newline at end of file + return new_vox diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index 2f7418297cc9..d7d52027f621 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -26,7 +26,7 @@ if(temp_vent.network.normal_members.len > 50) //Stops Aliens getting stuck in small networks. See: Security, Virology vents += temp_vent - var/list/candidates = get_active_candidates(ROLE_ALIEN, buffer=ALIEN_SELECT_AFK_BUFFER, poll=1) + var/list/candidates = get_active_candidates(ROLE_ALIEN, buffer=ALIEN_SELECT_AFK_BUFFER, poll="HEY KID, YOU WANNA BE AN ALIEN LARVA?") while(spawncount > 0 && vents.len && candidates.len) var/obj/vent = pick(vents) @@ -40,3 +40,4 @@ vents -= vent spawncount-- successSpawn = 1 + return successSpawn diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 212b0fe78264..f374149dfc77 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -299,4 +299,10 @@ /mob/living/carbon/alien/larva/reset_layer() if(stat == DEAD) - plane = MOB_PLANE \ No newline at end of file + plane = MOB_PLANE + +/mob/living/carbon/alien/larva/proc/transfer_personality(var/client/candidate) + ckey = candidate.ckey + src << sound('sound/voice/alienspawn.ogg') + if(src.mind) + src.mind.assigned_role = "Alien"