From ee288e98b7fa99ff9c95a4f36f7be491a7c2379d Mon Sep 17 00:00:00 2001 From: GuillaumePrata <55374212+GuillaumePrata@users.noreply.github.com> Date: Tue, 7 Jun 2022 00:55:45 -0300 Subject: [PATCH] Clothing (as food for Moths) now only give temporary nourishment. (#67537) Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> --- code/__DEFINES/mobs.dm | 2 ++ code/modules/clothing/clothing.dm | 2 +- .../chemistry/reagents/food_reagents.dm | 22 ++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index a0a3045dedb..553aaf8ab6d 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -410,6 +410,8 @@ #define HUNGER_FACTOR 0.05 //factor at which mob nutrition decreases #define ETHEREAL_CHARGE_FACTOR 0.8 //factor at which ethereal's charge decreases per second +/// How much nutrition eating clothes as moth gives and drains +#define CLOTHING_NUTRITION_GAIN 15 #define REAGENTS_METABOLISM 0.2 //How many units of reagent are consumed per second, by default. #define REAGENTS_EFFECT_MULTIPLIER (REAGENTS_METABOLISM / 0.4) // By defining the effect multiplier this way, it'll exactly adjust all effects according to how they originally were with the 0.4 metabolism diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index dadc27cf2f7..423c4d2b2fc 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -82,7 +82,7 @@ // sigh, ok, so it's not ACTUALLY infinite nutrition. this is so you can eat clothes more than...once. // bite_consumption limits how much you actually get, and the take_damage in after eat makes sure you can't abuse this. // ...maybe this was a mistake after all. - food_reagents = list(/datum/reagent/consumable/nutriment = INFINITY) + food_reagents = list(/datum/reagent/consumable/nutriment/cloth_fibers = INFINITY) tastes = list("dust" = 1, "lint" = 1) foodtypes = CLOTH diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index 390ffab8426..a1d61f082c4 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -118,7 +118,7 @@ burn_heal = 1 /datum/reagent/consumable/nutriment/vitamin/on_mob_life(mob/living/carbon/M, delta_time, times_fired) - if(M.satiety < 600) + if(M.satiety < MAX_SATIETY) M.satiety += 30 * REM * delta_time . = ..() @@ -136,6 +136,26 @@ taste_description = "rich earthy pungent" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED +/datum/reagent/consumable/nutriment/cloth_fibers + name = "Cloth Fibers" + description = "It's not actually a form of nutriment but it does keep Mothpeople going for a short while..." + nutriment_factor = 30 * REAGENTS_METABOLISM + chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + brute_heal = 0 + burn_heal = 0 + ///Amount of satiety that will be drained when the cloth_fibers is fully metabolized + var/delayed_satiety_drain = 2 * CLOTHING_NUTRITION_GAIN + +/datum/reagent/consumable/nutriment/cloth_fibers/on_mob_life(mob/living/carbon/M, delta_time, times_fired) + if(M.satiety < MAX_SATIETY) + M.adjust_nutrition(CLOTHING_NUTRITION_GAIN) + delayed_satiety_drain += CLOTHING_NUTRITION_GAIN + return ..() + +/datum/reagent/consumable/nutriment/cloth_fibers/on_mob_delete(mob/living/carbon/M) + M.adjust_nutrition(-delayed_satiety_drain) + return ..() + /datum/reagent/consumable/cooking_oil name = "Cooking Oil" description = "A variety of cooking oil derived from fat or plants. Used in food preparation and frying."