From 1057288bb29b15b64a71ea5ded803a0a84a57bf4 Mon Sep 17 00:00:00 2001
From: boy2mantwicethefam
<41342767+boy2mantwicethefam@users.noreply.github.com>
Date: Sat, 29 Jan 2022 22:29:15 +0200
Subject: [PATCH] Upgraded pathogenic incubators can now narrow their effects
to certain stages (#31914)
* Incubator
* Remove unused var
---
code/modules/virus2/disease2.dm | 18 ++++++++++++++++--
code/modules/virus2/dishincubator.dm | 22 +++++++++++++++++++++-
nano/templates/dish_incubator.tmpl | 5 +++++
3 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/code/modules/virus2/disease2.dm b/code/modules/virus2/disease2.dm
index 6d3592c043d..a981f37b581 100644
--- a/code/modules/virus2/disease2.dm
+++ b/code/modules/virus2/disease2.dm
@@ -583,6 +583,8 @@ var/global/list/disease2_list = list()
var/mob/living/body = null
var/obj/item/weapon/virusdish/dish = null
var/obj/machinery/disease2/incubator/machine = null
+ var/can_focus_effect = 0 //So we do not copypaste the entire check everywhere
+ var/effect_being_focused = 0 //What effect is being focused on
if (isliving(incubator))
body = incubator
@@ -590,6 +592,11 @@ var/global/list/disease2_list = list()
dish = incubator
if (istype(dish.loc,/obj/machinery/disease2/incubator))
machine = dish.loc
+ if(machine.can_focus) //If it can focus
+ can_focus_effect = 1
+ effect_being_focused = clamp(machine.effect_focus, 0, max_stage) //Do not let the machine focus on the wrong things
+ if(effect_being_focused == 0) //Toggle it off
+ can_focus_effect = 0
if (mutatechance > 0 && (body || dish) && incubator.reagents)
//MUTAGEN + CREATINE = Robustness Up, Effect Strength Up, Effect Chance randomized
@@ -599,6 +606,8 @@ var/global/list/disease2_list = list()
var/change = rand(1,5)
robustness = min(100,robustness + change)
for(var/datum/disease2/effect/e in effects)
+ if(can_focus_effect && !e.stage == effect_being_focused)
+ continue
e.multiplier_tweak(0.1)//all effects get their strength increased
minormutate()// a random effect has a 20% chance of getting its chance re-rolled between its initial value and max chance.
// and the disease's infection chance is rerolled to more or less 10% of the base infection chance for that disease type.
@@ -612,6 +621,8 @@ var/global/list/disease2_list = list()
var/change = rand(1,5)
robustness = max(0,robustness - change)
for(var/datum/disease2/effect/e in effects)
+ if(can_focus_effect && !e.stage == effect_being_focused)
+ continue
e.multiplier_tweak(-0.1)//all effects get their strength reduced
minormutate()// a random effect has a 20% chance of getting its chance re-rolled between its initial value and max chance.
// and the disease's infection chance is rerolled to more or less 10% of the base infection chance for that disease type.
@@ -622,7 +633,8 @@ var/global/list/disease2_list = list()
//MUTAGEN (with no creatine or spaceacillin) = New Effect
if(!incubator.reagents.remove_reagent(MUTAGEN,0.05) && prob(mutatechance))
log += "
[timestamp()] Effect Mutation (Mutagen in [incubator])"
- effectmutate(body != null)
+ var/focused_effect = (can_focus_effect && effect_being_focused)
+ effectmutate(body != null, focused_effect)
if (dish)
if(dish.info && dish.analysed)
dish.info = "OUTDATED : [dish.info]"
@@ -734,13 +746,15 @@ var/global/list/disease2_list = list()
//Major Mutations
-/datum/disease2/disease/proc/effectmutate(var/inBody=FALSE)
+/datum/disease2/disease/proc/effectmutate(var/inBody=FALSE, var/specific_effect)
clean_global_log()
subID = rand(0,9999)
var/list/randomhexes = list("7","8","9","a","b","c","d","e")
var/colormix = "#[pick(randomhexes)][pick(randomhexes)][pick(randomhexes)][pick(randomhexes)][pick(randomhexes)][pick(randomhexes)]"
color = BlendRGB(color,colormix,0.25)
var/i = rand(1, effects.len)
+ if(specific_effect)
+ i = specific_effect
var/datum/disease2/effect/e = effects[i]
var/datum/disease2/effect/f
if (inBody)//mutations that occur directly in a body don't cause helpful symptoms to become deadly instantly.
diff --git a/code/modules/virus2/dishincubator.dm b/code/modules/virus2/dishincubator.dm
index ecd7b6acfb0..c3b362ca206 100644
--- a/code/modules/virus2/dishincubator.dm
+++ b/code/modules/virus2/dishincubator.dm
@@ -26,6 +26,8 @@
var/mutatechance = 5
var/growthrate = 4
+ var/can_focus = 0 //Whether the machine can focus on an effect to mutate it or not
+ var/effect_focus = 0 //What effect of the disease are we focusing on?
/obj/machinery/disease2/incubator/New()
@@ -51,6 +53,10 @@
scancount += SP.rating-1
if(istype(SP, /obj/item/weapon/stock_parts/micro_laser))
lasercount += SP.rating-1
+ if(lasercount >= 4)
+ can_focus = 1
+ else
+ can_focus = 0
mutatechance = initial(mutatechance) * max(1, scancount)
growthrate = initial(growthrate) + lasercount
@@ -169,7 +175,20 @@
dish_datum.dish.reagents.clear_reagents()
return TRUE
-
+ if (href_list["changefocus"])
+ var/slot = text2num(href_list["changefocus"])
+ if(slot == null || slot < 1 || slot > dish_data.len)
+ return TRUE
+ var/dish_incubator_dish/dish_datum = dish_data[slot]
+ if (dish_datum == null)
+ return TRUE
+ var/stage_to_focus = input(usr, "Choose a stage to focus on. This will block symptoms from other stages from being mutated. Input 0 to disable effect focusing.", "Choose a stage.") as num
+ if(!stage_to_focus)
+ to_chat(usr, "The effect focusing is now turned off.")
+ else
+ to_chat(usr, "span class='notice'>\The [src] will now focus on stage [stage_to_focus].")
+ effect_focus = stage_to_focus
+ return TRUE
/obj/machinery/disease2/incubator/attack_hand(var/mob/user)
. = ..()
@@ -203,6 +222,7 @@
var/list/data = list()
data["on"] = on
+ data["can_focus"] = can_focus
var/list/dish_ui_data = list()
data["dishes"] = dish_ui_data
diff --git a/nano/templates/dish_incubator.tmpl b/nano/templates/dish_incubator.tmpl
index a0f949c099f..8d7c6b79f5a 100644
--- a/nano/templates/dish_incubator.tmpl
+++ b/nano/templates/dish_incubator.tmpl
@@ -60,6 +60,11 @@