Skip to content

Commit

Permalink
Fixed Null Tool Bug in Omnisurgery.dm
Browse files Browse the repository at this point in the history
Replaced Bone Repair surgery with Bonesetter and Bone Gel tools instead of using Hemostat
Updated Shiptest.dme
  • Loading branch information
XxNinMario64xX committed Mar 10, 2024
1 parent 11a2a20 commit 179331a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 7 deletions.
52 changes: 52 additions & 0 deletions code/modules/surgery/omnisurgery/omni_bone_repair.dm
Original file line number Diff line number Diff line change
@@ -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]...", "<span class='notice'>You begin to set [target]'s skull with [tool]...</span>")
else
user.visible_message("[user] begins to set the bones in [target]'s [parse_zone(target_zone)] with [tool]...", "<span class='notice'>You begin setting the bones in [target]'s [parse_zone(target_zone)] with [tool]...</span>")

/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)]!", "<span class='notice'>You successfully set the bones in [target]'s [parse_zone(target_zone)].</span>")
surgery.operated_bodypart.fix_bone()
return TRUE
13 changes: 7 additions & 6 deletions code/modules/surgery/omnisurgery/omnisurgery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 179331a

Please sign in to comment.