Added some limited support for alien reagent reactions.

Conflicts:
	code/modules/reagents/Chemistry-Holder.dm
	code/modules/reagents/Chemistry-Reagents.dm
This commit is contained in:
Zuhayr
2014-02-02 00:44:44 -05:00
committed by ZomgPonies
parent 564c7bd6ac
commit 656eaddbd3
2 changed files with 94 additions and 17 deletions
+21
View File
@@ -506,6 +506,27 @@ datum
return res
remove_all_type(var/reagent_type, var/amount, var/strict = 0, var/safety = 1) // Removes all reagent of X type. @strict set to 1 determines whether the childs of the type are included.
if(!isnum(amount)) return 1
var/has_removed_reagent = 0
for(var/datum/reagent/R in reagent_list)
var/matches = 0
// Switch between how we check the reagent type
if(strict)
if(R.type == reagent_type)
matches = 1
else
if(istype(R, reagent_type))
matches = 1
// We found a match, proceed to remove the reagent. Keep looping, we might find other reagents of the same type.
if(matches)
// Have our other proc handle removement
has_removed_reagent = remove_reagent(R.id, amount, safety)
return has_removed_reagent
// Admin logging.
get_reagent_ids(var/and_amount=0)
var/list/stuff = list()
+73 -17
View File
@@ -5,6 +5,10 @@
#define REAGENTS_OVERDOSE 30
#define REM REAGENTS_EFFECT_MULTIPLIER
//Some on_mob_life() procs check for alien races.
#define IS_DIONA 1
#define IS_VOX 2
//The reaction procs must ALWAYS set src = null, this detaches the proc from the object (the reagent)
//so that it can continue working when the reagent is deleted while the proc is still active.
@@ -72,7 +76,7 @@ datum
src = null
return
on_mob_life(var/mob/living/M as mob)
on_mob_life(var/mob/living/M as mob, var/alien)
if(!istype(M, /mob/living))
return //Noticed runtime errors from pacid trying to damage ghosts, this should fix. --NEO
// Certain elements in too large amounts cause side-effects
@@ -557,10 +561,15 @@ datum
reagent_state = LIQUID
color = "#0000FF" // rgb: 0, 0, 255
on_mob_life(var/mob/living/M as mob)
on_mob_life(var/mob/living/M as mob, var/alien)
if(!M) M = holder.my_atom
if(M.losebreath >= 10)
M.losebreath = max(10, M.losebreath-5)
if(alien && alien == IS_VOX)
M.adjustToxLoss(REAGENTS_METABOLISM)
else
if(M.losebreath >= 10)
M.losebreath = max(10, M.losebreath-5)
holder.remove_reagent(src.id, 0.5 * REAGENTS_METABOLISM)
return
@@ -688,6 +697,14 @@ datum
custom_metabolism = 0.01
on_mob_life(var/mob/living/M as mob, var/alien)
if(M.stat == 2) return
if(alien && alien == IS_VOX)
M.adjustToxLoss(REAGENTS_METABOLISM)
holder.remove_reagent(src.id, REAGENTS_METABOLISM) //By default it slowly disappears.
return
..()
copper
name = "Copper"
id = "copper"
@@ -707,6 +724,14 @@ datum
mildly_toxic = 1
custom_metabolism = 0.01
on_mob_life(var/mob/living/M as mob, var/alien)
if(M.stat == 2) return
if(alien && alien == IS_VOX)
M.adjustOxyLoss(-2*REM)
holder.remove_reagent(src.id, REAGENTS_METABOLISM) //By default it slowly disappears.
return
..()
hydrogen
name = "Hydrogen"
id = "hydrogen"
@@ -1486,6 +1511,7 @@ datum
if(M.stat == 2.0)
return
if(!M) M = holder.my_atom
//This needs a diona check but if one is added they won't be able to heal burn damage at all.
M.heal_organ_damage(0,2*REM)
..()
return
@@ -1497,11 +1523,12 @@ datum
reagent_state = LIQUID
color = "#F4A460" // rgb: 244, 164, 96
on_mob_life(var/mob/living/M as mob)
on_mob_life(var/mob/living/M as mob, var/alien)
if(M.stat == 2.0) //THE GUY IS **DEAD**! BEREFT OF ALL LIFE HE RESTS IN PEACE etc etc. He does NOT metabolise shit anymore, god DAMN
return
if(!M) M = holder.my_atom
M.heal_organ_damage(0,3*REM)
if(alien && alien != IS_DIONA)
M.heal_organ_damage(0,3*REM)
..()
return
@@ -1512,11 +1539,16 @@ datum
reagent_state = LIQUID
color = "#00CED1" // rgb: 0, 206, 209
on_mob_life(var/mob/living/M as mob)
on_mob_life(var/mob/living/M as mob, var/alien)
if(M.stat == 2.0)
return //See above, down and around. --Agouri
if(!M) M = holder.my_atom
M.adjustOxyLoss(-2*REM)
if(alien && alien == IS_VOX)
M.adjustToxLoss(2*REM)
else if(alien && alien != IS_DIONA)
M.adjustOxyLoss(-2*REM)
if(holder.has_reagent("lexorin"))
holder.remove_reagent("lexorin", 2*REM)
..()
@@ -1529,11 +1561,16 @@ datum
reagent_state = LIQUID
color = "#00FFFF" // rgb: 0, 255, 255
on_mob_life(var/mob/living/M as mob)
on_mob_life(var/mob/living/M as mob, var/alien)
if(M.stat == 2.0)
return
if(!M) M = holder.my_atom
M.adjustOxyLoss(-M.getOxyLoss())
if(alien && alien == IS_VOX)
M.adjustOxyLoss()
else if(alien && alien != IS_DIONA)
M.adjustOxyLoss(-M.getOxyLoss())
if(holder.has_reagent("lexorin"))
holder.remove_reagent("lexorin", 2*REM)
..()
@@ -1546,14 +1583,32 @@ datum
reagent_state = LIQUID
color = "#DB7093" // rgb: 219, 112, 147
on_mob_life(var/mob/living/M as mob)
on_mob_life(var/mob/living/M as mob, var/alien)
if(M.stat == 2.0)
return
if(!M) M = holder.my_atom
if(M.getOxyLoss() && prob(80)) M.adjustOxyLoss(-1*REM)
if(M.getBruteLoss() && prob(80)) M.heal_organ_damage(1*REM,0)
if(M.getFireLoss() && prob(80)) M.heal_organ_damage(0,1*REM)
if(M.getToxLoss() && prob(80)) M.adjustToxLoss(-1*REM)
if(alien && alien != IS_DIONA)
if(M.getOxyLoss()) M.adjustOxyLoss(-1*REM)
if(M.getBruteLoss() && prob(80)) M.heal_organ_damage(1*REM,0)
if(M.getFireLoss() && prob(80)) M.heal_organ_damage(0,1*REM)
if(M.getToxLoss() && prob(80)) M.adjustToxLoss(-1*REM)
..()
return
anti_toxin
name = "Anti-Toxin (Dylovene)"
id = "anti_toxin"
description = "Dylovene is a broad-spectrum antitoxin."
reagent_state = LIQUID
color = "#C8A5DC" // rgb: 200, 165, 220
on_mob_life(var/mob/living/M as mob, var/alien)
if(!M) M = holder.my_atom
if(alien && alien != IS_DIONA)
M.reagents.remove_all_type(/datum/reagent/toxin, 1*REM, 0, 1)
M.drowsyness = max(M.drowsyness-2*REM, 0)
M.hallucination = max(0, M.hallucination - 5*REM)
M.adjustToxLoss(-2*REM)
..()
return
@@ -1775,11 +1830,12 @@ datum
reagent_state = LIQUID
color = "#FF003F" // rgb: 255, 0, 63
on_mob_life(var/mob/living/M as mob)
on_mob_life(var/mob/living/M as mob, var/alien)
if(M.stat == 2.0)
return
if(!M) M = holder.my_atom
M.heal_organ_damage(2*REM,0)
if(alien != IS_DIONA)
M.heal_organ_damage(2*REM,0)
..()
return