Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion code/game/objects/items/tools/crowbar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 30)

/obj/item/crowbar/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/crowbar/suicide_act(mob/user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/tools/wrench.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 30)

/obj/item/wrench/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/wrench/suicide_act(mob/user)
Expand Down
19 changes: 9 additions & 10 deletions code/modules/surgery/helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
var/mob/living/carbon/C
var/obj/item/bodypart/affecting
var/selected_zone = user.zone_selected
if(user.a_intent == INTENT_HARM)
return FALSE

if(iscarbon(M))
C = M
Expand Down Expand Up @@ -48,30 +50,30 @@

if(!available_surgeries.len)
to_chat(user, span_warning("You can't preform any surgeries on [M]'s [parse_zone(selected_zone)]!"))
return
return TRUE

var/P = show_radial_menu(user, M, radial_list, radius = 40, require_near = TRUE, tooltips = TRUE)
if(P && user && user.Adjacent(M) && (I in user))
var/datum/surgery/S = available_surgeries[P]

for(var/datum/surgery/other in M.surgeries)
if(other.location == selected_zone)
return //during the input() another surgery was started at the same location.
return TRUE //during the input() another surgery was started at the same location.

//we check that the surgery is still doable after the input() wait.
if(C)
affecting = C.get_bodypart(check_zone(selected_zone))
if(affecting)
if(!S.requires_bodypart)
return
return TRUE
if(S.requires_bodypart_type && affecting.status != S.requires_bodypart_type)
return
return TRUE
else if(C && S.requires_bodypart)
return
return TRUE
if(S.lying_required && (M.mobility_flags & MOBILITY_STAND))
return
return TRUE
if(!S.can_start(user, M))
return
return TRUE

if(S.ignore_clothes || get_location_accessible(M, selected_zone))
var/datum/surgery/procedure = new S.type(M, selected_zone, affecting)
Expand All @@ -84,9 +86,6 @@
else
to_chat(user, span_warning("You need to expose [M]'s [parse_zone(selected_zone)] first!"))

else if(!current_surgery.step_in_progress)
attempt_cancel_surgery(current_surgery, I, M, user)

return TRUE

/proc/attempt_cancel_surgery(datum/surgery/S, obj/item/I, mob/living/M, mob/user)
Expand Down
16 changes: 8 additions & 8 deletions code/modules/surgery/tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
w_class = WEIGHT_CLASS_TINY

/obj/item/retractor/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/retractor/augment
Expand Down Expand Up @@ -49,7 +49,7 @@
attack_verb = list("attacked", "pinched")

/obj/item/hemostat/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/hemostat/augment
Expand Down Expand Up @@ -86,7 +86,7 @@
attack_verb = list("burnt")

/obj/item/cautery/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/cautery/augment
Expand Down Expand Up @@ -135,7 +135,7 @@
return (MANUAL_SUICIDE)

/obj/item/surgicaldrill/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/surgicaldrill/augment
Expand Down Expand Up @@ -180,7 +180,7 @@
AddComponent(/datum/component/butchering, 80 * toolspeed, 100, 0)

/obj/item/scalpel/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/scalpel/augment
Expand Down Expand Up @@ -239,7 +239,7 @@
AddComponent(/datum/component/butchering, 40 * toolspeed, 100, 5, 'sound/weapons/circsawhit.ogg') //saws are very accurate and fast at butchering

/obj/item/circular_saw/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/circular_saw/augment
Expand Down Expand Up @@ -279,7 +279,7 @@
attack_verb = list("corrected", "properly set")

/obj/item/bonesetter/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/bonesetter/bone
Expand All @@ -301,7 +301,7 @@
attack_verb = list("slapped")

/obj/item/surgical_drapes/attack(mob/living/M, mob/user)
if(user.a_intent == INTENT_HARM || !attempt_initiate_surgery(src, M, user))
if(!attempt_initiate_surgery(src, M, user))
..()

/obj/item/surgical_drapes/goliath
Expand Down