Skip to content

Commit

Permalink
* Fixes exponentially growing number of diseases on iv_drip giving co…
Browse files Browse the repository at this point in the history
…ntaminated blood

* Reagents now reacts when given by iv_drip()
* Viruses now correctly transfer on blood transfusion
* Some code cleaning
  • Loading branch information
Menshin committed Feb 11, 2015
1 parent cb7aa3b commit 4be0d79
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 67 deletions.
3 changes: 1 addition & 2 deletions code/game/machinery/iv_drip.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@


/obj/machinery/iv_drip/process()
set background = 1

if(src.attached)

if(!(get_dist(src, src.attached) <= 1 && isturf(src.attached.loc)))
Expand All @@ -105,6 +103,7 @@
if(istype(src.beaker, /obj/item/weapon/reagent_containers/blood))
// speed up transfer on blood packs
transfer_amount = 4
src.beaker.reagents.reaction(src.attached, INGEST, 0,0) //make reagents reacts, but don't spam messages
src.beaker.reagents.trans_to(src.attached, transfer_amount)
update_icon()

Expand Down
18 changes: 3 additions & 15 deletions code/modules/mob/living/carbon/human/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,13 @@ var/const/BLOOD_VOLUME_SURVIVE = 122

//set reagent data
B.data["donor"] = src

B.data["viruses"] = list()
/*
if(T.virus && T.virus.spread_type != SPECIAL)
B.data["virus"] = new T.virus.type(0)
*/

for(var/datum/disease/D in src.viruses)
if(!B.data["viruses"])
B.data["viruses"] = list()

B.data["viruses"] += new D.type(0, D, 1)

B.data["blood_DNA"] = copytext(src.dna.unique_enzymes,1,0)
Expand Down Expand Up @@ -193,10 +190,6 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
if(!injected)
return

for(var/datum/disease/D in injected.data["viruses"])
var/datum/disease/new_virus = D.Copy(1)
injected.data["viruses"] += new_virus

var/list/chems = list()
chems = params2list(injected.data["trace_chem"])
for(var/C in chems)
Expand All @@ -219,8 +212,10 @@ var/const/BLOOD_VOLUME_SURVIVE = 122

if (!injected || !our)
return

if(blood_incompatible(injected.data["blood_type"],our.data["blood_type"],injected.data["species"],our.data["species"]) )
reagents.add_reagent("toxin",amount * 0.5)
our.on_merge(injected.data) //still transfer viruses and such, even if incompatibles bloods
reagents.update_total()
else
vessel.add_reagent("blood", amount, injected.data)
Expand Down Expand Up @@ -307,11 +302,4 @@ proc/blood_splatter(var/target,var/datum/reagent/blood/source,var/large)
else
B.blood_DNA[source.data["blood_DNA"]] = "O+"

/* // Update virus information.
for(var/datum/disease/D in source.data["viruses"])
var/datum/disease/new_virus = D.Copy(1)
source.data["viruses"] += new_virus
new_virus.holder = B
*/

return B
21 changes: 13 additions & 8 deletions code/modules/reagents/Chemistry-Goon-Medicine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ datum/reagent/silver_sulfadiazine
color = "#C8A5DC" // rgb: 200, 165, 220
metabolization_rate = 2

datum/reagent/silver_sulfadiazine/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/silver_sulfadiazine/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
M.adjustFireLoss(-volume)
M << "<span class='notice'>You feel your burns healing!</span>"
if(show_message)
M << "<span class='notice'>You feel your burns healing!</span>"
M.emote("scream")
if(method == INGEST)
M.adjustToxLoss(0.5*volume)
M << "<span class='notice'>You probably shouldn't have eaten that. Maybe you should of splashed it on, or applied a patch?</span>"
if(show_message)
M << "<span class='notice'>You probably shouldn't have eaten that. Maybe you should of splashed it on, or applied a patch?</span>"
..()
return

Expand All @@ -37,14 +39,16 @@ datum/reagent/styptic_powder
color = "#C8A5DC" // rgb: 200, 165, 220
metabolization_rate = 2

datum/reagent/styptic_powder/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/styptic_powder/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
M.adjustBruteLoss(-volume)
M << "<span class='notice'>You feel your wounds knitting back together!</span>"
if(show_message)
M << "<span class='notice'>You feel your wounds knitting back together!</span>"
M.emote("scream")
if(method == INGEST)
M.adjustToxLoss(0.5*volume)
M << "<span class='notice'>You probably shouldn't have eaten that. Maybe you should of splashed it on, or applied a patch?</span>"
if(show_message)
M << "<span class='notice'>You probably shouldn't have eaten that. Maybe you should of splashed it on, or applied a patch?</span>"
..()
return

