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-25 23:21:26 +01:00
committed by GitHub
parent cf53b21d04
commit fc61d427bf
6 changed files with 42 additions and 43 deletions
+3 -3
View File
@@ -28,7 +28,7 @@
// Give them enough meth to be consumed in 2 metabolizations
pill.reagents.add_reagent(meth, 1.9 * initial(meth.metabolization_rate) * SSMOBS_DT)
pill.attack(user, user)
pill.interact_with_atom(user, user)
user.Life(SSMOBS_DT)
@@ -77,7 +77,7 @@
// Let's start with stomach metabolism
pill.reagents.add_reagent(meth.type, 5)
pill.attack(pill_user, pill_user)
pill.interact_with_atom(pill_user, pill_user)
// Set the metabolism efficiency to 1.0 so it transfers all reagents to the body in one go.
var/obj/item/organ/stomach/pill_belly = pill_user.get_organ_slot(ORGAN_SLOT_STOMACH)
@@ -105,7 +105,7 @@
// One half pill
pill_two.reagents.add_reagent(meth.type, (5 * 0.5) + 1)
pill_two.attack(pill_syringe_user, pill_syringe_user)
pill_two.interact_with_atom(pill_syringe_user, pill_syringe_user)
syringe.melee_attack_chain(pill_syringe_user, pill_syringe_user)
// Set the metabolism efficiency to 1.0 so it transfers all reagents to the body in one go.
+1 -1
View File
@@ -4,7 +4,7 @@
TEST_ASSERT_EQUAL(human.has_reagent(/datum/reagent/iron), FALSE, "Human somehow has iron before taking pill")
pill.attack(human, human)
pill.interact_with_atom(human, human)
human.Life(SSMOBS_DT)
TEST_ASSERT(human.has_reagent(/datum/reagent/iron), "Human doesn't have iron after taking pill")
@@ -50,7 +50,7 @@
TEST_ASSERT_EQUAL(human.health, 100, "Human health did not set properly")
patch.reagents.add_reagent(/datum/reagent/method_patch_test, 1)
patch.self_delay = 0
patch.attack(human, human)
patch.interact_with_atom(human, human)
TEST_ASSERT_EQUAL(human.health, 90, "Human health did not update after patch was applied")
// INJECT
+1 -1
View File
@@ -18,7 +18,7 @@
//Give them meth and let it kick in
pill.reagents.add_reagent(meth, 1.9 * initial(meth.metabolization_rate) * SSMOBS_DT)
pill.attack(human, human)
pill.interact_with_atom(human, human)
human.Life(SSMOBS_DT)
TEST_ASSERT(human.reagents.has_reagent(meth), "Human body does not have meth after life tick")