Skip to content

Commit

Permalink
[MIRROR] Attack() refactor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelbassil authored and SuhEugene committed Sep 19, 2023
1 parent f62e710 commit fd1384a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
12 changes: 6 additions & 6 deletions code/game/objects/items/stacks/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
else
. = TRUE

///Clickon() with medical stacks will never go past attack() because this proc will never return FALSE. If needed, this is where to change it. Returns TRUE if handled and cannot progress.
/obj/item/stack/medical/attack(mob/living/carbon/M, mob/user)
. = FALSE
if (!istype(M))
Expand Down Expand Up @@ -179,11 +178,12 @@
if (..())
return TRUE

var/list/all_surgeries = GET_SINGLETON_SUBTYPE_MAP(/singleton/surgery_step)
for (var/singleton in all_surgeries)
var/singleton/surgery_step/S = all_surgeries[singleton]
if (S.name && S.tool_quality(src) && S.can_use(user, M, user.zone_sel.selecting, src))
return FALSE
if (check_possible_surgeries(M, user))
return FALSE

var/turf/T = get_turf(M)
if (locate(/obj/machinery/optable, T) && user.a_intent == I_HELP)
return FALSE

if (istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/stacks/nanopaste.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
if (istype(M,/mob/living/carbon/human)) //Repairing robolimbs
var/mob/living/carbon/human/H = M
var/obj/item/organ/external/S = H.get_organ(user.zone_sel.selecting)
if (check_possible_surgeries(M, user))
return FALSE

if(!S)
to_chat(user, SPAN_WARNING("\The [M] is missing that body part."))
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/weapons/material/coins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
attack_self(user)
return TRUE
if (ismob(target))
if (check_possible_surgeries(target, user))
return FALSE
if (user.a_intent == I_HURT)
user.visible_message(
SPAN_WARNING("\The [user] menaces \the [target] with \a [src]."),
Expand Down
8 changes: 5 additions & 3 deletions code/game/objects/items/weapons/tools/weldingtool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@
update_icon()

/obj/item/weldingtool/attack(mob/living/M, mob/living/user)
. = FALSE
if (ishuman(M))
var/target_zone = user.zone_sel.selecting
var/mob/living/carbon/human/H = M
Expand All @@ -290,6 +289,9 @@
if (!S || !BP_IS_ROBOTIC(S) || user.a_intent != I_HELP)
return FALSE

if (check_possible_surgeries(M, user))
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
Expand All @@ -300,8 +302,8 @@

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

return TRUE
else return FALSE

/obj/item/weldingtool/IsFlameSource()
return isOn()
Expand Down
1 change: 0 additions & 1 deletion code/modules/reagents/reagent_containers/glass/bottle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
amount_per_transfer_from_this = 10
possible_transfer_amounts = "5;10;15;25;30;60"
w_class = ITEM_SIZE_SMALL
item_flags = 0
obj_flags = 0
volume = 60

Expand Down
7 changes: 7 additions & 0 deletions code/modules/surgery/surgery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,10 @@ GLOBAL_LIST_INIT(surgery_tool_exception_cache, new)

/obj/item/stack/handle_post_surgery()
use(1)

/obj/item/proc/check_possible_surgeries(mob/living/carbon/M, mob/user)
var/list/all_surgeries = GET_SINGLETON_SUBTYPE_MAP(/singleton/surgery_step)
for (var/singleton in all_surgeries)
var/singleton/surgery_step/S = all_surgeries[singleton]
if (S.name && S.tool_quality(src) && S.can_use(user, M, user.zone_sel.selecting, src))
return TRUE

0 comments on commit fd1384a

Please sign in to comment.