Generalizes the chemical blacklist, refactors some other chemical lists and cleans up some related code (#21810)

* almost done

* HELP, SCOPE KEEPS INCREASING

* if this isn't the last thing, blame my sleepy me

* fucking foam all my homies hate foam

* remove the extra whitespace

* ghhh this needs testing + revert old shit

* first sleeper steps

* okay now to revert some changes

* oops forgot this

* more fixes

* iv bags can't dupe shit anymore too

* removes coniine from the list because why not

* removes life and histamine

* this should pass Cl

* stop runtiming me for unexisting chemicals

* adds ???? instead + god I hope this passes Cl

* attempt #2 to fix Cl

* Cl still fails but no solution now - static lists

* One fucking day Cl will not fail + complete remove

* I am going insane

* I am praying to several gods

* I'm getting desparate

* whoops that's my bad

* whoopsie number 2

* oops space indentation

* one rubber ducky later

* attempt number I am in a psych ward

* CODING CHAT MY BELOVED

* last things

* foam is also not a chemical

* now it shouldn't remake the list every time

* Henri review

* Adds saturated activated charcoal

* Charlie review
This commit is contained in:
DGamerL
2023-09-13 10:42:17 +01:00
committed by GitHub
parent cf381b1300
commit 3de8e63c6c
20 changed files with 90 additions and 139 deletions
@@ -28,6 +28,10 @@
var/printing = FALSE
var/static/list/pill_bottle_wrappers
var/static/list/bottle_styles
var/list/safe_chem_list = list("antihol", "charcoal", "epinephrine", "insulin", "teporone", "silver_sulfadiazine", "salbutamol",
"omnizine", "stimulants", "synaptizine", "potass_iodide", "oculine", "mannitol", "styptic_powder",
"spaceacillin", "salglu_solution", "sal_acid", "cryoxadone", "blood", "synthflesh", "hydrocodone",
"mitocholide", "rezadone", "menthol")
/obj/machinery/chem_master/Initialize(mapload)
. = ..()
@@ -546,7 +550,7 @@
/obj/machinery/chem_master/proc/chemical_safety_check(datum/reagents/R)
var/all_safe = TRUE
for(var/datum/reagent/A in R.reagent_list)
if(!GLOB.safe_chem_list.Find(A.id))
if(!safe_chem_list.Find(A.id))
all_safe = FALSE
return all_safe
@@ -5,7 +5,6 @@
reagent_state = LIQUID
color = "#C8A5DC" // rgb: 200, 165, 220
process_flags = ORGANIC | SYNTHETIC //Adminbuse knows no bounds!
can_synth = FALSE
taste_description = "admin abuse"
/datum/reagent/medicine/adminordrazine/on_mob_life(mob/living/carbon/M)
@@ -1162,7 +1162,6 @@
reagent_state = LIQUID
color = "#DC0000"
alcohol_perc = 1
can_synth = FALSE
taste_description = "<span class='userdanger'>LIQUID FUCKING DEATH OH GOD WHAT THE FUCK</span>"
/datum/reagent/consumable/ethanol/dragons_breath/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume)
@@ -1311,7 +1310,6 @@
color = "#FFFFFF"
alcohol_perc = 0.35
taste_description = "bad coding"
can_synth = FALSE
var/list/names = list("null fruit" = 1) //Names of the fruits used. Associative list where name is key, value is the percentage of that fruit.
var/list/tastes = list("bad coding" = 1) //List of tastes. See above.
@@ -5,7 +5,6 @@
var/complementary_color = COLOR_BLACK
var/message = "The blob strikes you" //message sent to any mob hit by the blob
var/message_living = null //extension to first mob sent to only living mobs i.e. silicons have no skin to be burnt
can_synth = FALSE
/datum/reagent/blob/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume, show_message, touch_protection)
return round(volume * min(1.5 - touch_protection, 1), 0.1) //full touch protection means 50% volume, any prot below 0.5 means 100% volume.
@@ -4,7 +4,6 @@
description = "A fine dust containing spider eggs. Oh gosh."
reagent_state = SOLID
color = "#FFFFFF"
can_synth = FALSE
taste_mult = 0
/datum/reagent/spider_eggs/on_mob_life(mob/living/M)
@@ -19,7 +18,6 @@
id = "nanomachines"
description = "Microscopic construction robots."
color = "#535E66" // rgb: 83, 94, 102
can_synth = FALSE
taste_mult = 0
/datum/reagent/nanomachines/on_mob_life(mob/living/carbon/M)
@@ -32,7 +30,6 @@
id = "xenomicrobes"
description = "Microbes with an entirely alien cellular structure."
color = "#535E66" // rgb: 83, 94, 102
can_synth = FALSE
taste_mult = 0
/datum/reagent/xenomicrobes/on_mob_life(mob/living/carbon/M)
@@ -45,7 +42,6 @@
id = "fungalspores"
description = "Active fungal spores."
color = "#92D17D" // rgb: 146, 209, 125
can_synth = FALSE
taste_mult = 0
/datum/reagent/fungalspores/on_mob_life(mob/living/carbon/M)
@@ -59,7 +55,6 @@
description = "Rapid chemical decomposition has warped these crystals into twisted spikes."
reagent_state = SOLID
color = "#FA0000" // rgb: 250, 0, 0
can_synth = FALSE
taste_mult = 0
/datum/reagent/jagged_crystals/on_mob_life(mob/living/carbon/M)
@@ -72,7 +67,6 @@
description = "A nasty bacteria found in spoiled food."
reagent_state = LIQUID
color = "#1E4600"
can_synth = FALSE
taste_mult = 0
/datum/reagent/salmonella/on_mob_life(mob/living/carbon/M)
@@ -85,7 +79,6 @@
description = "Liquid gibbis."
reagent_state = LIQUID
color = "#FF0000"
can_synth = FALSE
taste_mult = 0
/datum/reagent/gibbis/on_mob_life(mob/living/carbon/M)
@@ -99,7 +92,6 @@
description = "A disease-causing agent that is neither bacterial nor fungal nor viral and contains no genetic material."
reagent_state = LIQUID
color = "#FFFFFF"
can_synth = FALSE
taste_mult = 0
/datum/reagent/prions/on_mob_life(mob/living/carbon/M)
@@ -113,7 +105,6 @@
description = "Hook me up to an IV of that sweet, sweet stuff!"
reagent_state = LIQUID
color = "#F7E6B1"
can_synth = FALSE
taste_description = "bacon"
/datum/reagent/bacon_grease/on_mob_life(mob/living/carbon/M)
@@ -127,7 +118,6 @@
description = "Aww, gross! These things can't be good for your heart. They're gunna eat it!"
reagent_state = SOLID
color = "#925D6C"
can_synth = FALSE
taste_mult = 0
/datum/reagent/heartworms/on_mob_life(mob/living/carbon/M)
@@ -146,7 +136,6 @@
description = "A guaranteed heart-stopper!"
reagent_state = LIQUID
color = "#AB1CCF"
can_synth = FALSE
taste_mult = 0
/datum/reagent/concentrated_initro/on_mob_life(mob/living/M)
@@ -962,7 +962,6 @@
description = "An illegal compound that dramatically enhances the body's performance and healing capabilities."
color = "#C8A5DC"
harmless = FALSE
can_synth = FALSE
taste_description = "<span class='userdanger'>an unstoppable force</span>"
/datum/reagent/medicine/stimulants/on_mob_life(mob/living/M)
@@ -1004,7 +1003,6 @@
metabolization_rate = 0.5 * REAGENTS_METABOLISM
overdose_threshold = 60
harmless = FALSE
can_synth = FALSE
/datum/reagent/medicine/stimulative_agent/on_mob_add(mob/living/L)
ADD_TRAIT(L, TRAIT_GOTTAGOFAST, id)
@@ -1166,7 +1164,6 @@
description = "Miniature medical robots that swiftly restore bodily damage. May begin to attack their host's cells in high amounts."
reagent_state = SOLID
color = "#555555"
can_synth = FALSE
taste_description = "bodily perfection"
/datum/reagent/medicine/syndicate_nanites/on_mob_life(mob/living/M)
@@ -1366,7 +1363,6 @@
description = "Highly advanced nanites equipped with an unknown payload designed to repair a body. Nanomachines son."
color = "#9b3401"
metabolization_rate = 0.5
can_synth = FALSE
harmless = FALSE
taste_description = "2 minutes of suffering"
var/list/stimulant_list = list("methamphetamine", "crank", "bath_salts", "stimulative_agent", "stimulants")
@@ -1436,7 +1432,6 @@
color = "#C8A5DC" // rgb: 200, 165, 220
overdose_threshold = 3 //To prevent people stacking massive amounts of a very strong healing reagent
harmless = FALSE
can_synth = FALSE
/datum/reagent/medicine/lavaland_extract/on_mob_life(mob/living/carbon/M)
var/update_flags = STATUS_UPDATE_NONE
@@ -81,7 +81,6 @@
description = "A corruptive toxin produced by slimes."
reagent_state = LIQUID
color = "#13BC5E" // rgb: 19, 188, 94
can_synth = FALSE
taste_description = "shadows"
/datum/reagent/slimetoxin/on_mob_life(mob/living/M)
@@ -101,7 +100,6 @@
description = "An advanced corruptive toxin produced by slimes."
reagent_state = LIQUID
color = "#13BC5E" // rgb: 19, 188, 94
can_synth = FALSE
taste_description = "slime"
/datum/reagent/aslimetoxin/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume)
@@ -209,7 +207,6 @@
reagent_state = LIQUID
color = "#7DFF00"
taste_description = "slime"
can_synth = FALSE
/datum/reagent/stable_mutagen/on_new(data)
..()
@@ -459,7 +456,6 @@
drink_icon ="beerglass"
drink_name = "Beer glass"
drink_desc = "A freezing pint of beer"
can_synth = FALSE
taste_description = "beer"
taste_description = "piss water"
@@ -491,7 +487,6 @@
color = "#CF3600"
metabolization_rate = 0.1
penetrates_skin = TRUE
can_synth = FALSE
taste_mult = 0
/datum/reagent/polonium/on_mob_life(mob/living/M)
@@ -615,7 +610,6 @@
color = "#CF3600"
metabolization_rate = 0.2
overdose_threshold = 40
can_synth = FALSE
taste_mult = 0
/datum/reagent/venom/on_mob_life(mob/living/M)
@@ -741,7 +735,6 @@
description = "A highly potent cardiac poison - can kill within minutes."
reagent_state = LIQUID
color = "#7F10C0"
can_synth = FALSE
taste_mult = 0
/datum/reagent/initropidril/on_mob_life(mob/living/M)
@@ -806,7 +799,6 @@
reagent_state = LIQUID
color = "#5F8BE1"
metabolization_rate = 0.7
can_synth = FALSE
taste_mult = 0
/datum/reagent/sodium_thiopental/on_mob_life(mob/living/M)
@@ -836,7 +828,6 @@
color = "#646EA0"
metabolization_rate = 0.8
penetrates_skin = TRUE
can_synth = FALSE
taste_mult = 0
/datum/reagent/ketamine/on_mob_life(mob/living/M)
@@ -930,7 +921,6 @@
reagent_state = LIQUID
color = "#C2D8CD"
metabolization_rate = 0.05
can_synth = FALSE
taste_mult = 0
/datum/reagent/coniine/on_mob_life(mob/living/M)
@@ -946,7 +936,6 @@
reagent_state = LIQUID
color = "#191919"
metabolization_rate = 0.1
can_synth = FALSE
penetrates_skin = TRUE
taste_mult = 0
@@ -1301,7 +1290,6 @@
description = "An advanced corruptive toxin produced by something terrible."
reagent_state = LIQUID
color = "#5EFF3B" //RGB: 94, 255, 59
can_synth = FALSE
taste_description = "decay"
/datum/reagent/gluttonytoxin/reaction_mob(mob/living/L, method=REAGENT_TOUCH, reac_volume)
@@ -396,7 +396,6 @@
description = "YOUR FLESH! IT BURNS!"
process_flags = ORGANIC | SYNTHETIC //Admin-bus has no brakes! KILL THEM ALL.
metabolization_rate = 1
can_synth = FALSE
taste_description = "burning"
/datum/reagent/hellwater/on_mob_life(mob/living/M)
@@ -446,3 +445,11 @@
var/t_loc = get_turf(O)
qdel(O)
new /obj/item/clothing/shoes/galoshes/dry(t_loc)
/datum/reagent/saturated_activated_charcoal
name = "Saturated activated charcoal"
id = "saturated_charcoal"
description = "Charcoal that is completely saturated with various toxins. Useless."
reagent_state = LIQUID
color = "#29262b"
taste_description = "burnt dirt"
@@ -19,7 +19,6 @@
//By default, all reagents will ONLY affect organics, not synthetics. Re-define in the reagent's definition if the reagent is meant to affect synths
var/process_flags = ORGANIC
var/harmless = FALSE //flag used for attack logs
var/can_synth = TRUE //whether or not a mech syringe gun and synthesize this reagent
var/overdose_threshold = 0
var/addiction_chance = 0
var/addiction_chance_additional = 100 // If we want to lower the chance of addiction even more, set this
@@ -941,12 +941,14 @@
reagents.my_atom = src
/proc/get_random_reagent_id() // Returns a random reagent ID minus blacklisted reagents
var/static/list/random_reagents = list()
var/static/list/random_reagents
if(!length(random_reagents))
for(var/thing in subtypesof(/datum/reagent))
var/datum/reagent/R = thing
if(initial(R.can_synth))
random_reagents += initial(R.id)
random_reagents = list()
for(var/datum/reagent/thing as anything in subtypesof(/datum/reagent))
var/R = initial(thing.id)
if(R in GLOB.blocked_chems)
continue
random_reagents += R
var/picked_reagent = pick(random_reagents)
return picked_reagent
@@ -44,7 +44,7 @@
var/datum/reagent/R = X
if(R.id in required_reagents)
continue
if(!R.can_synth)
if(R in GLOB.blocked_chems)
continue
beeagents += R
var/bee_amount = round(created_volume * 0.2)
@@ -259,7 +259,7 @@
required_reagents = list("potassium" = 1, "sugar" = 1, "phosphorus" = 1)
result_amount = 1
mix_message = "The mixture quickly turns into a pall of smoke!"
var/forbidden_reagents = list("sugar", "phosphorus", "potassium", "stimulants") //Do not transfer this stuff through smoke.
var/forbidden_reagents = list("sugar", "phosphorus", "potassium", "stimulants", "smoke_powder") //Do not transfer this stuff through smoke.
/datum/chemical_reaction/smoke/on_reaction(datum/reagents/holder, created_volume)
for(var/f_reagent in forbidden_reagents)
@@ -284,7 +284,6 @@
required_reagents = list("smoke_powder" = 1)
min_temp = T0C + 100
result_amount = 1
forbidden_reagents = list("stimulants")
mix_sound = null
/datum/chemical_reaction/sonic_powder
@@ -15,6 +15,7 @@
var/applied_amount = 8 // How much it applies
var/applying = FALSE // So it can't be spammed.
var/measured_health = 0 // Used for measuring health; we don't want this to stop applying once the person's health isn't changing.
var/static/list/safe_chem_applicator_list = list("silver_sulfadiazine", "styptic_powder", "synthflesh")
/obj/item/reagent_containers/applicator/emag_act(mob/user)
if(!emagged)
@@ -29,7 +30,7 @@
if(!emagged)
var/found_forbidden_reagent = FALSE
for(var/datum/reagent/R in reagents.reagent_list)
if(!GLOB.safe_chem_applicator_list.Find(R.id))
if(!safe_chem_applicator_list.Find(R.id))
reagents.del_reagent(R.id)
found_forbidden_reagent = TRUE
if(found_forbidden_reagent)
@@ -17,6 +17,10 @@
slot_flags = SLOT_BELT
var/ignore_flags = FALSE
var/safety_hypo = FALSE
var/static/list/safe_chem_list = list("antihol", "charcoal", "epinephrine", "insulin", "teporone", "silver_sulfadiazine", "salbutamol",
"omnizine", "stimulants", "synaptizine", "potass_iodide", "oculine", "mannitol", "styptic_powder",
"spaceacillin", "salglu_solution", "sal_acid", "cryoxadone", "blood", "synthflesh", "hydrocodone",
"mitocholide", "rezadone", "menthol")
/obj/item/reagent_containers/hypospray/proc/apply(mob/living/M, mob/user)
if(!reagents.total_volume)
@@ -62,7 +66,7 @@
if(safety_hypo && !emagged)
var/found_forbidden_reagent = FALSE
for(var/datum/reagent/R in reagents.reagent_list)
if(!GLOB.safe_chem_list.Find(R.id))
if(!safe_chem_list.Find(R.id))
reagents.del_reagent(R.id)
found_forbidden_reagent = TRUE
if(found_forbidden_reagent)
@@ -75,6 +75,9 @@
if(reagents.total_volume < reagents.maximum_volume)
injection_target.transfer_blood_to(src, amount_per_transfer_from_this)
for(var/datum/reagent/x in injection_target.reagents.reagent_list) // Pull small amounts of reagents from the person while drawing blood
var/datum/reagent/R
if(R.id in GLOB.blocked_chems)
continue
injection_target.reagents.trans_to(src, amount_per_transfer_from_this/10)
update_icon(UPDATE_OVERLAYS)