mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 01:49:19 +00:00
[MIRROR] Operating computers now display required surgery chems (#5701)
* Operating computers now display required surgery chems * Rebuilds tgui
This commit is contained in:
committed by
Poojawa
parent
5f6c41fa30
commit
2c5b8a586b
@@ -69,16 +69,21 @@
|
|||||||
data["procedures"] = list()
|
data["procedures"] = list()
|
||||||
for(var/datum/surgery/procedure in patient.surgeries)
|
for(var/datum/surgery/procedure in patient.surgeries)
|
||||||
var/datum/surgery_step/surgery_step = procedure.get_surgery_step()
|
var/datum/surgery_step/surgery_step = procedure.get_surgery_step()
|
||||||
|
var/chems_needed = surgery_step.get_chem_list()
|
||||||
var/alternative_step
|
var/alternative_step
|
||||||
|
var/alt_chems_needed = ""
|
||||||
if(surgery_step.repeatable)
|
if(surgery_step.repeatable)
|
||||||
var/datum/surgery_step/next_step = procedure.get_surgery_next_step()
|
var/datum/surgery_step/next_step = procedure.get_surgery_next_step()
|
||||||
if(next_step)
|
if(next_step)
|
||||||
alternative_step = capitalize(next_step.name)
|
alternative_step = capitalize(next_step.name)
|
||||||
|
alt_chems_needed = next_step.get_chem_list()
|
||||||
else
|
else
|
||||||
alternative_step = "Finish operation"
|
alternative_step = "Finish operation"
|
||||||
data["procedures"] += list(list(
|
data["procedures"] += list(list(
|
||||||
"name" = capitalize(procedure.name),
|
"name" = capitalize(procedure.name),
|
||||||
"next_step" = capitalize(surgery_step.name),
|
"next_step" = capitalize(surgery_step.name),
|
||||||
"alternative_step" = alternative_step
|
"chems_needed" = chems_needed,
|
||||||
|
"alternative_step" = alternative_step,
|
||||||
|
"alt_chems_needed" = alt_chems_needed
|
||||||
))
|
))
|
||||||
return data
|
return data
|
||||||
@@ -23,14 +23,13 @@
|
|||||||
name = "start bionecrosis"
|
name = "start bionecrosis"
|
||||||
implements = list(/obj/item/hemostat = 100, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15)
|
implements = list(/obj/item/hemostat = 100, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15)
|
||||||
time = 50
|
time = 50
|
||||||
|
chems_needed = list("zombiepowder", "rezadone")
|
||||||
|
require_all_chems = FALSE
|
||||||
|
|
||||||
/datum/surgery_step/bionecrosis/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
/datum/surgery_step/bionecrosis/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
||||||
user.visible_message("[user] begins to stimulate [target]'s brain.", "<span class='notice'>You begin to stimulate [target]'s brain...</span>")
|
user.visible_message("[user] begins to stimulate [target]'s brain.", "<span class='notice'>You begin to stimulate [target]'s brain...</span>")
|
||||||
|
|
||||||
/datum/surgery_step/bionecrosis/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
/datum/surgery_step/bionecrosis/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
||||||
if(!target.reagents.has_reagent("zombiepowder", 5) && !target.reagents.has_reagent("rezadone", 5))
|
|
||||||
user.visible_message("[target]'s brain seems unaffected.", "<span class='notice'>[target]'s body must be dosed with zombie powder or rezadone to complete the surgery!</span>")
|
|
||||||
return FALSE
|
|
||||||
user.visible_message("[user] successfully grows a necrotic tumor on [target]'s brain!", "<span class='notice'>You succeed in growing a necrotic tumor on [target]'s brain.</span>")
|
user.visible_message("[user] successfully grows a necrotic tumor on [target]'s brain!", "<span class='notice'>You succeed in growing a necrotic tumor on [target]'s brain.</span>")
|
||||||
if(!target.getorganslot(ORGAN_SLOT_ZOMBIE))
|
if(!target.getorganslot(ORGAN_SLOT_ZOMBIE))
|
||||||
var/obj/item/organ/zombie_infection/ZI = new()
|
var/obj/item/organ/zombie_infection/ZI = new()
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
name = "viral bond"
|
name = "viral bond"
|
||||||
implements = list(/obj/item/cautery = 100, TOOL_WELDER = 50, /obj/item = 30) // 30% success with any hot item.
|
implements = list(/obj/item/cautery = 100, TOOL_WELDER = 50, /obj/item = 30) // 30% success with any hot item.
|
||||||
time = 100
|
time = 100
|
||||||
|
chems_needed = list("spaceacillin","virusfood","formaldehyde")
|
||||||
|
|
||||||
/datum/surgery_step/viral_bond/tool_check(mob/user, obj/item/tool)
|
/datum/surgery_step/viral_bond/tool_check(mob/user, obj/item/tool)
|
||||||
if(implement_type == TOOL_WELDER || implement_type == /obj/item)
|
if(implement_type == TOOL_WELDER || implement_type == /obj/item)
|
||||||
@@ -36,9 +37,6 @@
|
|||||||
user.visible_message("[user] starts heating [target]'s bone marrow with [tool]...", "<span class='notice'>You start heating [target]'s bone marrow with [tool]...</span>")
|
user.visible_message("[user] starts heating [target]'s bone marrow with [tool]...", "<span class='notice'>You start heating [target]'s bone marrow with [tool]...</span>")
|
||||||
|
|
||||||
/datum/surgery_step/viral_bond/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
/datum/surgery_step/viral_bond/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
||||||
if(!target.reagents.has_reagent("spaceacillin", 5) || !target.reagents.has_reagent("virusfood", 5) || !target.reagents.has_reagent("formaldehyde", 5))
|
|
||||||
user.visible_message("[target]'s seems unaffected.", "<span class='notice'>[target]'s body must be dosed with spaceacillin, virus food and formaldehyde to complete the surgery!</span>")
|
|
||||||
return FALSE
|
|
||||||
user.visible_message("[target]'s bone marrow begins pulsing slowly.", "<span class='notice'>[target]'s bone marrow begins pulsing slowly. The viral bonding is complete.</span>")
|
user.visible_message("[target]'s bone marrow begins pulsing slowly.", "<span class='notice'>[target]'s bone marrow begins pulsing slowly. The viral bonding is complete.</span>")
|
||||||
for(var/X in target.viruses)
|
for(var/X in target.viruses)
|
||||||
var/datum/disease/D = X
|
var/datum/disease/D = X
|
||||||
|
|||||||
@@ -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_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/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/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)
|
/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
|
var/success = FALSE
|
||||||
@@ -77,7 +78,7 @@
|
|||||||
prob_chance = implements[implement_type]
|
prob_chance = implements[implement_type]
|
||||||
prob_chance *= surgery.get_propability_multiplier()
|
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))
|
if(success(user, target, target_zone, tool, surgery))
|
||||||
advance = 1
|
advance = 1
|
||||||
else
|
else
|
||||||
@@ -106,3 +107,29 @@
|
|||||||
|
|
||||||
/datum/surgery_step/proc/tool_check(mob/user, obj/item/tool)
|
/datum/surgery_step/proc/tool_check(mob/user, obj/item/tool)
|
||||||
return 1
|
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 ")
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -31,10 +31,16 @@
|
|||||||
<ui-subdisplay title='{{name}}'>
|
<ui-subdisplay title='{{name}}'>
|
||||||
<ui-section label='Next Step'>
|
<ui-section label='Next Step'>
|
||||||
<span class='content'>{{next_step}}</span>
|
<span class='content'>{{next_step}}</span>
|
||||||
|
{{#if chems_needed}}
|
||||||
|
<span class='content'><b>Required chemicals:</b><br> {{chems_needed}}</span>
|
||||||
|
{{/if}}
|
||||||
</ui-section>
|
</ui-section>
|
||||||
{{#if alternative_step}}
|
{{#if alternative_step}}
|
||||||
<ui-section label='Alternative Step'>
|
<ui-section label='Alternative Step'>
|
||||||
<span class='content'>{{alternative_step}}</span>
|
<span class='content'>{{alternative_step}}</span>
|
||||||
|
{{#if alt_chems_needed}}
|
||||||
|
<span class='content'><b>Required chemicals:</b><br> {{chems_needed}}</span>
|
||||||
|
{{/if}}
|
||||||
</ui-section>
|
</ui-section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ui-subdisplay>
|
</ui-subdisplay>
|
||||||
|
|||||||
Reference in New Issue
Block a user