Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Удаление неутолимого голода #10895

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/mob.dm
Expand Up @@ -163,6 +163,7 @@
#define NUTRITION_LEVEL_WELL_FED 450
#define NUTRITION_LEVEL_NORMAL 400
#define NUTRITION_LEVEL_FED 350
#define NUTRITION_LEVEL_NO_HUNGRY 300
#define NUTRITION_LEVEL_HUNGRY 250
#define NUTRITION_LEVEL_STARVING 150

Expand Down
5 changes: 3 additions & 2 deletions code/modules/mob/living/carbon/carbon.dm
Expand Up @@ -1299,10 +1299,11 @@
if(!met_factor)
return
var/nutrition_to_remove = 0
nutrition_to_remove += 0.16
if(is_default_metabolise_active())
nutrition_to_remove += 0.16
if(HAS_TRAIT(src, TRAIT_STRESS_EATER))
var/pain = getHalLoss()
if(pain > 0)
nutrition_to_remove += pain * 0.01
nutrition_to_remove *= met_factor
nutrition = max(0.0, nutrition - nutrition_to_remove)
AdjustNutrition(-nutrition_to_remove)
13 changes: 11 additions & 2 deletions code/modules/mob/living/carbon/human/life.dm
Expand Up @@ -278,7 +278,7 @@ var/global/list/tourette_bad_words= list(
if(species.flags[RAD_ABSORB])
var/rads = radiation/25
radiation -= rads
nutrition += rads
AdjustNutrition(rads)
adjustBruteLoss(-(rads))
adjustOxyLoss(-(rads))
adjustToxLoss(-(rads))
Expand Down Expand Up @@ -540,7 +540,7 @@ var/global/list/tourette_bad_words= list(

if(bodytemperature < species.cold_level_1) //260.15 is 310.15 - 50, the temperature where you start to feel effects.
if(nutrition >= 2) //If we are very, very cold we'll use up quite a bit of nutriment to heat us up.
nutrition -= 2
AdjustNutrition(-2)
var/recovery_amt = max((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM)
//world << "Cold. Difference = [body_temperature_difference]. Recovering [recovery_amt]"
// log_debug("Cold. Difference = [body_temperature_difference]. Recovering [recovery_amt]")
Expand Down Expand Up @@ -1283,6 +1283,15 @@ var/global/list/tourette_bad_words= list(
take_overall_damage(2,0)
traumatic_shock++

/mob/living/carbon/human/is_default_metabolise_active()
//Enable nutrition decrease for nonhumans
if(species.flags[IS_PLANT] || species.flags[IS_SYNTHETIC])
return TRUE
//Enable nutrition decrease for sportsmans
if(metabolism_factor.Get() > 1.0)
return TRUE
return ..()

/*
Called by life(), instead of having the individual hud items update icons each tick and check for status changes
we only set those statuses and icons upon changes. Then those HUD items will simply add those pre-made images.
Expand Down
12 changes: 12 additions & 0 deletions code/modules/mob/living/life.dm
Expand Up @@ -141,5 +141,17 @@
//hud_used.SetButtonCoords(hud_used.hide_actions_toggle,button_number+1)
client.screen += hud_used.hide_actions_toggle

/mob/living/proc/AdjustNutrition(amount)
if(nutrition + amount < 0)
nutrition = 0
return
nutrition += amount
Comment on lines +144 to +148
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

При этом было бы здорово увидеть эту часть отдельно. У нас в некоторых местах нутришен легко может залететь в минус и решается только костылём в лайфе.


/mob/living/proc/SetNutrition(amount)
if(amount < 0)
nutrition = 0
return
nutrition = amount

/mob/living/proc/handle_nutrition()
return
9 changes: 7 additions & 2 deletions code/modules/mob/living/living.dm
Expand Up @@ -573,7 +573,7 @@

// shut down ongoing problems
radiation = 0
nutrition = NUTRITION_LEVEL_NORMAL
SetNutrition(NUTRITION_LEVEL_NORMAL)
bodytemperature = T20C
sdisabilities = 0
disabilities = 0
Expand Down Expand Up @@ -1326,6 +1326,11 @@
// digesting the giant pizza they ate, so we don't use this in examine code.
return nutrition

/mob/living/proc/is_default_metabolise_active()
if(nutrition > NUTRITION_LEVEL_NO_HUNGRY)
return TRUE
return FALSE

/mob/living/proc/get_metabolism_factor()
return METABOLISM_FACTOR

Expand All @@ -1345,7 +1350,7 @@
adjustHalLoss(5)
return FALSE

nutrition -= 50
AdjustNutrition(-50)
blurEyes(5)

if(ishuman(src)) // A stupid, snowflakey thing, but I see no point in creating a third argument to define the sound... ~Luduk
Expand Down