From 8b3ee4ffe3a26b6ebbb393ddaba51e2ee1ed975e Mon Sep 17 00:00:00 2001
From: Pinta <124479862+deertools@users.noreply.github.com>
Date: Tue, 7 Feb 2023 21:02:19 -0500
Subject: [PATCH] wew
---
GainStation13/code/mechanics/fatness.dm | 50 ++++++++++++++++---
.../chemistry/reagents/consumable_reagents.dm | 4 +-
code/__DEFINES/traits.dm | 15 +++++-
.../diseases/advance/symptoms/weight.dm | 11 ++--
code/game/objects/structures/false_walls.dm | 5 +-
code/game/objects/structures/statues.dm | 6 +--
.../turfs/simulated/floor/mineral_floor.dm | 2 +-
.../turfs/simulated/wall/mineral_walls.dm | 5 +-
.../mob/living/carbon/carbon_movement.dm | 2 +-
.../mob/living/carbon/human/species.dm | 2 +-
code/modules/projectiles/guns/misc/fatbeam.dm | 1 +
.../chemistry/reagents/toxin_reagents.dm | 4 +-
12 files changed, 75 insertions(+), 32 deletions(-)
diff --git a/GainStation13/code/mechanics/fatness.dm b/GainStation13/code/mechanics/fatness.dm
index 69b590cc..1a59b334 100644
--- a/GainStation13/code/mechanics/fatness.dm
+++ b/GainStation13/code/mechanics/fatness.dm
@@ -1,17 +1,55 @@
#define MINIMUM_FATNESS_LEVEL = 0
+#define FATTENING_TYPE_ITEM 0
+#define FATTENING_TYPE_FOOD 1
+#define FATTENING_TYPE_CHEM 2
+#define FATTENING_TYPE_WEAPON 3
+#define FATTENING_TYPE_MAGIC 4
+#define FATTENING_TYPE_VIRUS 5
+#define FATTENING_TYPE_WEIGHT_LOSS 6
+
/mob/living/carbon
///What level of fatness is the parent mob at?
var/fatness = 0
///How full is the parent mob?
var/fullness = FULLNESS_LEVEL_HALF_FULL
+ ///At what rate does the parent mob gain weight? 1 = 100%
+ var/weight_gain_rate = 1
+ //At what rate does the parent mob lose weight? 1 = 100%
+ var/weight_loss_rate = 1
-///Adjusts the fatness level of the parent mob. Positive numbers increase fatness, negative numbers remove fatness.
-/mob/living/carbon/proc/adjust_fatness(adjustment_amount)
- if(!adjustment_amount)
+/**
+* Adjusts the fatness level of the parent mob.
+*
+* * adjustment_amount - adjusts how much weight is gained or loss. Positive numbers add weight.
+* * type_of_fattening - what type of fattening is being used. Look at the traits in fatness.dm for valid options.
+*/
+/mob/living/carbon/proc/adjust_fatness(adjustment_amount, type_of_fattening = FATTENING_TYPE_ITEM)
+ if(!adjustment_amount || !type_of_fattening)
return FALSE
-
- fatness += adjustment_amount
- fatness = max(adjustment_amount, MINIMUM_FATNESS_LEVEL) //It would be a little silly if someone got negative fat.
+
+ if(!HAS_TRAIT(src, TRAIT_UNIVERSAL_GAINER))
+ switch(type_of_fattening)
+ if(FATTENING_TYPE_ITEM && HAS_TRAIT(src, TRAIT_GAIN_ITEM_IMMUNE))
+ return FALSE
+ if(FATTENING_TYPE_FOOD && HAS_TRAIT(src, TRAIT_GAIN_FOOD_IMMUNE))
+ return FALSE
+ if(FATTENING_TYPE_CHEM && HAS_TRAIT(src, TRAIT_GAIN_CHEM_IMMUNE))
+ return FALSE
+ if(FATTENING_TYPE_WEAPON && HAS_TRAIT(src, TRAIT_GAIN_WEAPON_IMMUNE))
+ return FALSE
+ if(FATTENING_TYPE_MAGIC && HAS_TRAIT(src, TRAIT_GAIN_MAGIC_IMMUNE))
+ return FALSE
+ if(FATTENING_TYPE_WEIGHT_LOSS && HAS_TRAIT(src, TRAIT_WEIGHT_LOSS_IMMUNE))
+ return FALSE
+
+ var/amount_to_change = adjustment_amount
+ if(adjustment_amount > 0)
+ amount_to_change * weight_gain_rate
+ else
+ amount_to_change * weight_loss_rate
+
+ fatness += amount_to_change
+ fatness = max(fatness, MINIMUM_FATNESS_LEVEL) //It would be a little silly if someone got negative fat.
return TRUE
diff --git a/GainStation13/code/modules/reagents/chemistry/reagents/consumable_reagents.dm b/GainStation13/code/modules/reagents/chemistry/reagents/consumable_reagents.dm
index 28faf8d6..e77d7ed1 100644
--- a/GainStation13/code/modules/reagents/chemistry/reagents/consumable_reagents.dm
+++ b/GainStation13/code/modules/reagents/chemistry/reagents/consumable_reagents.dm
@@ -10,7 +10,5 @@
metabolization_rate = 0.5 * REAGENTS_METABOLISM
/datum/reagent/consumable/lipoifier/on_mob_life(mob/living/carbon/M)
- if(M && !HAS_TRAIT(M, TRAIT_LIPOIFIER_IMMUNE))
- M.fatness = M.fatness + 10
-
+ M.adjust_fatness(10, FATTENING_TYPE_CHEM)
return ..()
diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm
index 807c9255..273a56ff 100644
--- a/code/__DEFINES/traits.dm
+++ b/code/__DEFINES/traits.dm
@@ -180,7 +180,6 @@
#define TRAIT_PHOTOGRAPHER "photographer"
#define TRAIT_MUSICIAN "musician"
#define TRAIT_CROCRIN_IMMUNE "crocin_immune"
-#define TRAIT_LIPOIFIER_IMMUNE "lipoifier_immune"
#define TRAIT_NYMPHO "nymphomania"
#define TRAIT_DISTANT "headpat_hater"
//#define TRAIT_FLUID_LEAK "leaky_fluids" removed because milk snail trails are not okay
@@ -215,6 +214,20 @@
#define TRAIT_NO_TELEPORT "no-teleport" //you just can't
#define TRAIT_NO_ALCOHOL "alcohol_intolerance"
+//GS13
+
+//Weight gain immunity traits
+#define TRAIT_GAIN_FOOD_IMMUNE "food_gain_immune"
+#define TRAIT_GAIN_CHEM_IMMUNE "chem_gain_immune"
+#define TRAIT_GAIN_ITEM_IMMUNE "item_gain_immune"
+#define TRAIT_GAIN_WEAPON_IMMUNE "weapon_gain_immune"
+#define TRAIT_GAIN_MAGIC_IMMUNE "magic_gain_immune"
+#define TRAIT_GAIN_VIRUS_IMMUNE "virus_gain_immune"
+
+#define TRIAT_WEIGHT_LOSS_IMMUNE "weight_loss_immune"
+#define TRAIT_UNIVERSAL_GAINER "universal_gainer"
+
+
// common trait sources
#define TRAIT_GENERIC "generic"
#define EYE_DAMAGE "eye_damage"
diff --git a/code/datums/diseases/advance/symptoms/weight.dm b/code/datums/diseases/advance/symptoms/weight.dm
index 2479d2ab..4b267176 100644
--- a/code/datums/diseases/advance/symptoms/weight.dm
+++ b/code/datums/diseases/advance/symptoms/weight.dm
@@ -51,12 +51,9 @@ Bonus
to_chat(M, "[pick("So hungry...", "You'd kill someone for a bite of food...", "Hunger cramps seize you...")]")
M.overeatduration = max(M.overeatduration - 100, 0)
M.nutrition = max(M.nutrition - 100, 0)
- M.fatness = M.fatness - 30
-
-
+ M.adjust_fatness(-30, FATTENING_TYPE_WEIGHT_LOSS)
/datum/symptom/weight_gain
-
name = "Weight Gain"
desc = "The virus mutates and merges itself with the host's adipocytes, allowing them to perform a form of mitosis and replicate on their own."
stealth = -3
@@ -87,8 +84,8 @@ Bonus
else
to_chat(M, "[pick("You feel your body churn...", "You feel heavier...", "You hear an ominous gurgle from your belly...", "You feel bulkier...")]")
if(A.properties["transmittable"] >= 12) //get chunkier quicker
- M.fatness = M.fatness + 70
+ M.adjust_fatness(70, FATTENING_TYPE_VIRUS)
else if(A.properties["transmittable"] >= 7)
- M.fatness = M.fatness + 40
+ M.adjust_fatness(40, FATTENING_TYPE_VIRUS)
else
- M.fatness = M.fatness + 15
+ M.adjust_fatness(15, FATTENING_TYPE_VIRUS)
diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm
index 52267774..cd5083d5 100644
--- a/code/game/objects/structures/false_walls.dm
+++ b/code/game/objects/structures/false_walls.dm
@@ -279,10 +279,7 @@
if(world.time > last_event+15)
active = 1
for(var/mob/living/carbon/human/M in orange(3,src))
- if(HAS_TRAIT(M, TRAIT_LIPOIFIER_IMMUNE))
- return
- else
- M.fatness = M.fatness + 50
+ M.adjust_fatness(50, FATTENING_TYPE_ITEM)
last_event = world.time
active = null
return
diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm
index 264967d4..6448da98 100644
--- a/code/game/objects/structures/statues.dm
+++ b/code/game/objects/structures/statues.dm
@@ -363,7 +363,7 @@
if(HAS_TRAIT(M, TRAIT_LIPOIFIER_IMMUNE))
to_chat(M, "Nothing happens.")
else
- M.fatness = M.fatness + 20
+ M.adjust_fatness(20, FATTENING_TYPE_ITEM)
if(M.fatness < 200)
to_chat(M, "The moment your hand meets the statue, you feel a little warmer...")
if(HAS_TRAIT(M, TRAIT_FAT))
@@ -381,7 +381,7 @@
if(HAS_TRAIT(M, TRAIT_LIPOIFIER_IMMUNE))
to_chat(M, "Nothing happens.")
else
- M.fatness = M.fatness + 20
+ M.adjust_fatness(20, FATTENING_TYPE_ITEM)
if(M.fatness < 200)
to_chat(M, "The moment your hand meets the statue, you feel a little warmer...")
if(HAS_TRAIT(M, TRAIT_FAT))
@@ -399,7 +399,7 @@
if(HAS_TRAIT(M, TRAIT_LIPOIFIER_IMMUNE))
to_chat(M, "Nothing happens.")
else
- M.fatness = M.fatness + 20
+ M.adjust_fatness(20, FATTENING_TYPE_ITEM)
if(M.fatness < 200)
to_chat(M, "The moment your hand meets the statue, you feel a little warmer...")
if(HAS_TRAIT(M, TRAIT_FAT))
diff --git a/code/game/turfs/simulated/floor/mineral_floor.dm b/code/game/turfs/simulated/floor/mineral_floor.dm
index 5e2844a2..31d09ab2 100644
--- a/code/game/turfs/simulated/floor/mineral_floor.dm
+++ b/code/game/turfs/simulated/floor/mineral_floor.dm
@@ -221,7 +221,7 @@
if(!istype(M, /mob/living/carbon) || HAS_TRAIT(M, TRAIT_LIPOIFIER_IMMUNE))
return FALSE
else
- M.fatness = M.fatness + fat_to_add
+ M.adjust_fatness(fat_to_add, FATTENING_TYPE_ITEM)
// calorite floor, disguised version - GS13
diff --git a/code/game/turfs/simulated/wall/mineral_walls.dm b/code/game/turfs/simulated/wall/mineral_walls.dm
index d96d68d9..436648ca 100644
--- a/code/game/turfs/simulated/wall/mineral_walls.dm
+++ b/code/game/turfs/simulated/wall/mineral_walls.dm
@@ -55,10 +55,7 @@
if(world.time > last_event+15)
active = 1
for(var/mob/living/carbon/human/M in orange(3,src))
- if(HAS_TRAIT(M, TRAIT_LIPOIFIER_IMMUNE))
- return
- else
- M.fatness = M.fatness + 50
+ M.adjust_fatness(50, FATTENING_TYPE_ITEM)
last_event = world.time
active = null
return
diff --git a/code/modules/mob/living/carbon/carbon_movement.dm b/code/modules/mob/living/carbon/carbon_movement.dm
index 5dc45359..10b66ebc 100644
--- a/code/modules/mob/living/carbon/carbon_movement.dm
+++ b/code/modules/mob/living/carbon/carbon_movement.dm
@@ -46,7 +46,7 @@
fat_burned = min(HUNGER_FACTOR/20, fatness)
nutrition_lost_divider = 5
nutrition -= (HUNGER_FACTOR/nutrition_lost_divider - fat_burned)
- fatness -= fat_burned
+ adjust_fatness(fat_burned, FATTENING_TYPE_WEIGHT_LOSS)
if(HAS_TRAIT(src, TRAIT_NOTHIRST))
diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm
index cbb2e2f9..a4fa219b 100644
--- a/code/modules/mob/living/carbon/human/species.dm
+++ b/code/modules/mob/living/carbon/human/species.dm
@@ -1606,7 +1606,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
var/fatConversionRate = 100 //GS13 what percentage of the excess nutrition should go to fat (total nutrition to transfer can't be under 1)
var/nutritionThatBecomesFat = max((H.nutrition - NUTRITION_LEVEL_FULL)*(fatConversionRate / 100),1)
H.nutrition -= nutritionThatBecomesFat
- H.fatness += nutritionThatBecomesFat
+ H.adjust_fatness(nutritionThatBecomesFat, FATTENING_TYPE_FOOD)
if(H.fullness > FULLNESS_LEVEL_EMPTY)//GS13 stomach-emptying routine
var/ticksToEmptyStomach = 20 // GS13 how many ticks it takes to decrease the fullness by 1
H.fullness -= 1/ticksToEmptyStomach
diff --git a/code/modules/projectiles/guns/misc/fatbeam.dm b/code/modules/projectiles/guns/misc/fatbeam.dm
index 162a8d77..8f87b5e7 100644
--- a/code/modules/projectiles/guns/misc/fatbeam.dm
+++ b/code/modules/projectiles/guns/misc/fatbeam.dm
@@ -114,6 +114,7 @@
/obj/item/gun/fatbeam/proc/on_beam_tick(var/mob/living/target)
if(target.health != target.maxHealth)
new /obj/effect/temp_visual/heal(get_turf(target), "#FFC2F8")
+ if(HAS_TRAIT(target, TRAIT_GAIN_WEAPON_IMMUNE))
target.nutrition += 50
return
diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm
index e8dbed8f..1c69ecde 100644
--- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm
@@ -619,9 +619,11 @@
/datum/reagent/medicine/lipolicide/on_mob_life(mob/living/carbon/M)
if(M.nutrition <= NUTRITION_LEVEL_STARVING)
M.adjustToxLoss(1*REM, 0)
- M.fatness = max(M.fatness - 10, 0)
if(M.fatness == 0)
M.nutrition = max(M.nutrition - 3, 0) // making the chef more valuable, one meme trap at a time
+ else
+ M.adjust_fatness(-10, FATTENING_TYPE_WEIGHT_LOSS)
+
M.overeatduration = 0
return ..()