Skip to content

Commit

Permalink
[MIRROR] Surgery fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelbassil authored and SuhEugene committed Nov 23, 2023
1 parent 3fd2457 commit c70eecd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
37 changes: 23 additions & 14 deletions code/game/objects/items/weapons/tools/weldingtool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -278,25 +278,34 @@
playsound(src, 'sound/items/welderdeactivate.ogg', 10, 1)
update_icon()

/obj/item/weldingtool/use_after(mob/living/M, mob/living/user)
if (ishuman(M))
var/target_zone = user.zone_sel.selecting
var/mob/living/carbon/human/H = M
var/obj/item/organ/external/S = H.organs_by_name[target_zone]
/obj/item/weldingtool/use_before(mob/living/target, mob/living/user, click_parameters)
if (!ishuman(target))
return FALSE

var/target_zone = user.zone_sel.selecting
var/mob/living/carbon/human/H = target
var/obj/item/organ/external/S = H.organs_by_name[target_zone]

if (!S || !BP_IS_ROBOTIC(S) || user.a_intent != I_HELP)
if (!S || !BP_IS_ROBOTIC(S) || user.a_intent != I_HELP)
return FALSE

var/list/all_surgeries = GET_SINGLETON_SUBTYPE_MAP(/singleton/surgery_step)
for (var/singleton in all_surgeries)
var/singleton/surgery_step/step = all_surgeries[singleton]
if (step.name && step.tool_quality(src) && step.can_use(user, H, target_zone, src))
return FALSE

if (BP_IS_BRITTLE(S))
to_chat(user, SPAN_WARNING("\The [M]'s [S.name] is hard and brittle - \the [src] cannot repair it."))
return TRUE
if (BP_IS_BRITTLE(S))
to_chat(user, SPAN_WARNING("\The [target]'s [S.name] is hard and brittle - \the [src] cannot repair it."))
return TRUE

if (!can_use(2, user, silent = TRUE)) //The surgery check above already returns can_use's feedback.
return TRUE

if (!can_use(2, user, "to patch the damage on [M]'s [S.name]"))
return TRUE
if (S.robo_repair(15, DAMAGE_BRUTE, "some dents", src, user))
remove_fuel(2, user)
return TRUE

if (S.robo_repair(15, DAMAGE_BRUTE, "some dents", src, user))
remove_fuel(2, user)
return TRUE
else return FALSE

/obj/item/weldingtool/IsFlameSource()
Expand Down
1 change: 1 addition & 0 deletions code/modules/surgery/bones.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
name = "Set bone"
allowed_tools = list(
/obj/item/bonesetter = 100,
/obj/item/swapper/power_drill = 100,
/obj/item/wrench = 75
)
min_duration = 60
Expand Down
1 change: 1 addition & 0 deletions code/modules/surgery/robotics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@
/singleton/surgery_step/robone/realign_support
name = "Realign support"
allowed_tools = list(
/obj/item/swapper/power_drill = 100,
/obj/item/wrench = 70,
/obj/item/bonesetter = 50
)
Expand Down

0 comments on commit c70eecd

Please sign in to comment.