Xenomorph embryos now grow based on consistent timers instead of 100% RNG (3% chance every 2s) (#55755)

• Adds documentation to alien_embryo.dm
• Refactors how alien embryos increase their stage var, aka their cute ickle baby development stage. Now it increases stage every minute, which means 5 minutes to grow as opposed to taking 15 seconds to the end of time to grow.
• Growth time is now defined by a variable, so admins can var-edit it in game and future coders can easily change the variable to make it take more or less time to grow. It also means it's a simple one-line edit if any of TG's plentiful downstreams want to change this for their server.
This commit is contained in:
KathrinBailey
2021-01-10 19:00:45 -03:00
committed by GitHub
parent 42ea30b96d
commit 4eed35fd74
@@ -5,12 +5,20 @@
icon = 'icons/mob/alien.dmi'
icon_state = "larva0_dead"
food_reagents = list(/datum/reagent/consumable/nutriment = 5, /datum/reagent/toxin/acid = 10)
///What stage of growth the embryo is at. Developed embryos give the host symptoms suggesting that an embryo is inside them.
var/stage = 0
/// Are we bursting out of the poor sucker who's the xeno mom?
var/bursting = FALSE
/// How long does it take to advance one stage? Growth time * 5 = how long till we make a Larva!
var/growth_time = 60 SECONDS
/obj/item/organ/body_egg/alien_embryo/Initialize()
. = ..()
advance_embryo_stage()
/obj/item/organ/body_egg/alien_embryo/on_find(mob/living/finder)
..()
if(stage < 4)
if(stage < 5)
to_chat(finder, "<span class='notice'>It's small and weak, barely the size of a foetus.</span>")
else
to_chat(finder, "<span class='notice'>It's grown quite large, and writhes slightly as you look at it.</span>")
@@ -20,7 +28,7 @@
/obj/item/organ/body_egg/alien_embryo/on_life()
. = ..()
switch(stage)
if(2, 3)
if(3, 4)
if(prob(2))
owner.emote("sneeze")
if(prob(2))
@@ -29,7 +37,7 @@
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(5)
if(prob(2))
owner.emote("sneeze")
if(prob(2))
@@ -46,12 +54,17 @@
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++
/// Controls Xenomorph Embryo growth. If embryo is fully grown (or overgrown), stop the proc. If not, increase the stage by one and if it's not fully grown (stage 6), add a timer to do this proc again after however long the growth time variable is.
/obj/item/organ/body_egg/alien_embryo/proc/advance_embryo_stage()
if(stage >= 6)
return
if(++stage < 6)
INVOKE_ASYNC(src, .proc/RefreshInfectionImage)
addtimer(CALLBACK(src, .proc/advance_embryo_stage), growth_time)
if(stage == 5 && prob(50))
/obj/item/organ/body_egg/alien_embryo/egg_process()
if(stage == 6 && 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)
@@ -59,7 +72,6 @@
AttemptGrow()
/obj/item/organ/body_egg/alien_embryo/proc/AttemptGrow(gib_on_success=TRUE)
if(!owner || bursting)
return
@@ -73,7 +85,8 @@
if(!candidates.len || !owner)
bursting = FALSE
stage = 4
stage = 5 // If no ghosts sign up for the Larva, let's regress our growth by one minute, we will try again!
addtimer(CALLBACK(src, .proc/advance_embryo_stage), growth_time)
return
var/mob/dead/observer/ghost = pick(candidates)