Skip to content

Commit

Permalink
TGS Test Merge (#6958)
Browse files Browse the repository at this point in the history
  • Loading branch information
lordme authored and lordme committed Jan 4, 2025
2 parents aa195a0 + 7f5e75d commit d73783b
Show file tree
Hide file tree
Showing 15 changed files with 185 additions and 88 deletions.
27 changes: 19 additions & 8 deletions code/game/machinery/computer/Operating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
ui_interact(user)
..()

/obj/machinery/computer/operating/ui_interact(mob/user, datum/tgui/ui = null)
/obj/machinery/computer/operating/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "OperatingComputer", "Patient Monitor")
Expand All @@ -63,7 +63,10 @@
/obj/machinery/computer/operating/ui_data(mob/user, datum/tgui/ui)
var/data[0]
var/mob/living/carbon/human/occupant
if(table)
if(!table)
data["table"] = 0
else
data["table"] = 1
occupant = table.victim
data["hasOccupant"] = occupant ? 1 : 0
var/occupantData[0]
Expand Down Expand Up @@ -119,9 +122,9 @@
occupantData["bloodPercent"] = round(100*(blood_volume/occupant.species.blood_volume), 0.01) //copy pasta ends here

occupantData["bloodType"] = occupant.dna.b_type
occupantData["surgery"] = build_surgery_list(user)
occupantData["procedures"] = build_surgery_list(user)

data["occupant"] = occupantData
data["patient"] = occupantData
data["verbose"]=verbose
data["oxyAlarm"]=oxyAlarm
data["choice"]=choice
Expand Down Expand Up @@ -302,7 +305,17 @@
*/
/obj/machinery/computer/operating/proc/find_next_steps(mob/user, zone)
. = list()
for(var/datum/surgery_step/S in get_surgery_steps_without_basetypes())
var/list/possible_next_steps = get_surgery_steps_without_basetypes()
// these steps prompt the player in can_use, don't call them every ui update
var/list/prompting_surgery_steps = list(
/datum/surgery_step/internal/detatch_organ,
/datum/surgery_step/internal/remove_organ,
/datum/surgery_step/internal/attach_organ,
/datum/surgery_step/internal/rip_organ,
)
for(var/datum/surgery_step/S in possible_next_steps)
if (S.type in prompting_surgery_steps)
continue
if(S.can_use(user, victim, zone, null) && S.is_valid_target(victim))
var/allowed_tools_by_name = list()
for(var/tool in S.allowed_tools)
Expand All @@ -311,6 +324,4 @@
continue
var/obj/tool_path = tool
allowed_tools_by_name += capitalize(initial(tool_path.name))
// Please for the love of all that is holy, someone make surgery steps
// have names so I don't have to do this stupid pretty_type shit.
. += "[pretty_type(S)]: [english_list(allowed_tools_by_name)]"
. += list(S.step_name = english_list(allowed_tools_by_name))
10 changes: 10 additions & 0 deletions code/modules/surgery/bones.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/glue_bone
step_name = "Glue bone"

allowed_tools = list(
/obj/item/surgical/bonegel = 100
)
Expand Down Expand Up @@ -50,6 +52,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/set_bone
step_name = "Set bone"

