mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +01:00
Fixes a reagent exposure test flaky (#90053)
## About The Pull Request I'm highly confused as to A) why this was flaky B) how this even worked before, converted this to use proper healing/health adjustment methods, also incorrect feedback in inhalation tests ## Changelog Not player facing
This commit is contained in:
@@ -84,17 +84,15 @@
|
||||
//These procs fetch a cumulative total damage from all bodyparts
|
||||
/mob/living/carbon/getBruteLoss()
|
||||
var/amount = 0
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/BP = X
|
||||
amount += BP.brute_dam
|
||||
return amount
|
||||
for(var/obj/item/bodypart/bodypart as anything in bodyparts)
|
||||
amount += bodypart.brute_dam
|
||||
return round(amount, DAMAGE_PRECISION)
|
||||
|
||||
/mob/living/carbon/getFireLoss()
|
||||
var/amount = 0
|
||||
for(var/X in bodyparts)
|
||||
var/obj/item/bodypart/BP = X
|
||||
amount += BP.burn_dam
|
||||
return amount
|
||||
for(var/obj/item/bodypart/bodypart as anything in bodyparts)
|
||||
amount += bodypart.burn_dam
|
||||
return round(amount, DAMAGE_PRECISION)
|
||||
|
||||
/mob/living/carbon/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
||||
if(!can_adjust_brute_loss(amount, forced, required_bodytype))
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/datum/reagent/method_patch_test/expose_mob(mob/living/target, methods = PATCH, reac_volume, show_message = TRUE)
|
||||
. = ..()
|
||||
if(methods & PATCH)
|
||||
target.health = 90
|
||||
target.setBruteLoss(20)
|
||||
if(methods & INJECT)
|
||||
target.health = 80
|
||||
target.setBruteLoss(10)
|
||||
|
||||
/datum/unit_test/reagent_mob_expose/Run()
|
||||
// Life() is handled just by tests
|
||||
@@ -34,8 +34,8 @@
|
||||
TEST_ASSERT(human.fire_stacks < 0, "Human still has fire stacks after touching water")
|
||||
|
||||
// VAPOR
|
||||
human.fully_heal(ALL)
|
||||
TEST_ASSERT_NULL(human.has_status_effect(/datum/status_effect/drowsiness), "Human is drowsy at the start of testing")
|
||||
drink.reagents.clear_reagents()
|
||||
drink.reagents.add_reagent(/datum/reagent/nitrous_oxide, 10)
|
||||
drink.reagents.trans_to(human, 10, methods = VAPOR)
|
||||
TEST_ASSERT_NOTNULL(human.has_status_effect(/datum/status_effect/drowsiness), "Human is not drowsy after exposure to vapors")
|
||||
@@ -46,26 +46,26 @@
|
||||
TEST_ASSERT(human.fire_stacks < old_fire_stacks, "Human does not get wetter after being exposed to water by vapors")
|
||||
|
||||
// PATCH
|
||||
human.health = 100
|
||||
TEST_ASSERT_EQUAL(human.health, 100, "Human health did not set properly")
|
||||
human.fully_heal(ALL)
|
||||
TEST_ASSERT_EQUAL(human.getBruteLoss(), 0, "Human health did not set properly")
|
||||
patch.reagents.add_reagent(/datum/reagent/method_patch_test, 1)
|
||||
patch.self_delay = 0
|
||||
patch.interact_with_atom(human, human)
|
||||
patch.get_embed().process(SSdcs.wait / 10)
|
||||
human.Life(SSMOBS_DT)
|
||||
TEST_ASSERT_EQUAL(human.health, 90, "Human health did not update after patch was applied")
|
||||
TEST_ASSERT_EQUAL(human.getBruteLoss(), 20, "Human health did not update after patch was applied")
|
||||
|
||||
// INJECT
|
||||
syringe.reagents.add_reagent(/datum/reagent/method_patch_test, 1)
|
||||
syringe.melee_attack_chain(human, human)
|
||||
TEST_ASSERT_EQUAL(human.health, 80, "Human health did not update after injection from syringe")
|
||||
TEST_ASSERT_EQUAL(human.getBruteLoss(), 10, "Human health did not update after injection from syringe")
|
||||
|
||||
// INHALE
|
||||
TEST_ASSERT_NULL(human.has_status_effect(/datum/status_effect/hallucination), "Human is drowsy at the start of testing")
|
||||
drink.reagents.clear_reagents()
|
||||
human.fully_heal(ALL)
|
||||
TEST_ASSERT_NULL(human.has_status_effect(/datum/status_effect/hallucination), "Human is hallucinating at the start of testing")
|
||||
drink.reagents.add_reagent(/datum/reagent/nitrous_oxide, 10)
|
||||
drink.reagents.trans_to(human, 10, methods = INHALE)
|
||||
TEST_ASSERT_NOTNULL(human.has_status_effect(/datum/status_effect/hallucination), "Human is not drowsy after exposure to vapors")
|
||||
TEST_ASSERT_NOTNULL(human.has_status_effect(/datum/status_effect/hallucination), "Human is not hallucinating after exposure to vapors")
|
||||
|
||||
/datum/unit_test/reagent_mob_expose/Destroy()
|
||||
SSmobs.ignite()
|
||||
|
||||
Reference in New Issue
Block a user