From 4eed35fd745223cf6eeede54b64d1cca8bbd3ddc Mon Sep 17 00:00:00 2001
From: KathrinBailey <53862927+KathrinBailey@users.noreply.github.com>
Date: Sun, 10 Jan 2021 22:00:45 +0000
Subject: [PATCH] Xenomorph embryos now grow based on consistent timers instead
of 100% RNG (3% chance every 2s) (#55755)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
• 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.
---
.../carbon/alien/special/alien_embryo.dm | 31 +++++++++++++------
1 file changed, 22 insertions(+), 9 deletions(-)
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 d48a980d2e1..e685b6c3cc3 100644
--- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm
+++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm
@@ -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, "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.")
@@ -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, "Your throat feels sore.")
if(prob(2))
to_chat(owner, "Mucous runs down the back of your throat.")
- if(4)
+ if(5)
if(prob(2))
owner.emote("sneeze")
if(prob(2))
@@ -46,12 +54,17 @@
to_chat(owner, "You feel something tearing its way out of your stomach...")
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)