Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Skies-Of-Blue committed Mar 6, 2024
1 parent 0a0f195 commit d05ab4f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
56 changes: 29 additions & 27 deletions code/modules/surgery/mechanic_steps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -172,33 +172,35 @@
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>")
if(!istype(tool, /obj/item/bodypart))
to_chat(user, "<span class='warning'>[tool] isn't a mechanical prosthesis!</span>")
return FALSE
var/obj/item/bodypart/BP = tool
if(ishuman(target))
if(IS_ORGANIC_LIMB(BP))
to_chat(user, "<span class='warning'>[BP] isn't a 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.
to_chat(user, "<span class='warning'>[tool] isn't the right type for [parse_zone(target_zone)].</span>")
return -1
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>")

/datum/surgery_step/add_prosthetic/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
. = ..()
if(istype(tool, /obj/item/bodypart) && user.temporarilyRemoveItemFromInventory(tool))
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>",
"<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>")
L.forceMove(target.loc)
return
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
return ..() //if for some reason we fail everything we'll print out some text okay?
if(HAS_TRAIT(tool, TRAIT_NODROP))
display_results(user, target, "<span class= 'warning'>The [tool] is stuck in your hand!</span>",
"<span class= 'warning'>The [tool] seems stuck to [user]'s hand!</span>",
"<span class= 'warning'>The [tool] seems stuck to [user]'s hand!</span>")
return FALSE
var/obj/item/bodypart/L = tool
if(!L.attach_limb(target))
display_results(user, target, "<span class='warning'>You fail to replace [target]'s [parse_zone(target_zone)]! Their body has rejected [L]!</span>",
"<span class='warning'>[user] fails to replace [target]'s [parse_zone(target_zone)]!</span>",
"<span class='warning'>[user] fails to replace [target]'s [parse_zone(target_zone)]!</span>")
return FALSE
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 ..()
6 changes: 4 additions & 2 deletions code/modules/surgery/mechanical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
requires_bodypart_type = BODYTYPE_ROBOTIC
lying_required = FALSE
self_operable = TRUE
ignore_clothes = TRUE

/datum/surgery/prosthesis_attachment
name = "Prosthesis attachment"
Expand All @@ -117,10 +118,11 @@
requires_bodypart_type = 0
lying_required = FALSE
self_operable = TRUE
ignore_clothes = TRUE

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

0 comments on commit d05ab4f

Please sign in to comment.