Expand Down Expand Up @@ -77,12 +81,13 @@ datum/reagent/synthflesh
reagent_state = LIQUID
color = "#C8A5DC" // rgb: 200, 165, 220

datum/reagent/synthflesh/reaction_mob(var/mob/living/M, var/method=TOUCH, var/volume)
datum/reagent/synthflesh/reaction_mob(var/mob/living/M, var/method=TOUCH, var/volume,var/show_message = 1)
if(!M) M = holder.my_atom
if(method == TOUCH)
M.adjustBruteLoss(-1.5*volume)
M.adjustFireLoss(-1.5*volume)
M << "<span class='notice'>You feel your burns healing and your flesh knitting together!</span>"
if(show_message)
M << "<span class='notice'>You feel your burns healing and your flesh knitting together!</span>"
..()
return

Expand Down
28 changes: 9 additions & 19 deletions code/modules/reagents/Chemistry-Holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -388,25 +388,15 @@ datum/reagents/proc/clear_reagents()
del_reagent(R.id)
return 0

datum/reagents/proc/reaction(var/atom/A, var/method=TOUCH, var/volume_modifier=0)

switch(method)
if(TOUCH)
for(var/datum/reagent/R in reagent_list)
if(ismob(A))
R.reaction_mob(A, TOUCH, R.volume+volume_modifier)
if(isturf(A))
R.reaction_turf(A, R.volume+volume_modifier)
if(isobj(A))
R.reaction_obj(A, R.volume+volume_modifier)
if(INGEST)
for(var/datum/reagent/R in reagent_list)
if(ismob(A))
R.reaction_mob(A, INGEST, R.volume+volume_modifier)
if(isturf(A))
R.reaction_turf(A, R.volume+volume_modifier)
if(isobj(A))
R.reaction_obj(A, R.volume+volume_modifier)
datum/reagents/proc/reaction(var/atom/A, var/method=TOUCH, var/volume_modifier=0,var/show_message=1)
for(var/datum/reagent/R in reagent_list)
if(ismob(A))
R.reaction_mob(A, method, R.volume+volume_modifier, show_message)
if(isturf(A))
R.reaction_turf(A, R.volume+volume_modifier, show_message)
if(isobj(A))
R.reaction_obj(A, R.volume+volume_modifier, show_message)

return

datum/reagents/proc/add_reagent(var/reagent, var/amount, var/list/data=null, var/reagtemp = 300)
Expand Down
54 changes: 32 additions & 22 deletions code/modules/reagents/Chemistry-Reagents/Blob-Reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ datum/reagent/blob/boiling_oil
description = ""
color = "#B68D00"

datum/reagent/blob/boiling_oil/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/boiling_oil/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
M.apply_damage(15, BURN)
M.adjust_fire_stacks(2)
M.IgniteMob()
M << "<span class = 'userdanger'>The blob splashes you with burning oil!</span>"
if(show_message)
M << "<span class = 'userdanger'>The blob splashes you with burning oil!</span>"
M.emote("scream")

datum/reagent/blob/toxic_goop
Expand All @@ -20,22 +21,24 @@ datum/reagent/blob/toxic_goop
description = ""
color = "#008000"

datum/reagent/blob/toxic_goop/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/toxic_goop/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
M.apply_damage(20, TOX)
M << "<span class = 'userdanger'>The blob strikes you, and you feel sick and nauseated!</span>"
if(show_message)
M << "<span class = 'userdanger'>The blob strikes you, and you feel sick and nauseated!</span>"

datum/reagent/blob/skin_ripper
name = "Skin Ripper"
id = "skin_ripper"
description = ""
color = "#FF4C4C"

datum/reagent/blob/skin_ripper/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/skin_ripper/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
M.apply_damage(20, BRUTE)
M << "<span class = 'userdanger'>The blob strikes you, and you feel your skin ripping and tearing off!</span>"
M.emote("scream")
if(show_message)
M << "<span class = 'userdanger'>The blob strikes you, and you feel your skin ripping and tearing off!</span>"
M.emote("scream")

// Combo Reagents

Expand All @@ -45,26 +48,28 @@ datum/reagent/blob/skin_melter
description = ""
color = "#7F0000"

