[MIRROR] Operating computers now display required surgery chems (#5701)

* Operating computers now display required surgery chems

* Rebuilds tgui
This commit is contained in:
CitadelStationBot
2018-02-27 05:05:02 -06:00
committed by Poojawa
parent 5f6c41fa30
commit 2c5b8a586b
6 changed files with 49 additions and 14 deletions
+30 -3
View File
@@ -5,8 +5,9 @@
var/accept_hand = 0 //does the surgery step require an open hand? If true, ignores implements. Compatible with accept_any_item.
var/accept_any_item = 0 //does the surgery step accept any item? If true, ignores implements. Compatible with require_hand.
var/time = 10 //how long does the step take?
var/repeatable = 0 //does this step may be repeated? Make shure it isn't last step, or it used in surgery with `can_cancel = 1`. Or surgion will be stuck in the loop
var/repeatable = 0 //can this step be repeated? Make shure it isn't last step, or it used in surgery with `can_cancel = 1`. Or surgion will be stuck in the loop
var/list/chems_needed = list() //list of chems needed to complete the step. Even on success, the step will have no effect if there aren't the chems required in the mob.
var/require_all_chems = TRUE //any on the list or all on the list?
/datum/surgery_step/proc/try_op(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, try_to_fail = FALSE)
var/success = FALSE
@@ -77,7 +78,7 @@
prob_chance = implements[implement_type]
prob_chance *= surgery.get_propability_multiplier()
if((prob(prob_chance) || iscyborg(user)) && !try_to_fail)
if((prob(prob_chance) || iscyborg(user)) && chem_check(target) && !try_to_fail)
if(success(user, target, target_zone, tool, surgery))
advance = 1
else
@@ -106,3 +107,29 @@
/datum/surgery_step/proc/tool_check(mob/user, obj/item/tool)
return 1
/datum/surgery_step/proc/chem_check(mob/living/carbon/target)
if(!LAZYLEN(chems_needed))
return TRUE
if(require_all_chems)
. = TRUE
for(var/R in chems_needed)
if(!target.reagents.has_reagent(R))
return FALSE
else
. = FALSE
for(var/R in chems_needed)
if(target.reagents.has_reagent(R))
return TRUE
/datum/surgery_step/proc/get_chem_list()
if(!LAZYLEN(chems_needed))
return
var/list/chems = list()
for(var/R in chems_needed)
var/datum/reagent/temp = GLOB.chemical_reagents_list[R]
if(temp)
var/chemname = temp.name
chems += chemname
return english_list(chems, and_text = require_all_chems ? " and " : " or ")