Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prosthesis Changes & Mechanical Surgery Tweaks #2804

Merged
merged 5 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/modules/surgery/implant_removal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@
/datum/surgery_step/mechanic_unwrench,
/datum/surgery_step/extract_implant,
/datum/surgery_step/mechanic_wrench,
/datum/surgery_step/close_hatch,
/datum/surgery_step/mechanic_close)
1 change: 1 addition & 0 deletions code/modules/surgery/ipc_revive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/datum/surgery_step/open_hatch,
/datum/surgery_step/prepare_electronics,
/datum/surgery_step/revive/ipc,
/datum/surgery_step/close_hatch,
/datum/surgery_step/mechanic_close
)
possible_locs = list(BODY_ZONE_CHEST)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
/datum/surgery/prosthetic_replacement
name = "Prosthetic replacement"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/add_prosthetic)
// Formerly prosthetic_replacement.dm

/datum/surgery/limb_grafting
name = "Limb grafting"
steps = list(/datum/surgery_step/incise, /datum/surgery_step/clamp_bleeders, /datum/surgery_step/retract_skin, /datum/surgery_step/graft_limb)
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD)
requires_bodypart = FALSE //need a missing limb
requires_bodypart_type = 0

/datum/surgery/prosthetic_replacement/can_start(mob/user, mob/living/carbon/target)
/datum/surgery/limb_grafting/can_start(mob/user, mob/living/carbon/target)
if(!iscarbon(target))
return 0
var/mob/living/carbon/C = target
if(!C.get_bodypart(user.zone_selected)) //can only start if limb is missing
return 1

/datum/surgery_step/add_prosthetic
name = "add prosthetic"
/datum/surgery_step/graft_limb
name = "graft limb"
implements = list(
/obj/item/bodypart = 100,
/obj/item/organ_storage = 100,
/obj/item/chainsaw = 100,
/obj/item/melee/synthetic_arm_blade = 100)
/obj/item/organ_storage = 100)
// /obj/item/chainsaw = 100,
// /obj/item/melee/synthetic_arm_blade = 100)
// Frankly these have always bothered me. They fill like a bad fit for Shiptest.
// Marking out for now. Keeping the later code used to install unconventional prostheses just in case someone finds a good use for it.

time = 32
experience_given = MEDICAL_SKILL_ORGAN_FIX //won't get full XP if rejected
var/organ_rejection_dam = 0

/datum/surgery_step/add_prosthetic/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
/datum/surgery_step/graft_limb/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)
to_chat(user, "<span class='warning'>There is nothing inside [tool]!</span>")
Expand Down Expand Up @@ -65,7 +70,7 @@
to_chat(user, "<span class='warning'>[tool] must be installed onto an arm.</span>")
return -1

/datum/surgery_step/add_prosthetic/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
/datum/surgery_step/graft_limb/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
. = ..()
if(istype(tool, /obj/item/organ_storage))
tool.icon_state = initial(tool.icon_state)
Expand Down
90 changes: 90 additions & 0 deletions code/modules/surgery/mechanic_steps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,93 @@
display_results(user, target, "<span class='notice'>You begin to open the hatch holders in [target]'s [parse_zone(target_zone)]...</span>",
"<span class='notice'>[user] begins to open the hatch holders in [target]'s [parse_zone(target_zone)].</span>",
"<span class='notice'>[user] begins to open the hatch holders in [target]'s [parse_zone(target_zone)].</span>")

//close hatch

/datum/surgery_step/close_hatch
name = "close the hatch"
accept_hand = TRUE
time = 1 SECONDS
preop_sound = 'sound/machines/doorclick.ogg'
success_sound = 'sound/items/ratchet.ogg'

/datum/surgery_step/close_hatch/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 close the hatch holders in [target]'s [parse_zone(target_zone)]...</span>",
"<span class='notice'>[user] begins to close the hatch holders in [target]'s [parse_zone(target_zone)].</span>",
"<span class='notice'>[user] begins to close the hatch holders in [target]'s [parse_zone(target_zone)].</span>")

