Skip to content

Commit

Permalink
GLOBAL LISTS FIGURED OUT WOOOOOOOOOOOOOOO
Browse files Browse the repository at this point in the history
AND PROSTHETICS SURGERY STILL ISN'T FINISHED YET HAHAHA DYING
  • Loading branch information
XxNinMario64xX committed Mar 10, 2024
1 parent ec309dd commit bdf3d5d
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 12 deletions.
27 changes: 27 additions & 0 deletions code/_globalvars/lists/surgery.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
GLOBAL_LIST_INIT(all_body_zones, list(
BODY_ZONE_HEAD = "head",
BODY_ZONE_CHEST = "chest",
BODY_ZONE_L_ARM = "l_arm",
BODY_ZONE_R_ARM = "r_arm",
BODY_ZONE_L_LEG = "l_leg",
BODY_ZONE_R_LEG = "r_leg",
BODY_ZONE_PRECISE_EYES = "eyes",
BODY_ZONE_PRECISE_MOUTH = "mouth",
BODY_ZONE_PRECISE_GROIN = "groin"
))
GLOBAL_LIST_INIT(broad_body_zones, list(
BODY_ZONE_HEAD = "head",
BODY_ZONE_CHEST = "chest",
BODY_ZONE_L_ARM = "l_arm",
BODY_ZONE_R_ARM = "r_arm",
BODY_ZONE_L_LEG = "l_leg",
BODY_ZONE_R_LEG = "r_leg",
BODY_ZONE_PRECISE_EYES = "eyes",
BODY_ZONE_PRECISE_MOUTH = "mouth",
BODY_ZONE_PRECISE_GROIN = "groin"
))
GLOBAL_LIST_INIT(precise_body_zones, list(
BODY_ZONE_PRECISE_EYES = "eyes",
BODY_ZONE_PRECISE_MOUTH = "mouth",
BODY_ZONE_PRECISE_GROIN = "groin"
))
64 changes: 64 additions & 0 deletions code/modules/surgery/omnisurgery/omni_dental_implant.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/datum/surgery_step/omni/drill_tooth
name = "Drill Tooth"
implements = list(
TOOL_DRILL = 100
)
valid_locations = list(BODY_ZONE_PRECISE_MOUTH)
required_layer = list(1)
show = TRUE
time = 16

// Ensure last surgery wasn't drill tooth. Otherwise you could infinitely drill holes into someone's mouth.
/datum/surgery_step/omni/drill_tooth/test_op(mob/user, mob/living/target, datum/surgery/omni/surgery)
if(!istype(surgery.last_step,/datum/surgery_step/omni/drill_tooth))
return TRUE
return FALSE

/datum/surgery_step/omni/implant_pill
name = "Implant Pill"
implements = list(
/obj/item/reagent_containers/pill = 100)
valid_locations = list(BODY_ZONE_PRECISE_MOUTH)
required_layer = list(1)
time = 16
experience_given = (MEDICAL_SKILL_MEDIUM*0.4) //quick to do

// Ensure last surgery wasn't to implant the pill to ensure you can't keep looping pills into the same tooth infinitely
/datum/surgery_step/omni/implant_pill/test_op(mob/user, mob/living/target, datum/surgery/omni/surgery)
if(!istype(surgery.last_step,/datum/surgery_step/omni/implant_pill))
return TRUE
return FALSE

/datum/surgery_step/omni/implant_pill/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(user, target, "<span class='notice'>You begin to wedge [tool] in [target]'s [parse_zone(target_zone)]...</span>",
"<span class='notice'>[user] begins to wedge \the [tool] in [target]'s [parse_zone(target_zone)].</span>",
"<span class='notice'>[user] begins to wedge something in [target]'s [parse_zone(target_zone)].</span>")

/datum/surgery_step/omni/implant_pill/success(mob/user, mob/living/carbon/target, target_zone, obj/item/reagent_containers/pill/tool, datum/surgery/surgery, default_display_results = FALSE)
if(!istype(tool))
return 0

user.transferItemToLoc(tool, target, TRUE)

var/datum/action/item_action/hands_free/activate_pill/P = new(tool)
P.button.name = "Activate [tool.name]"
P.target = tool
P.Grant(target) //The pill never actually goes in an inventory slot, so the owner doesn't inherit actions from it

display_results(user, target, "<span class='notice'>You wedge [tool] into [target]'s [parse_zone(target_zone)].</span>",
"<span class='notice'>[user] wedges \the [tool] into [target]'s [parse_zone(target_zone)]!</span>",
"<span class='notice'>[user] wedges something into [target]'s [parse_zone(target_zone)]!</span>")
return ..()

/datum/action/item_action/hands_free/activate_pill
name = "Activate Pill"

/datum/action/item_action/hands_free/activate_pill/Trigger()
if(!..())
return FALSE
to_chat(owner, "<span class='notice'>You grit your teeth and burst the implanted [target.name]!</span>")
log_combat(owner, null, "swallowed an implanted pill", target)
if(target.reagents.total_volume)
target.reagents.trans_to(owner, target.reagents.total_volume, transfered_by = owner, method = INGEST)
qdel(target)
return TRUE
4 changes: 3 additions & 1 deletion code/modules/surgery/omnisurgery/omni_movelayer.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Assume surgeries with no valid_locations in this file can be done at any location

