Skip to content

Commit a18d568

Browse files
authored
adenosine (#1156)
* adenosine * oops lol * oops lol * bump OD * fuck * balance adjustments * balance * fix macro
1 parent 28c5f91 commit a18d568

File tree

9 files changed

+78
-38
lines changed

9 files changed

+78
-38
lines changed

code/__DEFINES/reagents.dm

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@
104104
////Used to force an equlibrium to end a reaction in reaction_step() (i.e. in a reaction_step() proc return END_REACTION to end it)
105105
#define END_REACTION "end_reaction"
106106

107+
/// Helper for converting realtime seconds into reagent cycles.
108+
#define SECONDS_TO_REAGENT_CYCLES(seconds) round(seconds / (/datum/controller/subsystem/mobs::wait / 10))
109+
107110
///Minimum requirement for addiction buzz to be met. Addiction code only checks this once every two seconds, so this should generally be low
108111
#define MIN_ADDICTION_REAGENT_AMOUNT 1
109112
///Nicotine requires much less in your system to be happy

code/game/objects/items/storage/uplink_kits.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
new /obj/item/reagent_containers/glass/bottle/fentanyl(src)
357357
new /obj/item/reagent_containers/glass/bottle/cyanide(src)
358358
new /obj/item/reagent_containers/glass/bottle/histamine(src)
359-
new /obj/item/reagent_containers/glass/bottle/initropidril(src)
359+
new /obj/item/reagent_containers/glass/bottle/adenosine(src)
360360
new /obj/item/reagent_containers/glass/bottle/pancuronium(src)
361361
new /obj/item/reagent_containers/glass/bottle/sodium_thiopental(src)
362362
new /obj/item/reagent_containers/glass/bottle/lexorin(src)

code/modules/reagents/chemistry/reagents/medicine_reagents.dm

+52
Original file line numberDiff line numberDiff line change
@@ -976,3 +976,55 @@
976976

977977
if(prob(3))
978978
C.vomit(50, FALSE, FALSE, 1, purge_ratio = 0.2)
979+
980+
/datum/reagent/medicine/adenosine
981+
name = "Adenosine"
982+
description = "A pharmaceutical used to lower a patient's heartrate. Can be used to restart hearts when dosed correctly."
983+
reagent_state = LIQUID
984+
color = "#7F10C0"
985+
metabolization_rate = 0.5
986+
987+
overdose_threshold = 10.1
988+
989+
/datum/reagent/medicine/adenosine/affect_blood(mob/living/carbon/C, removed)
990+
if(overdosed)
991+
return
992+
993+
if(current_cycle < SECONDS_TO_REAGENT_CYCLES(10)) // Seconds 1-8 do nothing. (0.5 to 2u)
994+
return
995+
996+
if(current_cycle in SECONDS_TO_REAGENT_CYCLES(10) to SECONDS_TO_REAGENT_CYCLES(14)) // Seconds 10-14 stop ya heart. (2.5 to 3.5)
997+
if(C.set_heartattack(TRUE))
998+
log_health(C, "Heart stopped due to adenosine misdose.")
999+
C.Unconscious(3 SECONDS)
1000+
return
1001+
1002+
if(current_cycle == SECONDS_TO_REAGENT_CYCLES(16)) // Restart heart after 16 seconds (exactly 4u)
1003+
if(C.set_heartattack(FALSE))
1004+
log_health(C, "Heart restarted due to adenosine.")
1005+
return
1006+
1007+
if(current_cycle in SECONDS_TO_REAGENT_CYCLES(18) to SECONDS_TO_REAGENT_CYCLES(28)) // 4.5u to 7u is a safe buffer.
1008+
return
1009+
1010+
if(!prob(25)) // Only runs after 7 units have been processed.
1011+
return
1012+
1013+
switch(rand(1,10))
1014+
if(1 to 7)
1015+
C.losebreath += 4
1016+
if(8 to 9)
1017+
C.adjustOxyLoss(rand(3, 4), FALSE)
1018+
. = TRUE
1019+
if(10)
1020+
if(C.set_heartattack(TRUE))
1021+
log_health(C, "Heart stopped due to improper adenosine dose.")
1022+
1023+
/datum/reagent/medicine/adenosine/overdose_process(mob/living/carbon/C)
1024+
if(C.set_heartattack(TRUE))
1025+
log_health(C, "Heart stopped due to adenosine overdose.")
1026+
1027+
if(prob(25))
1028+
C.losebreath += 4
1029+
C.adjustOxyLoss(rand(5,25), 0)
1030+
return TRUE

code/modules/reagents/chemistry/reagents/toxin_reagents.dm

-32
Original file line numberDiff line numberDiff line change
@@ -686,38 +686,6 @@
686686
C.bloodstream.add_reagent(/datum/reagent/toxin/histamine,rand(1,3))
687687
return
688688

689-
/datum/reagent/toxin/initropidril
690-
name = "Initropidril"
691-
description = "A powerful poison with insidious effects. It can cause stuns, lethal breathing failure, and cardiac arrest."
692-
silent_toxin = TRUE
693-
reagent_state = LIQUID
694-
color = "#7F10C0"
695-
metabolization_rate = 0.5 * REAGENTS_METABOLISM
696-
toxpwr = 2.5
697-
chemical_flags = REAGENT_NO_RANDOM_RECIPE
698-
699-
/datum/reagent/toxin/initropidril/affect_blood(mob/living/carbon/C, removed)
700-
if(prob(25))
701-
var/picked_option = rand(1,3)
702-
switch(picked_option)
703-
if(1)
704-
C.Paralyze(60)
705-
. = TRUE
706-
if(2)
707-
C.losebreath += 10
708-
C.adjustOxyLoss(rand(5,25), 0)
709-
. = TRUE
710-
if(3)
711-
if(C.set_heartattack(TRUE))
712-
log_health(C, "Heart stopped due to initropidil.")
713-
if(C.stat < UNCONSCIOUS)
714-
C.visible_message(span_userdanger("[C] clutches at [C.p_their()] chest!"))
715-
else
716-
C.losebreath += 10
717-
C.adjustOxyLoss(rand(5,25), 0)
718-
. = TRUE
719-
return ..() || .
720-
721689
/datum/reagent/toxin/pancuronium
722690
name = "Pancuronium"
723691
description = "An undetectable toxin that swiftly incapacitates its victim. May also cause breathing failure."

code/modules/reagents/reagent_containers/bottle.dm

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@
139139
desc = "A small bottle. Contains Fentanyl."
140140
list_reagents = list(/datum/reagent/toxin/fentanyl = 30)
141141

142-
/obj/item/reagent_containers/glass/bottle/initropidril
143-
name = "initropidril bottle"
144-
desc = "A small bottle. Contains initropidril."
145-
list_reagents = list(/datum/reagent/toxin/initropidril = 30)
142+
/obj/item/reagent_containers/glass/bottle/adenosine
143+
name = "adenosine bottle"
144+
desc = "A small bottle. Contains adenosine."
145+
list_reagents = list(/datum/reagent/medicine/adenosine = 30)
146146

147147
/obj/item/reagent_containers/glass/bottle/pancuronium
148148
name = "pancuronium bottle"

code/modules/reagents/reagent_containers/spray.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@
312312
..(the_targets[i], user)
313313

314314
/obj/item/reagent_containers/spray/chemsprayer/bioterror
315-
list_reagents = list(/datum/reagent/toxin/sodium_thiopental = 100, /datum/reagent/toxin/lexorin = 100, /datum/reagent/toxin/venom = 100, /datum/reagent/consumable/condensedcapsaicin = 100, /datum/reagent/toxin/initropidril = 100, /datum/reagent/toxin/polonium = 100)
315+
list_reagents = list(/datum/reagent/toxin/sodium_thiopental = 100, /datum/reagent/toxin/lexorin = 100, /datum/reagent/toxin/venom = 100, /datum/reagent/consumable/condensedcapsaicin = 100, /datum/reagent/medicine/adenosine = 100, /datum/reagent/toxin/polonium = 100)
316316

317317

318318
/obj/item/reagent_containers/spray/chemsprayer/janitor

code/modules/unit_tests/__unit_tests.dm

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494

9595
// Single File Includes
9696
#include "achievements.dm"
97+
#include "adenosine.dm"
9798
#include "anchored_mobs.dm"
9899
#include "anonymous_themes.dm"
99100
#include "area_contents.dm"

code/modules/unit_tests/adenosine.dm

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/datum/unit_test/adenosine/Run()
2+
var/mob/living/carbon/human/victim = ALLOCATE_BOTTOM_LEFT()
3+
4+
TEST_ASSERT(!victim.undergoing_cardiac_arrest(), "Wtf why is a freshly spawned human undergoing cardiac arrest.")
5+
6+
victim.bloodstream.add_reagent(/datum/reagent/medicine/adenosine, 7)
7+
8+
for(var/i in 1 to 7)
9+
victim.Life(SSmobs.wait)
10+
11+
TEST_ASSERT(victim.undergoing_cardiac_arrest(), "Mob heart did not stop during the first 7 cycles.")
12+
13+
victim.Life(SSmobs.wait)
14+
15+
TEST_ASSERT(!victim.undergoing_cardiac_arrest(), "Mob heart did not restart on 8th cycle.")

tools/UpdatePaths/adenosine.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/obj/item/reagent_containers/glass/bottle/initropidril : /obj/item/reagent_containers/glass/bottle/adenosine

0 commit comments

Comments
 (0)