//manipulate organs (metal edition)
/datum/surgery_step/manipulate_organs/mechanic
name = "manipulate mechanical organs"
preop_sound = 'sound/surgery/organ2.ogg'
success_sound = 'sound/surgery/organ1.ogg'
implements_extract = list(
TOOL_HEMOSTAT = 55,
TOOL_CROWBAR = 100,
/obj/item/kitchen/fork = 35)

//prosthesis removal
/datum/surgery_step/prosthesis_removal
name = "detach prosthesis"
accept_hand = TRUE //once a prosthesis is unseated, it should be a simple matter of removing it without tools
implements = list(
TOOL_WRENCH = 100,
TOOL_CROWBAR = 100) //exists just in case you want to reflavor your prosthesis as something a little more integrated
time = 2.8 SECONDS
preop_sound = 'sound/items/ratchet.ogg'
success_sound = 'sound/machines/doorclick.ogg'

/datum/surgery_step/prosthesis_removal/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 unseat [target]'s [parse_zone(target_zone)]...</span>",
"<span class='notice'>[user] begins to unseat [target]'s [parse_zone(target_zone)]!</span>",
"<span class='notice'>[user] begins to unseat [target]'s [parse_zone(target_zone)]!</span>")

/datum/surgery_step/prosthesis_removal/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
var/mob/living/carbon/human/L = target
display_results(user, target, "<span class='notice'>You detach [L]'s [parse_zone(target_zone)].</span>",
"<span class='notice'>[user] detaches [L]'s [parse_zone(target_zone)]!</span>",
"<span class='notice'>[user] detaches [L]'s [parse_zone(target_zone)]!</span>")
if(surgery.operated_bodypart)
var/obj/item/bodypart/target_limb = surgery.operated_bodypart
target_limb.drop_limb()

//Add prosthetic
/datum/surgery_step/add_prosthetic
name = "add prosthetic"
implements = list(
/obj/item/bodypart = 100)
time = 32
experience_given = MEDICAL_SKILL_ORGAN_FIX //won't get full XP if rejected
var/organ_rejection_dam = 0

/datum/surgery_step/add_prosthetic/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(istype(tool, /obj/item/bodypart))
var/obj/item/bodypart/BP = tool
if(ishuman(target))
if(IS_ORGANIC_LIMB(BP))
to_chat(user, "<span class='warning'>[BP] isn't mechanical prosthesis!</span>")
return -1

if(target_zone == BP.body_zone) //so we can't replace a leg with an arm, or a human arm with a monkey arm.
display_results(user, target, "<span class='notice'>You begin to replace [target]'s [parse_zone(target_zone)] with [tool]...</span>",
"<span class='notice'>[user] begins to replace [target]'s [parse_zone(target_zone)] with [tool].</span>",
"<span class='notice'>[user] begins to replace [target]'s [parse_zone(target_zone)].</span>")
else
to_chat(user, "<span class='warning'>[tool] isn't the right type for [parse_zone(target_zone)].</span>")
return -1
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved

/datum/surgery_step/add_prosthetic/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
. = ..()
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved
if(istype(tool, /obj/item/bodypart) && user.temporarilyRemoveItemFromInventory(tool))
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved
var/obj/item/bodypart/L = tool
if(!L.attach_limb(target))
display_results(user, target, "<span class='warning'>You fail in replacing [target]'s [parse_zone(target_zone)]! Their body has rejected [L]!</span>",
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved
"<span class='warning'>[user] fails to replace [target]'s [parse_zone(target_zone)]!</span>",
"<span class='warning'>[user] fails to replaces [target]'s [parse_zone(target_zone)]!</span>")
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved
L.forceMove(target.loc)
return
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved
display_results(user, target, "<span class='notice'>You succeed in replacing [target]'s [parse_zone(target_zone)].</span>",
"<span class='notice'>[user] successfully replaces [target]'s [parse_zone(target_zone)] with [tool]!</span>",
"<span class='notice'>[user] successfully replaces [target]'s [parse_zone(target_zone)]!</span>")
return
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved
return ..() //if for some reason we fail everything we'll print out some text okay?
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved
25 changes: 25 additions & 0 deletions code/modules/surgery/mechanical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/datum/surgery_step/open_hatch,
/datum/surgery_step/prepare_electronics,
/datum/surgery_step/fix_brain,
/datum/surgery_step/close_hatch,
/datum/surgery_step/mechanic_close
)
lying_required = FALSE
Expand Down Expand Up @@ -99,3 +100,27 @@
L.electrocute_act(urdamageamt_burn, target)
target.take_bodypart_damage(urdamageamt_brute, urdamageamt_burn)
return FALSE