datum/reagent/blob/skin_melter/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/skin_melter/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
M.apply_damage(10, BRUTE)
M.apply_damage(10, BURN)
M.adjust_fire_stacks(2)
M.IgniteMob()
M << "<span class = 'userdanger'>The blob strikes you, and you feel your skin char and melt!</span>"
M.emote("scream")
if(show_message)
M << "<span class = 'userdanger'>The blob strikes you, and you feel your skin char and melt!</span>"
M.emote("scream")

datum/reagent/blob/lung_destroying_toxin
name = "Lung Destroying Toxin"
id = "lung_destroying_toxin"
description = ""
color = "#00FFC5"

datum/reagent/blob/lung_destroying_toxin/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/lung_destroying_toxin/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume,var/show_message = 1)
if(method == TOUCH)
M.apply_damage(20, OXY)
M.apply_damage(20, TOX)
M << "<span class = 'userdanger'>The blob strikes you, and your lungs feel heavy and weak!</span>"
if(show_message)
M << "<span class = 'userdanger'>The blob strikes you, and your lungs feel heavy and weak!</span>"
// Special Reagents

datum/reagent/blob/acid
Expand All @@ -73,19 +78,20 @@ datum/reagent/blob/acid
description = ""
color = "#BD80F4"

datum/reagent/blob/acid/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/acid/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
M.acid_act(10,1,5)
M.apply_damage(10, BRUTE)
M << "<span class = 'userdanger'>The blob's tendrils melt though your equipment!</span>"
if(show_message)
M << "<span class = 'userdanger'>The blob's tendrils melt though your equipment!</span>"

datum/reagent/blob/radioactive_liquid
name = "Radioactive Liquid"
id = "radioactive_liquid"
description = ""
color = "#00EE00"

datum/reagent/blob/radioactive_liquid/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/radioactive_liquid/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume,var/show_message = 1)
if(method == TOUCH)
if(istype(M, /mob/living/carbon/human))
M.apply_damage(10, BRUTE)
Expand All @@ -98,30 +104,33 @@ datum/reagent/blob/radioactive_liquid/reaction_mob(var/mob/living/M as mob, var/
randmutg(M)
domutcheck(M, null)
updateappearance(M)
M << "<span class = 'userdanger'>The blob strikes you, and your skin feels papery and everything hurts!</span>"
if(show_message)
M << "<span class = 'userdanger'>The blob strikes you, and your skin feels papery and everything hurts!</span>"

datum/reagent/blob/dark_matter
name = "Dark Matter"
id = "dark_matter"
description = ""
color = "#61407E"

datum/reagent/blob/dark_matter/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/dark_matter/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
M.apply_damage(15, BRUTE)
reagent_vortex(M, 0)
M << "<span class = 'userdanger'>You feel a thrum as the blob strikes you, and everything flies at you!</span>"
if(show_message)
M << "<span class = 'userdanger'>You feel a thrum as the blob strikes you, and everything flies at you!</span>"

datum/reagent/blob/b_sorium
name = "Sorium"
id = "b_sorium"
description = ""
color = "#808000"

datum/reagent/blob/b_sorium/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/b_sorium/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
M.apply_damage(15, BRUTE)
M << "<span class = 'userdanger'>The blob slams into you, and sends you flying!</span>"
if(show_message)
M << "<span class = 'userdanger'>The blob slams into you, and sends you flying!</span>"
reagent_vortex(M, 1)


Expand All @@ -131,10 +140,11 @@ datum/reagent/blob/explosive // I'm gonna burn in hell for this one
description = ""
color = "#FFA500"

datum/reagent/blob/explosive/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume)
datum/reagent/blob/explosive/reaction_mob(var/mob/living/M as mob, var/method=TOUCH, var/volume, var/show_message = 1)
if(method == TOUCH)
if(prob(75))
M << "<span class = 'userdanger'>The blob strikes you, and its tendrils explode!</span>"
if(show_message)
M << "<span class = 'userdanger'>The blob strikes you, and its tendrils explode!</span>"
explosion(M.loc, 0, 0, 1, 0, 0)

/proc/reagent_vortex(var/mob/living/M as mob, var/setting_type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ datum/reagent
var/addiction_stage = 0
var/overdosed = 0 // You fucked up and this is now triggering it's overdose effects, purge that shit quick.

datum/reagent/proc/reaction_mob(var/mob/M, var/method=TOUCH, var/volume) //By default we have a chance to transfer some
datum/reagent/proc/reaction_mob(var/mob/M, var/method=TOUCH, var/volume, var/show_message = 1) //By default we have a chance to transfer some
if(!istype(M, /mob/living))
return 0
var/datum/reagent/self = src
Expand Down

0 comments on commit 4be0d79

Please sign in to comment.