diff --git a/code/_globalvars/lists/poll_ignore.dm b/code/_globalvars/lists/poll_ignore.dm index 8c791bce9b1..23db4f6ae6a 100644 --- a/code/_globalvars/lists/poll_ignore.dm +++ b/code/_globalvars/lists/poll_ignore.dm @@ -3,5 +3,6 @@ #define POLL_IGNORE_PAI "pai" #define POLL_IGNORE_SENTIENCE_POTION "sentience_potion" #define POLL_IGNORE_POSSESSED_BLADE "possessed_blade" +#define POLL_IGNORE_ALIEN_LARVA "alien_larva" -var/list/poll_ignore = list() \ No newline at end of file +var/list/poll_ignore = list() diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index f9484a898ed..9e30cde9efe 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -943,7 +943,6 @@ var/datum/subsystem/garbage_collector/SSgarbage SearchVar(GALOSHES_DONT_HELP) SearchVar(SLIDE_ICE) SearchVar(limb_icon_cache) - SearchVar(ALIEN_AFK_BRACKET) SearchVar(MIN_IMPREGNATION_TIME) SearchVar(MAX_IMPREGNATION_TIME) SearchVar(MIN_ACTIVE_TIME) diff --git a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm index d95ab3cfb65..b2597caf79c 100644 --- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm +++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm @@ -1,12 +1,11 @@ // This is to replace the previous datum/disease/alien_embryo for slightly improved handling and maintainability // It functions almost identically (see code/datums/diseases/alien_embryo.dm) -var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds - /obj/item/organ/body_egg/alien_embryo name = "alien embryo" icon = 'icons/mob/alien.dmi' icon_state = "larva0_dead" var/stage = 0 + var/bursting = FALSE /obj/item/organ/body_egg/alien_embryo/on_find(mob/living/finder) ..() @@ -53,8 +52,7 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds /obj/item/organ/body_egg/alien_embryo/egg_process() if(stage < 5 && prob(3)) stage++ - spawn(0) - RefreshInfectionImage() + INVOKE_ASYNC(src, .proc/RefreshInfectionImage) if(stage == 5 && prob(50)) for(var/datum/surgery/S in owner.surgeries) @@ -65,45 +63,53 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds -/obj/item/organ/body_egg/alien_embryo/proc/AttemptGrow(gib_on_success = 1) - if(!owner) return - var/list/candidates = get_candidates(ROLE_ALIEN, ALIEN_AFK_BRACKET, "alien candidate") - var/client/C = null - - // To stop clientless larva, we will check that our host has a client - // if we find no ghosts to become the alien. If the host has a client - // he will become the alien but if he doesn't then we will set the stage - // to 4, so we don't do a process heavy check everytime. - - if(candidates.len) - C = pick(candidates) - else if(owner.client && !(jobban_isbanned(owner, "alien candidate") || jobban_isbanned(owner, "Syndicate"))) - C = owner.client - else - stage = 4 // Let's try again later. +/obj/item/organ/body_egg/alien_embryo/proc/AttemptGrow(gib_on_success=TRUE) + if(!owner || bursting) return + bursting = TRUE + + var/list/candidates = pollCandidates("Do you want to play as an alien larva that will burst out of [owner]?", ROLE_ALIEN, null, ROLE_ALIEN, 100, POLL_IGNORE_ALIEN_LARVA) + + if(QDELETED(src) || QDELETED(owner)) + return + + if(!candidates.len || !owner) + bursting = FALSE + stage = 4 + return + + var/mob/dead/observer/ghost = pick(candidates) + var/overlay = image('icons/mob/alien.dmi', loc = owner, icon_state = "burst_lie") owner.add_overlay(overlay) var/atom/xeno_loc = get_turf(owner) var/mob/living/carbon/alien/larva/new_xeno = new(xeno_loc) - new_xeno.key = C.key + new_xeno.key = ghost.key new_xeno << sound('sound/voice/hiss5.ogg',0,0,0,100) //To get the player's attention new_xeno.canmove = 0 //so we don't move during the bursting animation new_xeno.notransform = 1 new_xeno.invisibility = INVISIBILITY_MAXIMUM - spawn(6) - if(new_xeno) - new_xeno.canmove = 1 - new_xeno.notransform = 0 - new_xeno.invisibility = 0 - if(gib_on_success) - owner.gib(TRUE) - else - owner.adjustBruteLoss(40) - owner.cut_overlay(overlay) - qdel(src) + + sleep(6) + + if(QDELETED(src) || QDELETED(owner)) + return + + if(new_xeno) + new_xeno.canmove = 1 + new_xeno.notransform = 0 + new_xeno.invisibility = 0 + + if(gib_on_success) + new_xeno.visible_message("[new_xeno] bursts out of [owner] in a shower of gore!", "You exit [owner], your previous host.", "You hear organic matter ripping and tearing!") + owner.gib(TRUE) + else + new_xeno.visible_message("[new_xeno] wriggles out of [owner]!", "You exit [owner], your previous host.") + owner.adjustBruteLoss(40) + owner.cut_overlay(overlay) + qdel(src) /*----------------------------------------