Check failure on line 1 in code/modules/surgery/omnisurgery/omni_movelayer.dm

View workflow job for this annotation

GitHub Actions / Run Linters

Check Regex

superflous whitespace added to here, remove or update check_regex.yml

// [Going Down Layers]
/datum/surgery_step/omni/skindown
name = "Dermal Incision"
Expand All @@ -11,7 +13,7 @@

/datum/surgery_step/omni/skindown/test_op(mob/user, mob/living/target, datum/surgery/omni/surgery)
var/mob/living/carbon/C = target
if(!C.get_bodypart(user.zone_selected)) //You can't do surgery on air; I'm sorry
if(!C.get_bodypart(user.zone_selected) && !(user.zone_selected in GLOB.precise_body_zones)) //You can't do surgery on air; sorry
return FALSE
return TRUE

Expand Down
19 changes: 10 additions & 9 deletions code/modules/surgery/omnisurgery/omni_prosthetic_replacement.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@

/datum/surgery_step/omni/prosthetic_replacement/test_op(mob/user, mob/living/carbon/target)
if(!iscarbon(target))
return FALSE
var/mob/living/carbon/C = target
if(!C.get_bodypart(user.zone_selected)) //can only start if limb is missing
return TRUE
return FALSE

/datum/surgery_step/omni/add_prosthetic
name = "add prosthetic"
implements = list(
Expand All @@ -7,19 +16,11 @@
/obj/item/melee/synthetic_arm_blade = 100)
time = 32
experience_given = MEDICAL_SKILL_ORGAN_FIX //won't get full XP if rejected
valid_locations = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD)
valid_locations = GLOB.broad_body_zones
show = TRUE
required_layer = list(0)
var/organ_rejection_dam = 0

/datum/surgery_step/omni/prosthetic_replacement/test_op(mob/user, mob/living/carbon/target)
if(!iscarbon(target))
return FALSE
var/mob/living/carbon/C = target
if(!C.get_bodypart(user.zone_selected)) //can only start if limb is missing
return TRUE
return FALSE

/datum/surgery_step/omni/add_prosthetic/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(istype(tool, /obj/item/organ_storage))
if(!tool.contents.len)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/omnisurgery/omnisurgery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
status = 1
steps = list() //We ballin
target_mobtypes = list(/mob/living/carbon/human) //Acceptable Species
possible_locs = list(BODY_ZONE_CHEST,BODY_ZONE_HEAD,BODY_ZONE_L_ARM,BODY_ZONE_L_LEG,BODY_ZONE_R_ARM,BODY_ZONE_R_LEG)
possible_locs = GLOB.all_body_zones
speed_modifier = 1 //Step speed modifier
var/atlayer = 0 // 0/1/2 skin/muscle/bone
var/datum/surgery_step/omni/last_step //The last step preformed in the surgery
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/omnisurgery/omnisurgery_step.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/datum/surgery_step/omni
var/list/required_layer = list(0,1,2) //What layers can this step be preformed at?
var/list/valid_locations = list(BODY_ZONE_CHEST,BODY_ZONE_HEAD,BODY_ZONE_L_ARM,BODY_ZONE_L_LEG,BODY_ZONE_R_ARM,BODY_ZONE_R_LEG) //List of all places this step can be preformed
var/list/valid_locations = list(BODY_ZONE_CHEST,BODY_ZONE_HEAD,BODY_ZONE_L_ARM,BODY_ZONE_L_LEG,BODY_ZONE_R_ARM,BODY_ZONE_R_LEG,BODY_ZONE_PRECISE_EYES,BODY_ZONE_PRECISE_GROIN,BODY_ZONE_PRECISE_MOUTH) //List of all places this step can be preformed
var/show = FALSE //if false, isn't considered a 'valid' step, and cant be preformed. Used for 'base' step
var/radial_icon = null // If not null, is the image for the radial

Expand Down
2 changes: 2 additions & 0 deletions shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
#include "code\_globalvars\lists\names.dm"
#include "code\_globalvars\lists\objects.dm"
#include "code\_globalvars\lists\poll_ignore.dm"
#include "code\_globalvars\lists\surgery.dm"
#include "code\_globalvars\lists\typecache.dm"
#include "code\_js\byjax.dm"
#include "code\_js\menus.dm"
Expand Down Expand Up @@ -3366,6 +3367,7 @@
#include "code\modules\surgery\omnisurgery\omni_amputation.dm"
#include "code\modules\surgery\omnisurgery\omni_bone_repair.dm"
#include "code\modules\surgery\omnisurgery\omni_coronary_bypass.dm"
#include "code\modules\surgery\omnisurgery\omni_dental_implant.dm"
#include "code\modules\surgery\omnisurgery\omni_gastrectomy.dm"
#include "code\modules\surgery\omnisurgery\omni_healing.dm"
#include "code\modules\surgery\omnisurgery\omni_hepatectomy.dm"
Expand Down

0 comments on commit bdf3d5d

Please sign in to comment.