allowed_tools = list(
/obj/item/surgical/bonesetter = 100,
/obj/item/surgical/bonesetter_primitive = 60
Expand Down Expand Up @@ -95,6 +99,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/mend_skull
step_name = "Mend skull"

allowed_tools = list(
/obj/item/surgical/bonesetter = 100,
/obj/item/surgical/bonesetter_primitive = 60
Expand Down Expand Up @@ -135,6 +141,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/finish_bone
step_name = "Finish bone"

allowed_tools = list(
/obj/item/surgical/bonegel = 100
)
Expand Down Expand Up @@ -176,6 +184,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/clamp_bone
step_name = "Clamp bone"

allowed_tools = list(
/obj/item/surgical/bone_clamp = 100
)
Expand Down
12 changes: 12 additions & 0 deletions code/modules/surgery/encased.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/open_encased/saw
step_name = "Saw bones"

allowed_tools = list(
/obj/item/surgical/circular_saw = 100, \
/obj/item/surgical/saw_bronze = 75, \
Expand Down Expand Up @@ -70,6 +72,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/open_encased/retract
step_name = "Retract bones"

allowed_tools = list(
/obj/item/surgical/retractor = 100,
/obj/item/surgical/retractor_primitive = 75
Expand Down Expand Up @@ -124,6 +128,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/open_encased/close
step_name = "Close bones"

allowed_tools = list(
/obj/item/surgical/retractor = 100,
/obj/item/surgical/retractor_primitive = 75
Expand Down Expand Up @@ -183,6 +189,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/open_encased/mend
step_name = "Mend bones"

allowed_tools = list(
/obj/item/surgical/bonegel = 100
)
Expand Down Expand Up @@ -224,6 +232,8 @@
// Saw/Retractor/Gel Combi-open and close.
///////////////////////////////////////////////////////////////
/datum/surgery_step/open_encased/advancedsaw_open
step_name = "Divert bones"

allowed_tools = list(
/obj/item/surgical/circular_saw/manager = 100
)
Expand Down Expand Up @@ -273,6 +283,8 @@


/datum/surgery_step/open_encased/advancedsaw_mend
step_name = "Seal bones"

allowed_tools = list(
/obj/item/surgical/circular_saw/manager = 100
)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/surgery/external_repair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
//////////////////////////////////////////////////////////////////

/datum/surgery_step/repairflesh/scan_injury
step_name = "Scan injury"

allowed_tools = list(
/obj/item/healthanalyzer = 100,
/obj/item/atmos_analyzer = 10
Expand Down Expand Up @@ -80,6 +82,8 @@
//////////////////////////////////////////////////////////////////

/datum/surgery_step/repairflesh/repair_burns
step_name = "Reconstruct skin"

allowed_tools = list(
/obj/item/stack/medical/advanced/ointment = 100,
/obj/item/surgical/FixOVein = 100,
Expand Down Expand Up @@ -149,6 +153,8 @@
//////////////////////////////////////////////////////////////////

/datum/surgery_step/repairflesh/repair_brute
step_name = "Repair skin"

allowed_tools = list(
/obj/item/stack/medical/advanced/bruise_pack = 100,
/obj/item/surgical/cautery = 100,
Expand Down
8 changes: 8 additions & 0 deletions code/modules/surgery/face.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/generic/cut_face
step_name = "Cut face"

allowed_tools = list(
/obj/item/surgical/scalpel = 100, \
/obj/item/surgical/scalpel_primitive = 80, \
Expand Down Expand Up @@ -57,6 +59,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/face/mend_vocal
step_name = "Fix vocal cords"

allowed_tools = list(
/obj/item/surgical/hemostat = 100, \
/obj/item/stack/cable_coil = 75, \
Expand Down Expand Up @@ -90,6 +94,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/face/fix_face
step_name = "Fix face"

allowed_tools = list(
/obj/item/surgical/retractor = 100, \
/obj/item/surgical/retractor_primitive = 75, \
Expand Down Expand Up @@ -125,6 +131,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/face/cauterize
step_name = "Cauterize"

allowed_tools = list(
/obj/item/surgical/cautery = 100, \
/obj/item/clothing/mask/smokable/cigarette = 75, \
Expand Down
14 changes: 14 additions & 0 deletions code/modules/surgery/generic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/generic/cut_open
step_name = "Incise"

allowed_tools = list(
/obj/item/surgical/scalpel = 100,
/obj/item/surgical/scalpel_bronze = 90,
Expand Down Expand Up @@ -73,6 +75,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/generic/cut_with_laser
step_name = "Laser incision"

allowed_tools = list(
/obj/item/surgical/scalpel/laser3 = 95, \
/obj/item/surgical/scalpel/laser2 = 85, \
Expand Down Expand Up @@ -119,6 +123,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/generic/incision_manager
step_name = "Prepared incision"

allowed_tools = list(
/obj/item/surgical/scalpel/manager = 100,
)
Expand Down Expand Up @@ -165,6 +171,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/generic/clamp_bleeders
step_name = "Clamp bleeders"

allowed_tools = list(
/obj/item/surgical/hemostat = 100,
/obj/item/stack/cable_coil = 75,
Expand Down Expand Up @@ -205,6 +213,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/generic/retract_skin
step_name = "Retract skin"

allowed_tools = list(
/obj/item/surgical/retractor = 100,
/obj/item/surgical/retractor_primitive = 75,
Expand Down Expand Up @@ -266,6 +276,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/generic/cauterize
step_name = "Cauterize"

allowed_tools = list(
/obj/item/surgical/cautery = 100,
/obj/item/clothing/mask/smokable/cigarette = 75,
Expand Down Expand Up @@ -308,6 +320,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/generic/amputate
step_name = "Amputate limb"

allowed_tools = list(
/obj/item/surgical/circular_saw = 100,
/obj/item/material/knife/machete/hatchet = 75,
Expand Down
8 changes: 8 additions & 0 deletions code/modules/surgery/implant.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/cavity/make_space
step_name = "Prepare cavity"

allowed_tools = list(
/obj/item/surgical/surgicaldrill = 100,
/obj/item/pen = 75,
Expand Down Expand Up @@ -76,6 +78,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/cavity/close_space
step_name = "Seal cavity"

priority = 2
allowed_tools = list(
/obj/item/surgical/cautery = 100,
Expand Down Expand Up @@ -111,6 +115,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/cavity/place_item
step_name = "Implant item"

priority = 0
allowed_tools = list(/obj/item = 100)

Expand Down Expand Up @@ -168,6 +174,8 @@
update_icon()

/datum/surgery_step/cavity/implant_removal
step_name = "Remove implant"

allowed_tools = list(
/obj/item/surgical/hemostat = 100, \
/obj/item/surgical/hemostat_primitive = 50, \
Expand Down
8 changes: 8 additions & 0 deletions code/modules/surgery/limb_reattach.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/limb/attach
step_name = "Attach limb"

allowed_tools = list(/obj/item/organ/external = 100)

min_duration = 50
max_duration = 70

/datum/surgery_step/limb/attach/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if (!istype(tool, /obj/item/organ/external))
return 0
var/obj/item/organ/external/E = tool
var/obj/item/organ/external/P = target.organs_by_name[E.parent_organ]
var/obj/item/organ/external/affected = target.get_organ(target_zone)
Expand Down Expand Up @@ -73,6 +77,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/limb/connect
step_name = "Connect muscles"

allowed_tools = list(
/obj/item/surgical/hemostat = 100, \
/obj/item/stack/cable_coil = 75, \
Expand Down Expand Up @@ -113,6 +119,8 @@
///////////////////////////////////////////////////////////////

/datum/surgery_step/limb/mechanize
step_name = "Attach prosthetic"

allowed_tools = list(/obj/item/robot_parts = 100)

min_duration = 80
Expand Down
Loading

0 comments on commit d73783b

Please sign in to comment.