Fixes if() arguments in get_exact_dist().

Adds new procs for reagent checking.
This commit is contained in:
Shadowmech88
2017-01-26 23:57:52 -06:00
parent 72155495d9
commit ecda958a9f
3 changed files with 16 additions and 3 deletions

View File

@@ -1610,8 +1610,8 @@ Game Mode config tags:
/proc/get_exact_dist(atom/A, atom/B) //returns the coordinate distance between the coordinates of the turfs of A and B
var/turf/T1 = A
var/turf/T2 = B
if(!istype(A))
if(!istype(T1))
T1 = get_turf(A)
if(!istype(B))
if(!istype(T2))
T2 = get_turf(B)
return sqrt(((T2.x - T1.x) ** 2) + ((T2.y - T1.y) ** 2))

View File

@@ -495,7 +495,7 @@ Note that amputating the affected organ does in fact remove the infection from t
for(var/datum/wound/W in wounds)
//Internal wounds get worse over time. Low temperatures (cryo) stop them.
if(W.internal && !W.is_treated() && owner.bodytemperature >= 170 && !(owner.species && owner.species.anatomy_flags & NO_BLOOD))
if(!owner.reagents.has_reagent(BICARIDINE) && !owner.reagents.has_reagent(INAPROVALINE) && !owner.reagents.has_reagent(CLOTTING_AGENT) && !owner.reagents.has_reagent(BIOFOAM)) //Bicard, inaprovaline, clotting agent, and biofoam stop internal wounds from growing bigger with time, and also slow bleeding
if(!owner.reagents.has_any_reagents(list(BICARIDINE,INAPROVALINE,CLOTTING_AGENT,BIOFOAM))) //Bicard, inaprovaline, clotting agent, and biofoam stop internal wounds from growing bigger with time, and also slow bleeding
W.open_wound(0.1 * wound_update_accuracy)
owner.vessel.remove_reagent(BLOOD, 0.05 * W.damage * wound_update_accuracy)

View File

@@ -608,6 +608,19 @@ trans_to_atmos(var/datum/gas_mixture/target, var/amount=1, var/multiplier=1, var
return amount_cache[reagent] >= max(0,amount)
return 0
/datum/reagents/proc/has_any_reagents(var/list/input_reagents, var/amount = -1) //returns true if any of the input reagents are found
var/has = FALSE
for(var/i in input_reagents)
if(has_reagent(i, amount))
has = TRUE
return has
/datum/reagents/proc/has_all_reagents(var/list/input_reagents, var/amount = -1) //returns true if all of the input reagents are found
for(var/i in input_reagents)
if(!has_reagent(i, amount))
return FALSE
return TRUE
/datum/reagents/proc/get_reagent(var/reagent, var/amount = -1)
// SLOWWWWWWW
for(var/A in reagent_list)