139 lines
5.0 KiB
Plaintext
139 lines
5.0 KiB
Plaintext
// 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)
|
|
/obj/item/organ/body_egg/alien_embryo
|
|
name = "alien embryo"
|
|
icon = 'icons/mob/alien.dmi'
|
|
icon_state = "larva0_dead"
|
|
food_reagents = list(/datum/reagent/consumable/nutriment = 5, /datum/reagent/toxin/acid = 10)
|
|
var/stage = 0
|
|
var/bursting = FALSE
|
|
|
|
/obj/item/organ/body_egg/alien_embryo/on_find(mob/living/finder)
|
|
..()
|
|
if(stage < 4)
|
|
to_chat(finder, "It's small and weak, barely the size of a foetus.")
|
|
else
|
|
to_chat(finder, "It's grown quite large, and writhes slightly as you look at it.")
|
|
if(prob(10))
|
|
AttemptGrow(0)
|
|
|
|
/obj/item/organ/body_egg/alien_embryo/on_life()
|
|
. = ..()
|
|
if(!owner)
|
|
return
|
|
switch(stage)
|
|
if(2, 3)
|
|
if(prob(2))
|
|
owner.emote("sneeze")
|
|
if(prob(2))
|
|
owner.emote("cough")
|
|
if(prob(2))
|
|
to_chat(owner, "<span class='danger'>Your throat feels sore.</span>")
|
|
if(prob(2))
|
|
to_chat(owner, "<span class='danger'>Mucous runs down the back of your throat.</span>")
|
|
if(4)
|
|
if(prob(2))
|
|
owner.emote("sneeze")
|
|
if(prob(2))
|
|
owner.emote("cough")
|
|
if(prob(4))
|
|
to_chat(owner, "<span class='danger'>Your muscles ache.</span>")
|
|
if(prob(20))
|
|
owner.take_bodypart_damage(1)
|
|
if(prob(4))
|
|
to_chat(owner, "<span class='danger'>Your stomach hurts.</span>")
|
|
if(prob(20))
|
|
owner.adjustToxLoss(1)
|
|
if(5)
|
|
to_chat(owner, "<span class='danger'>You feel something tearing its way out of your stomach...</span>")
|
|
owner.adjustToxLoss(10)
|
|
|
|
/obj/item/organ/body_egg/alien_embryo/egg_process()
|
|
if(stage < 5 && prob(3))
|
|
stage++
|
|
INVOKE_ASYNC(src, PROC_REF(RefreshInfectionImage))
|
|
|
|
if(stage == 5 && prob(50))
|
|
for(var/datum/surgery/S in owner.surgeries)
|
|
if(S.location == BODY_ZONE_CHEST && istype(S.get_surgery_step(), /datum/surgery_step/manipulate_organs))
|
|
AttemptGrow(0)
|
|
return
|
|
AttemptGrow()
|
|
|
|
|
|
|
|
/obj/item/organ/body_egg/alien_embryo/proc/AttemptGrow(var/kill_on_sucess=TRUE)
|
|
if(!owner || bursting)
|
|
return
|
|
|
|
bursting = TRUE
|
|
|
|
var/list/candidates = pollGhostCandidates("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/mutable_appearance/overlay = mutable_appearance('icons/mob/alien.dmi', "burst_lie")
|
|
owner.add_overlay(overlay)
|
|
|
|
var/atom/xeno_loc = get_turf(owner)
|
|
var/mob/living/carbon/alien/larva/new_xeno = new(xeno_loc)
|
|
ghost.transfer_ckey(new_xeno, FALSE)
|
|
SEND_SOUND(new_xeno, sound('sound/voice/hiss5.ogg',0,0,0,100)) //To get the player's attention
|
|
new_xeno.Paralyze(6)
|
|
new_xeno.mob_transforming = TRUE
|
|
new_xeno.invisibility = INVISIBILITY_MAXIMUM
|
|
|
|
sleep(6)
|
|
|
|
if(QDELETED(src) || QDELETED(owner))
|
|
return
|
|
|
|
if(new_xeno)
|
|
new_xeno.SetParalyzed(0)
|
|
new_xeno.mob_transforming = FALSE
|
|
new_xeno.invisibility = 0
|
|
|
|
var/mob/living/carbon/old_owner = owner
|
|
if(kill_on_sucess) //ITS TOO LATE
|
|
new_xeno.visible_message("<span class='danger'>[new_xeno] bursts out of [owner]!</span>", "<span class='userdanger'>You exit [owner], your previous host.</span>", "<span class='italics'>You hear organic matter ripping and tearing!</span>")
|
|
owner.apply_damage(rand(100,300),BRUTE,zone,FALSE) //Random high damage to torso so health sensors don't metagame.
|
|
var/obj/item/bodypart/B = owner.get_bodypart(zone)
|
|
B.drop_organs(owner) //Lets still make the death gruesome and impossible to just simply defib someone.
|
|
owner.death(FALSE) //Just in case some freak occurance occurs where you somehow survive all your organs being removed from you and the 100-300 brute damage.
|
|
else //When it is removed via surgery at a late stage, rather than forced.
|
|
new_xeno.visible_message("<span class='danger'>[new_xeno] wriggles out of [owner]!</span>", "<span class='userdanger'>You exit [owner], your previous host.</span>")
|
|
owner.adjustBruteLoss(40)
|
|
old_owner.cut_overlay(overlay)
|
|
qdel(src)
|
|
|
|
|
|
/*----------------------------------------
|
|
Proc: AddInfectionImages(C)
|
|
Des: Adds the infection image to all aliens for this embryo
|
|
----------------------------------------*/
|
|
/obj/item/organ/body_egg/alien_embryo/AddInfectionImages(mob/living/carbon/C)
|
|
for(var/mob/living/carbon/alien/alien in GLOB.player_list)
|
|
if(alien.client)
|
|
var/I = image('icons/mob/alien.dmi', loc = C, icon_state = "infected[stage]")
|
|
alien.client.images += I
|
|
|
|
/*----------------------------------------
|
|
Proc: RemoveInfectionImage(C)
|
|
Des: Removes all images from the mob infected by this embryo
|
|
----------------------------------------*/
|
|
/obj/item/organ/body_egg/alien_embryo/RemoveInfectionImages(mob/living/carbon/C)
|
|
for(var/mob/living/carbon/alien/alien in GLOB.player_list)
|
|
if(alien.client)
|
|
for(var/image/I in alien.client.images)
|
|
var/searchfor = "infected"
|
|
if(I.loc == owner && findtext(I.icon_state, searchfor, 1, length(searchfor) + 1))
|
|
qdel(I)
|