From 179331afc9f0d8d14d2b4b15b50d61ef163c67b8 Mon Sep 17 00:00:00 2001 From: NinMario64 Date: Sat, 9 Mar 2024 22:34:56 -0500 Subject: [PATCH 1/2] Fixed Null Tool Bug in Omnisurgery.dm Replaced Bone Repair surgery with Bonesetter and Bone Gel tools instead of using Hemostat Updated Shiptest.dme --- .../surgery/omnisurgery/omni_bone_repair.dm | 52 +++++++++++++++++++ .../surgery/omnisurgery/omnisurgery.dm | 13 ++--- shiptest.dme | 2 +- 3 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 code/modules/surgery/omnisurgery/omni_bone_repair.dm diff --git a/code/modules/surgery/omnisurgery/omni_bone_repair.dm b/code/modules/surgery/omnisurgery/omni_bone_repair.dm new file mode 100644 index 000000000000..1073c4357248 --- /dev/null +++ b/code/modules/surgery/omnisurgery/omni_bone_repair.dm @@ -0,0 +1,52 @@ +/datum/surgery_step/omni/apply_bonegel + name = "Apply Bone Gel" + time = 6.4 SECONDS + implements = list( + TOOL_BONEGEL = 100 + ) + show = TRUE + preop_sound = 'sound/surgery/bone1.ogg' + success_sound = 'sound/surgery/bone3.ogg' + required_layer = list(2) + radial_icon = /obj/item/kinetic_crusher + +// Checks if the bone is broken or splinted and Apply Bonegel surgery wasn't done recently +/datum/surgery_step/omni/apply_bonegel/test_op(mob/user, mob/living/target, datum/surgery/omni/surgery) + if(istype(target,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = target + var/obj/item/bodypart/affected = H.get_bodypart(user.zone_selected) + if(affected && affected.bone_status >= BONE_FLAG_BROKEN && !istype(surgery.last_step,/datum/surgery_step/omni/apply_bonegel)) + return TRUE + return FALSE + +/datum/surgery_step/omni/set_bone + name = "Set Bone" + time = 6.4 SECONDS + implements = list( + TOOL_BONESETTER = 100 + ) + show = TRUE + preop_sound = 'sound/surgery/bone1.ogg' + success_sound = 'sound/surgery/bone3.ogg' + required_layer = list(2) + radial_icon = /obj/item/kinetic_crusher + +// Literally the same check as before to ensure we can even do this surgery unless the bone magically repaired itself somehow +/datum/surgery_step/omni/set_bone/test_op(mob/user, mob/living/target, datum/surgery/omni/surgery) + if(istype(target,/mob/living/carbon/human)) + var/mob/living/carbon/human/H = target + var/obj/item/bodypart/affected = H.get_bodypart(user.zone_selected) + if(affected && affected.bone_status >= BONE_FLAG_BROKEN && istype(surgery.last_step,/datum/surgery_step/omni/apply_bonegel)) + return TRUE + return FALSE + +/datum/surgery_step/omni/set_bone/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) + if(target_zone == BODY_ZONE_HEAD) + user.visible_message("[user] begins to set [target]'s skull with [tool]...", "You begin to set [target]'s skull with [tool]...") + else + user.visible_message("[user] begins to set the bones in [target]'s [parse_zone(target_zone)] with [tool]...", "You begin setting the bones in [target]'s [parse_zone(target_zone)] with [tool]...") + +/datum/surgery_step/omni/set_bone/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) + user.visible_message("[user] successfully sets the bones in [target]'s [parse_zone(target_zone)]!", "You successfully set the bones in [target]'s [parse_zone(target_zone)].") + surgery.operated_bodypart.fix_bone() + return TRUE diff --git a/code/modules/surgery/omnisurgery/omnisurgery.dm b/code/modules/surgery/omnisurgery/omnisurgery.dm index 9c95e5a0ed68..eb1d318d1214 100644 --- a/code/modules/surgery/omnisurgery/omnisurgery.dm +++ b/code/modules/surgery/omnisurgery/omnisurgery.dm @@ -54,12 +54,13 @@ if(!(Step.accept_any_item || Step.accept_hand)) var/good = FALSE for(var/obj in Step.implements) - if(istype(tool,obj)) - good = TRUE - break - if((tool.tool_behaviour in Step.implements) || (tool in Step.implements)) - good = TRUE - break + if(tool != null) + if(istype(tool,obj)) + good = TRUE + break + if((tool.tool_behaviour in Step.implements) || (tool in Step.implements)) + good = TRUE + break if (!good) continue if(!Step.test_op(user,target,src)) diff --git a/shiptest.dme b/shiptest.dme index 32781f87e877..f2d25230728b 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -3363,8 +3363,8 @@ #include "code\modules\surgery\bodyparts\species_parts\plasmaman_bodyparts.dm" #include "code\modules\surgery\bodyparts\species_parts\rachnid_bodyparts.dm" #include "code\modules\surgery\bodyparts\species_parts\vox_bodyparts.dm" -#include "code\modules\surgery\omnisurgery\bone_repair.dm" #include "code\modules\surgery\omnisurgery\omni_amputation.dm" +#include "code\modules\surgery\omnisurgery\omni_bone_repair.dm" #include "code\modules\surgery\omnisurgery\omni_coronary_bypass.dm" #include "code\modules\surgery\omnisurgery\omni_gastrectomy.dm" #include "code\modules\surgery\omnisurgery\omni_healing.dm" From 55c69aad1556c18b637fdecaf966aa9674f0de41 Mon Sep 17 00:00:00 2001 From: NinMario64 Date: Sat, 9 Mar 2024 22:37:52 -0500 Subject: [PATCH 2/2] Renamind this to omni_bone_repair.dm --- .../surgery/omnisurgery/bone_repair.dm | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 code/modules/surgery/omnisurgery/bone_repair.dm diff --git a/code/modules/surgery/omnisurgery/bone_repair.dm b/code/modules/surgery/omnisurgery/bone_repair.dm deleted file mode 100644 index 0b0d2ad26109..000000000000 --- a/code/modules/surgery/omnisurgery/bone_repair.dm +++ /dev/null @@ -1,22 +0,0 @@ -/datum/surgery_step/omni/set_bone - name = "set bone" - time = 6.4 SECONDS - implements = list( - TOOL_HEMOSTAT = 100, - TOOL_WRENCH = 40) - show = TRUE - preop_sound = 'sound/surgery/bone1.ogg' - success_sound = 'sound/surgery/bone3.ogg' - required_layer = list(2) - radial_icon = /obj/item/kinetic_crusher - -/datum/surgery_step/omni/set_bone/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - if(target_zone == BODY_ZONE_HEAD) - user.visible_message("[user] begins to set [target]'s skull with [tool]...", "You begin to set [target]'s skull with [tool]...") - else - user.visible_message("[user] begins to set the bones in [target]'s [parse_zone(target_zone)] with [tool]...", "You begin setting the bones in [target]'s [parse_zone(target_zone)] with [tool]...") - -/datum/surgery_step/omni/set_bone/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) - user.visible_message("[user] successfully sets the bones in [target]'s [parse_zone(target_zone)]!", "You successfully set the bones in [target]'s [parse_zone(target_zone)].") - surgery.operated_bodypart.fix_bone() - return TRUE