/datum/surgery/prosthesis_removal
name = "Detach prosthesis"
steps = list(/datum/surgery_step/mechanic_open, /datum/surgery_step/open_hatch, /datum/surgery_step/prepare_electronics, /datum/surgery_step/mechanic_unwrench, /datum/surgery_step/prosthesis_removal)
possible_locs = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD)
requires_bodypart_type = BODYTYPE_ROBOTIC
lying_required = FALSE
self_operable = TRUE

/datum/surgery/prosthesis_attachment
name = "Prosthesis attachment"
steps = list(/datum/surgery_step/mechanic_wrench, /datum/surgery_step/prepare_electronics, /datum/surgery_step/add_prosthetic, /datum/surgery_step/close_hatch, /datum/surgery_step/mechanic_close)
possible_locs = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_HEAD)
requires_bodypart = FALSE //need a missing limb
requires_bodypart_type = 0
lying_required = FALSE
self_operable = TRUE

/datum/surgery/prosthesis_attachment/can_start(mob/user, mob/living/carbon/target)
if(!iscarbon(target))
return 0
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved
var/mob/living/carbon/C = target
if(!C.get_bodypart(user.zone_selected)) //can only start if limb is missing
return 1
Skies-Of-Blue marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 4 additions & 2 deletions code/modules/surgery/organ_manipulation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@
/datum/surgery_step/open_hatch,
/datum/surgery_step/mechanic_unwrench,
/datum/surgery_step/prepare_electronics,
/datum/surgery_step/manipulate_organs,
/datum/surgery_step/manipulate_organs/mechanic,
/datum/surgery_step/mechanic_wrench,
/datum/surgery_step/close_hatch,
/datum/surgery_step/mechanic_close
)

Expand All @@ -60,7 +61,8 @@
/datum/surgery_step/mechanic_open,
/datum/surgery_step/open_hatch,
/datum/surgery_step/prepare_electronics,
/datum/surgery_step/manipulate_organs,
/datum/surgery_step/manipulate_organs/mechanic,
/datum/surgery_step/close_hatch,
/datum/surgery_step/mechanic_close
)

Expand Down
4 changes: 2 additions & 2 deletions shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,8 @@
#include "code\datums\votes\_vote_datum.dm"
#include "code\datums\votes\custom_vote.dm"
#include "code\datums\votes\restart_vote.dm"
#include "code\datums\weather\weather.dm"
#include "code\datums\votes\transfer_vote.dm"
#include "code\datums\weather\weather.dm"
#include "code\datums\weather\weather_controller.dm"
#include "code\datums\weather\weather_types\acid_rain.dm"
#include "code\datums\weather\weather_types\ash_storm.dm"
Expand Down Expand Up @@ -3325,13 +3325,13 @@
#include "code\modules\surgery\implant_removal.dm"
#include "code\modules\surgery\ipc_revive.dm"
#include "code\modules\surgery\limb_augmentation.dm"
#include "code\modules\surgery\limb_grafting.dm"
#include "code\modules\surgery\lobectomy.dm"
#include "code\modules\surgery\mechanic_steps.dm"
#include "code\modules\surgery\mechanical.dm"
#include "code\modules\surgery\organ_manipulation.dm"
#include "code\modules\surgery\organic_steps.dm"
#include "code\modules\surgery\plastic_surgery.dm"
#include "code\modules\surgery\prosthetic_replacement.dm"
#include "code\modules\surgery\remove_embedded_object.dm"
#include "code\modules\surgery\revival.dm"
#include "code\modules\surgery\stomachpump.dm"
Expand Down
Loading