Fixes medical grippers not being usable in surgery (#26311)

* Fixes medical grippers not being usable in surgery

* Adds a new trait for tools that behave like an open hand  in surgery. uses that instead of a typecheck.
This commit is contained in:
Migratingcocofruit
2024-08-07 00:02:03 +00:00
committed by GitHub
parent 5c32524456
commit a0308e048a
4 changed files with 15 additions and 6 deletions
+3
View File
@@ -278,6 +278,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"
@@ -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
@@ -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
////////////////////////////////
@@ -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
////////////////////////////////
+2 -2
View File
@@ -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.
@@ -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)
+1 -3
View File
@@ -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)