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

Fixes medical grippers not being usable in surgery #26311

Merged
merged 2 commits into from
Aug 7, 2024
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
3 changes: 3 additions & 0 deletions code/__HELPERS/trait_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// An advanced surgical tool. If a surgical tool has this flag, it will be able to automatically repeat steps until they succeed.
#define TRAIT_ADVANCED_SURGICAL "advanced_surgical"

/// A surgical tool; If a surgical tool has this flag it can be used as an alternative to an open hand in surgery
#define TRAIT_SURGICAL_OPEN_HAND "surgical_hand_alternative"

/// Prevent mobs on the turf from being affected by anything below that turf, such as a pulse demon going under it. Added by a /obj/structure with creates_cover set to TRUE
#define TRAIT_TURF_COVERED "turf_covered"

Expand Down
10 changes: 9 additions & 1 deletion code/game/objects/items/robot/cyborg_gripper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
I.forceMove(src)
gripped_item = I
return

to_chat(user, "<span class='warning'>You hold your gripper over [target], but no matter how hard you try, you cannot make yourself grab it.</span>")
return

Expand Down Expand Up @@ -181,6 +181,10 @@
can_help_up = TRUE
can_hold_all_items = TRUE

/obj/item/gripper/universal/Initialize(mapload)
. = ..()
ADD_TRAIT(src,TRAIT_SURGICAL_OPEN_HAND, ROUNDSTART_TRAIT)

////////////////////////////////
// MARK: MEDICAL GRIPPER
////////////////////////////////
Expand All @@ -194,6 +198,10 @@
// REMOVE actions_types from here if you add a can_hold list for this gripper!
actions_types = list()

/obj/item/gripper/medical/Initialize(mapload)
. = ..()
ADD_TRAIT(src,TRAIT_SURGICAL_OPEN_HAND, ROUNDSTART_TRAIT)

////////////////////////////////
// MARK: SERVICE GRIPPER
////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions code/modules/surgery/abstract_steps.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
for(var/datum/surgery/S in branches_init)
first_step = S.get_surgery_step()

if(!tool && first_step.accept_hand)
if((!tool || HAS_TRAIT(tool, TRAIT_SURGICAL_OPEN_HAND)) && first_step.accept_hand)
if(SURGERY_TOOL_HAND in starting_tools)
CRASH("[src] was provided with multiple branches that allow an empty hand.")
next_surgery = S // if there's no tool, just proceed forward.
Expand Down Expand Up @@ -141,7 +141,7 @@
if((SURGERY_TOOL_ANY in starting_tools) && next_surgery_step.accept_any_item)
CRASH("[src] has a conflict with the next main step [next_surgery_step] in surgery [surgery]: both accept any item.")

if(!tool && next_surgery_step.accept_hand && !(SURGERY_TOOL_HAND in starting_tools))
if((!tool || HAS_TRAIT(tool, TRAIT_SURGICAL_OPEN_HAND)) && next_surgery_step.accept_hand && !(SURGERY_TOOL_HAND in starting_tools))
next_surgery = surgery

for(var/allowed in next_surgery_step.allowed_tools)
Expand Down
4 changes: 1 addition & 3 deletions code/modules/surgery/surgery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@

var/success = FALSE
if(accept_hand)
if(!tool)
success = TRUE
if(isrobot(user) && istype(tool, /obj/item/gripper/medical))
if(!tool || HAS_TRAIT(tool, TRAIT_SURGICAL_OPEN_HAND))
success = TRUE

if(accept_any_item)
Expand Down