Refactored code to use the reagent check_and_add proc

This commit is contained in:
alex-gh
2018-10-13 01:23:08 +02:00
parent 54858a45b6
commit d206760dc7
2 changed files with 6 additions and 5 deletions
@@ -736,7 +736,8 @@ Congratulations! You are now trained for invasive xenobiology research!"}
icon_state = "bed"
no_icon_updates = 1 //no icon updates for this; it's static.
injected_reagents = list("corazone","spaceacillin")
injected_target_amount = 31 //the patient needs at least 30u of spaceacillin to prevent necrotization.
reagent_target_amount = 31 //the patient needs at least 30u of spaceacillin to prevent necrotization.
inject_amount = 10
/obj/structure/closet/abductor
name = "alien locker"
+4 -4
View File
@@ -15,7 +15,8 @@
buckle_lying = 90
var/no_icon_updates = 0 //set this to 1 if you don't want the icons ever changing
var/list/injected_reagents = list()
var/injected_target_amount = 1
var/reagent_target_amount = 1
var/inject_amount = 1
/obj/machinery/optable/New()
..()
@@ -107,10 +108,9 @@
check_victim()
if(LAZYLEN(injected_reagents))
for(var/mob/living/carbon/C in get_turf(src))
var/datum/reagents/R = C.reagents
for(var/chemical in injected_reagents)
var/current_amount = C.reagents.get_reagent_amount(chemical)
if(current_amount < injected_target_amount)
C.reagents.add_reagent(chemical, injected_target_amount - current_amount)
R.check_and_add(chemical,reagent_target_amount,inject_amount)
/obj/machinery/optable/proc/take_victim(mob/living/carbon/C, mob/living/carbon/user as mob)
if(C == user)