Converts pills and patches into interact_with_atom (#88157)

## About The Pull Request

Title. Code maintenance, code sanity and because overriding attack()
like this is bad

## Changelog
🆑
code: Converted pills and patches into interact_with_atom
/🆑
This commit is contained in:
SmArtKar
2024-11-26 01:21:26 +03:00
committed by GitHub
parent cf53b21d04
commit fc61d427bf
6 changed files with 42 additions and 43 deletions
@@ -11,20 +11,21 @@
self_delay = 30 // three seconds
dissolvable = FALSE
/obj/item/reagent_containers/pill/patch/attack(mob/living/L, mob/user)
if(ishuman(L))
var/obj/item/bodypart/affecting = L.get_bodypart(check_zone(user.zone_selected))
if(!affecting)
to_chat(user, span_warning("The limb is missing!"))
return
if(!IS_ORGANIC_LIMB(affecting))
to_chat(user, span_notice("Medicine won't work on an inorganic limb!"))
return
..()
/obj/item/reagent_containers/pill/patch/canconsume(mob/eater, mob/user)
if(!iscarbon(eater))
return FALSE
if(!ishuman(eater))
return TRUE
var/mob/living/carbon/human/human_eater = eater
var/obj/item/bodypart/affecting = human_eater.get_bodypart(check_zone(user.zone_selected))
if(!affecting)
to_chat(user, span_warning("The limb is missing!"))
return FALSE
if(!IS_ORGANIC_LIMB(affecting))
to_chat(user, span_notice("Medicine won't work on an inorganic limb!"))
return FALSE
return TRUE // Masks were stopping people from "eating" patches. Thanks, inheritance.
/obj/item/reagent_containers/pill/patch/libital