mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-10 23:54:14 +01:00
2618cffef3
## About The Pull Request To understand the PR we should first define what is micro dosing & volumetric dosing - **Micro dosing:** The reagent effects are **independent** of the volume of reagent metabolized and are constant every tick, so the effect you get from metabolizing 0.01u of a reagent is the same as metabolizing 1u of a reagent - **Volumetric dosing:** The reagent effects are **dependent** on the volume of reagent metabolized per tick, so the effect you get from metabolizing 0.01u is much lower compared to metabolizing 1u of a reagent which is much higher This PR replaces **micro dosing** with **volumetric dosing** so if you increase metabolization rates and absorb more reagents you get higher effects from that reagent & vice versa for lower metabolization rates. With that lets ask the core questions **How does this affect present reagent values?** _This PR scales all reagent effects such that even if it has a lower metabolization rate the value is the same as before but will still scale with reagent volumes & mob metabolization levels_ Under normal circumstances most reagents metabolize at 0.4u of reagent per tick so as long as this value isn't changed by cybernetic body parts or other reagents you will get the same values as before and won't notice anything different in normal gameplay. However, if you do get enhanced body parts like a cybernetic liver/stomach or use reagents with metabolization rates different from 0.4u you will now get more/less affects depending on how much reagent is consumed. Here is an example Consider Syriniver this is how the formulae look like. ```dm adjust_tox_loss(-1 * metabolization_ratio * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype) ``` as long as 0.4u of it is metabolized every tick you get 2 tox loss healing which is the same as before. However, this time if you metabolize 0.01u of the reagent you get only 0.1 tox loss healing. If you metabolize 1u reagent per tick, then you get 5 tox loss healing **What about cigarettes?** Unaffected. The amount of reagents injected into a mob per tick **does not** affect the rate at which it is metabolized. Even if you have like 10u of cigarette reagents within you, if you are metabolizing just 0.4u of it every tick then nothing changes ## Why It's Good For The Game - Volumetric dosing is realistic. If you metabolize more reagent you should be getting more benefits and lesser volumes should yield lesser affects - Microdosing is an exploit that should have been patched a long of time ago because it encourages people to put in minimal effort to produce just 0.01u of reagent to get maximum affects. This coupled with slower metabolization rates leads to unbalanced higher reagent effects for longer periods of time. - This PR address the core issue in #93991 which is heal all patches. Plumbing was gutted in an unnatural way by making the plumbing iv drip/output gate/pill press behave essentially as mini reaction chambers by filtering just 5 reagents. With this heal all patches are nerfed based on the number & now volume of reagents you can put in a patch, so its concern is addressed. If this does get merged, we can hopefully revert it and make plumbing great and behave like large factories again <img width="914" height="230" alt="Screenshot (532)" src="https://github.com/user-attachments/assets/96467fad-b32f-409a-a1e8-2a92b8ff6565" /> ## Changelog 🆑 fix: probability reagent affects scale correctly balance: reagent affects now scale with the volume of reagent metabolized meaning lower metabolization rates (from like cybernetic organs) yield lower effects & higher rates yield higher effects /🆑
117 lines
5.3 KiB
Plaintext
117 lines
5.3 KiB
Plaintext
#define DAMAGE_AMOUNT 20
|
|
#define SECONDS_PER_TICK SSmobs.wait / 10
|
|
|
|
/datum/unit_test/liver
|
|
abstract_type = /datum/unit_test/liver
|
|
|
|
/datum/unit_test/liver/skeleton/Run()
|
|
// Pause natural mob life so it can be handled entirely by the test
|
|
SSmobs.pause()
|
|
|
|
var/mob/living/carbon/human/species/skeleton/mrbones = allocate(/mob/living/carbon/human/species/skeleton)
|
|
var/datum/reagent/toxin/bonehurtingjuice/bonehurting = /datum/reagent/toxin/bonehurtingjuice
|
|
var/datum/reagent/consumable/milk/calcium = /datum/reagent/consumable/milk
|
|
|
|
TEST_ASSERT(!isnull(mrbones.get_organ_by_type(/obj/item/organ/liver/bone)), "Skeleton does not have a bone liver")
|
|
TEST_ASSERT_EQUAL(mrbones.has_reagent(/datum/reagent/toxin/bonehurtingjuice), FALSE, "Skeleton somehow has bone hurting juice before drinking")
|
|
TEST_ASSERT_EQUAL(mrbones.has_reagent(/datum/reagent/consumable/milk), FALSE, "Skeleton somehow has milk before drinking")
|
|
|
|
// Test bone hurting juice reactions
|
|
|
|
mrbones.reagents.add_reagent(bonehurting, 40)
|
|
mrbones.Life(SSMOBS_DT)
|
|
var/expected_stamina_damage = (3.25 * SECONDS_PER_TICK)
|
|
var/expected_brute_damage = (0.25 * SECONDS_PER_TICK)
|
|
|
|
TEST_ASSERT_EQUAL(mrbones.get_stamina_loss(), expected_stamina_damage,
|
|
"Skeleton took [mrbones.get_stamina_loss() > expected_stamina_damage ? "more" : "less"] stamina damage than expected")
|
|
TEST_ASSERT_EQUAL(mrbones.get_brute_loss(), expected_brute_damage,
|
|
"Skeleton took [mrbones.get_brute_loss() > expected_brute_damage ? "more" : "less"] brute damage than expected")
|
|
|
|
mrbones.reagents.remove_all(mrbones.reagents.total_volume)
|
|
mrbones.fully_heal()
|
|
TEST_ASSERT_EQUAL(mrbones.get_stamina_loss(), 0, "Skeleton did not fully heal stamina damage")
|
|
TEST_ASSERT_EQUAL(mrbones.get_brute_loss(), 0, "Skeleton did not fully heal brute damage")
|
|
|
|
// Test milk reactions
|
|
|
|
mrbones.reagents.add_reagent(calcium, 51)
|
|
mrbones.Life(SSMOBS_DT)
|
|
TEST_ASSERT(mrbones.reagents.total_volume < 50, "Excess (>50u) milk did not leak out of skeleton")
|
|
mrbones.reagents.remove_all(mrbones.reagents.total_volume)
|
|
|
|
mrbones.apply_damage(DAMAGE_AMOUNT, def_zone = BODY_ZONE_CHEST)
|
|
var/list/obj/item/bodypart/damaged_parts = mrbones.get_damaged_bodyparts(brute = TRUE)
|
|
TEST_ASSERT(!isnull(damaged_parts), "Skeleton did not take any damage")
|
|
TEST_ASSERT(length(damaged_parts) == 1, "Skeleton took damage to more than one body part")
|
|
|
|
mrbones.reagents.add_reagent(calcium, 50)
|
|
mrbones.Life(SSMOBS_DT)
|
|
var/expected_remaining_damage = DAMAGE_AMOUNT - (1.25 * SECONDS_PER_TICK)
|
|
// Milk also heals brute on its own, so we may be more healed than expected
|
|
TEST_ASSERT(damaged_parts[1].brute_dam <= expected_remaining_damage,
|
|
"Milk did not heal the expected amount of damage (expected at least [expected_remaining_damage], got [damaged_parts[1].brute_dam])")
|
|
|
|
/datum/unit_test/liver/skeleton/Destroy()
|
|
SSmobs.ignite()
|
|
return ..()
|
|
|
|
// Plasmamen
|
|
/datum/unit_test/liver/plasmaman/Run()
|
|
// Pause natural mob life so it can be handled entirely by the test
|
|
SSmobs.pause()
|
|
|
|
var/mob/living/carbon/human/species/plasma/mrbones = allocate(/mob/living/carbon/human/species/plasma)
|
|
var/datum/reagent/toxin/plasma/plasma = /datum/reagent/toxin/plasma
|
|
var/datum/reagent/toxin/hot_ice/hot_ice = /datum/reagent/toxin/hot_ice
|
|
|
|
// Testing plasma/hot ice healing on wounds
|
|
|
|
TEST_ASSERT(!isnull(mrbones.get_organ_by_type(/obj/item/organ/liver/bone/plasmaman)), "Plasmaman does not have a plasmaman bone liver")
|
|
TEST_ASSERT_EQUAL(mrbones.has_reagent(plasma), FALSE, "Plasmaman somehow has plasma before drinking")
|
|
TEST_ASSERT_EQUAL(mrbones.has_reagent(hot_ice), FALSE, "Plasmaman somehow has hot ice before drinking")
|
|
|
|
var/obj/item/bodypart/r_arm = mrbones.get_bodypart(BODY_ZONE_R_ARM)
|
|
var/obj/item/bodypart/l_arm = mrbones.get_bodypart(BODY_ZONE_L_ARM)
|
|
var/expected_wound_healing = 2 * SECONDS_PER_TICK
|
|
|
|
// Test plasma
|
|
|
|
r_arm.receive_damage(WOUND_MINIMUM_DAMAGE, 0, wound_bonus = 100, sharpness = NONE)
|
|
TEST_ASSERT(length(mrbones.all_wounds), "Plasmaman did not receive a wound on their right arm")
|
|
|
|
mrbones.reagents.add_reagent(plasma, 50)
|
|
mrbones.Life(SSMOBS_DT)
|
|
var/datum/wound/afflicted_wound = mrbones.all_wounds[1]
|
|
TEST_ASSERT_EQUAL(afflicted_wound.cryo_progress, expected_wound_healing, "Plasma did not reduce wound on plasmaman")
|
|
|
|
mrbones.reagents.remove_all(mrbones.reagents.total_volume)
|
|
mrbones.fully_heal()
|
|
TEST_ASSERT(!length(r_arm.wounds), "Plasmaman did not fully heal wounds")
|
|
|
|
// Test hot ice
|
|
|
|
l_arm.receive_damage(WOUND_MINIMUM_DAMAGE, 0, wound_bonus = 100, sharpness = NONE)
|
|
TEST_ASSERT(length(mrbones.all_wounds), "Plasmaman did not receive a wound on their left arm")
|
|
|
|
afflicted_wound = mrbones.all_wounds[1]
|
|
mrbones.reagents.add_reagent(hot_ice, 50)
|
|
mrbones.Life(SSMOBS_DT)
|
|
TEST_ASSERT_EQUAL(afflicted_wound.cryo_progress, expected_wound_healing, "Hot ice did not reduce wound on plasmaman")
|
|
|
|
// Test gunpowder giving plasmamen hallucinations
|
|
|
|
var/datum/reagent/gunpowder/gunpowder = /datum/reagent/gunpowder
|
|
|
|
mrbones.reagents.add_reagent(gunpowder, 50)
|
|
mrbones.Life(SSMOBS_DT)
|
|
TEST_ASSERT(mrbones.has_status_effect(/datum/status_effect/drugginess), "Plasmaman did not get druggy status after consuming gunpowder")
|
|
TEST_ASSERT(mrbones.has_status_effect(/datum/status_effect/hallucination), "Plasmaman did not get hallucinating status after consuming gunpowder")
|
|
|
|
/datum/unit_test/liver/plasmaman/Destroy()
|
|
SSmobs.ignite()
|
|
return ..()
|
|
|
|
#undef DAMAGE_AMOUNT
|
|
#undef SECONDS_PER_TICK
|