Skip to content
2 changes: 1 addition & 1 deletion code/datums/heritage/family_curse.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
. = ..()
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
H.dna.species.nutrition_mod += 1.1
H.physiology.add_physiology_modifier(/datum/physiology_modifier/hunger_curse)

/atom/movable/screen/alert/status_effect/family_curse/hunger
name = "Insatiable Appetite"
Expand Down
4 changes: 4 additions & 0 deletions code/datums/mana/mana_pool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@
if (amount == 0)
return amount

if(amount > 0 && ishuman(parent))
var/mob/living/carbon/human/mob = parent
amount *= mob.physiology?.get_mana_regen_mod()

var/result = clamp(src.amount + amount, 0, maximum_mana_capacity)
. = result - src.amount // Return the amount that was used
src.amount = result
Expand Down
4 changes: 2 additions & 2 deletions code/modules/antagonists/villain/maniac/_maniac.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ GLOBAL_VAR_INIT(maniac_highlander, 0) // THERE CAN ONLY BE ONE!
dreamer.set_patron(/datum/patron/inhumen/graggar_zizo)
old_cm = dreamer.cmode_music
dreamer.cmode_music = 'sound/music/cmode/antag/combat_maniac.ogg'
phy.bleed_mod *= 0.5
phy.add_physiology_modifier(/datum/physiology_modifier/maniac)
for(var/datum/status_effect/effect in dreamer.status_effects) //necessary to prevent exploits
dreamer.remove_status_effect(effect)
dreamer.attributes?.add_sheet(/datum/attribute_holder/sheet/job/maniac)
Expand Down Expand Up @@ -175,7 +175,7 @@ GLOBAL_VAR_INIT(maniac_highlander, 0) // THERE CAN ONLY BE ONE!
dreamer.cmode_music = old_cm
dreamer.remove_stat_modifier("[type]")
qdel(dreamer.GetComponent(/datum/component/theme_music))
phy.bleed_mod *= 2
phy.remove_physiology_modifier(/datum/physiology_modifier/maniac)
UnregisterSignal(dreamer, COMSIG_LIVING_DEATH)
var/client/client = dreamer?.client
if(client) //clear screenshake animation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ And it also helps for the character set panel
H.has_reflection = FALSE
H.cut_overlay(H.reflective_icon)
H.mob_biotypes |= MOB_UNDEAD
H.physiology?.bleed_mod /= 2
H.physiology?.add_physiology_modifier(/datum/physiology_modifier/clan)

if(alt_sprite)
if (!alt_sprite_greyscale)
Expand Down Expand Up @@ -290,7 +290,7 @@ And it also helps for the character set panel
vampire.has_reflection = TRUE
vampire.create_reflection()
vampire.update_reflection()
vampire.physiology?.bleed_mod *= 2
vampire.physiology?.remove_physiology_modifier(/datum/physiology_modifier/clan)
vampire.mob_biotypes &= ~MOB_UNDEAD

clan_members -= vampire
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
to_chat(user, span_good("The rumblings of a troll echo through the trees, your offering was acknowledged by the ancient dwellers of the forest."))
user.emote("rage", forced = TRUE)
ADD_TRAIT(user, TRAIT_CRITICAL_RESISTANCE, TRAIT_GENERIC)
user.physiology.pain_mod *= 0.6
user.physiology.add_physiology_modifier(/datum/physiology_modifier/black_briar)
user.remove_spell(/datum/action/cooldown/spell/healing)
user.add_spell(/datum/action/cooldown/spell/undirected/shapeshift/troll_form)
to_chat(user, span_warning("I no longer care for mending wounds, let the lords of the forest be known!"))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
#undef BLOOD_DRIP_RATE_MOD

/mob/living/carbon/human/bleed(amount)
amount *= physiology?.bleed_mod
amount *= physiology?.get_bleed_mod()
return ..()

/mob/living/proc/restore_blood()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
add_verb(src, /mob/living/proc/lay_down)

status_flags |= BUILDING_ORGANS
physiology = new() ///this is now core for species
//initialize limbs first
create_bodyparts()

Expand All @@ -126,7 +127,6 @@

//initialise organs
create_internal_organs() //most of it is done in set_species now, this is only for parent call
physiology = new()
status_flags &= ~BUILDING_ORGANS
culture = GLOB.culture_singletons[culture]

Expand Down Expand Up @@ -865,7 +865,7 @@

/mob/living/carbon/human/do_after_coefficent()
. = ..()
. *= physiology?.do_after_speed
. *= physiology?.get_do_after_speed()

/mob/living/carbon/human/proc/skele_look()
dna.species.go_bald()
Expand Down
7 changes: 3 additions & 4 deletions code/modules/mob/living/carbon/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,7 @@
else if(!(flags & SHOCK_NOGLOVES)) //This gets the siemens_coeff for all non tesla shocks
if(gloves)
siemens_coeff *= gloves.siemens_coefficient
siemens_coeff *= physiology.siemens_coeff
siemens_coeff *= dna.species.siemens_coeff
siemens_coeff *= physiology.get_siemens_coeff()
. = ..()
//Don't go further if the shock was blocked/too weak.
if(!.)
Expand Down Expand Up @@ -774,5 +773,5 @@

/mob/living/carbon/human/getShock(painkiller_included)
. = ..()
if(dna?.species)
return . * dna?.species.pain_mod
if(physiology)
return . * physiology.get_pain_mod()
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
/mob/living/carbon/human/proc/handle_hygiene()
if(stat == DEAD || HAS_TRAIT(src, TRAIT_NOHYGIENE))
return
var/dirt_factor = HYGIENE_FACTOR * dna.species.hygiene_mod
var/dirt_factor = HYGIENE_FACTOR * physiology.get_hygiene_mod()
if(HAS_TRAIT(src, TRAIT_ALWAYS_CLEAN))
set_hygiene(HYGIENE_LEVEL_CLEAN)

Expand Down
30 changes: 0 additions & 30 deletions code/modules/mob/living/carbon/human/physiology.dm

This file was deleted.

85 changes: 85 additions & 0 deletions code/modules/mob/living/carbon/human/physiology/modifiers/_base.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
GLOBAL_LIST_EMPTY(physiology_modification_cache)

/datum/physiology_modifier
/// Whether or not this is a variable modifier. Variable modifiers can NOT be ever auto-cached. ONLY CHECKED VIA INITIAL(), EFFECTIVELY READ ONLY (and for very good reason)
var/variable = FALSE

/// Unique ID. You can never have different modifications with the same ID. By default, this SHOULD NOT be set. Only set it for cases where you're dynamically making modifiers/need to have two types overwrite each other. If unset, uses path (converted to text) as ID.
var/id

/// Higher ones override lower priorities. This is NOT used for ID, ID must be unique, if it isn't unique the newer one overwrites automatically if overriding.
var/priority = 0
var/flags = NONE

/// % of brute damage taken from all sources
var/brute_mod = 1
/// % of burn damage taken from all sources
var/burn_mod = 1
/// % of toxin damage taken from all sources
var/tox_mod = 1
/// % of oxygen damage taken from all sources
var/oxy_mod = 1
/// % of clone damage taken from all sources
var/clone_mod = 1
/// % of stamina damage taken from all sources
var/stamina_mod = 1
/// % of brain damage taken from all sources
var/brain_mod = 1
/// multiplier applied to mana regen
var/mana_regen_mod = 1

/// % of burn damage taken from heat (stacks with burn_mod)
var/heat_mod = 1
/// % of burn damage taken from cold (stacks with burn_mod)
var/cold_mod = 1

/// % damage reduction from all sources. Additive, not multiplicative - see ADDITIVE_PHYSIOLOGY_STATS
var/damage_resistance = 0

/// Resistance to shocks
var/siemens_coeff = 1

/// % stun modifier
var/stun_mod = 1
/// % bleeding modifier
var/bleed_mod = 1
/// % pain modifier
var/pain_mod = 1

/// % of hygiene rate taken per tick
var/hygiene_mod = 1
/// % of hunger rate taken per tick
var/hunger_mod = 1

/// Speed mod for do_after. Lower is better. If temporarily adjusting, please only modify using *= and /=, so you don't interrupt other calculations.
var/do_after_speed = 1

/datum/physiology_modifier/New()
. = ..()
if(!id)
id = "[type]" //We turn the path into a string.

/// Checks if we should actually apply our modification at this moment
/datum/physiology_modifier/proc/applies_to(datum/physiology/holder)
return TRUE

/// Grabs a STATIC MODIFIER datum from cache. YOU MUST NEVER EDIT THESE DATUMS, OR IT WILL AFFECT ANYTHING ELSE USING IT TOO!
/proc/get_cached_physiology_modifier(modtype)
if(!ispath(modtype, /datum/physiology_modifier))
CRASH("[modtype] is not a physiology modifier typepath.")
var/datum/physiology_modifier/phys_mod = modtype
if(initial(phys_mod.variable))
CRASH("[modtype] is a variable modifier, and can never be cached.")
phys_mod = GLOB.physiology_modification_cache[modtype]
if(!phys_mod)
phys_mod = GLOB.physiology_modification_cache[modtype] = new modtype
return phys_mod

/// The "always on" variable modifier every physiology gets on creation. This is what direct/admin edits get written to.
/datum/physiology_modifier/base
id = "base"
variable = TRUE
priority = 0

/datum/physiology_modifier/base/applies_to(datum/physiology/holder)
return TRUE //this special snowflake ALWAYS applies
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/physiology_modifier/black_briar
id = "black_briar"
pain_mod = 0.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/physiology_modifier/hunger_curse
id = "hunger_curse"
hunger_mod = 2.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/physiology_modifier/maniac
id = "maniac"
bleed_mod = 0.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/datum/physiology_modifier/species
id = "species"
variable = TRUE
priority = 0

/datum/physiology_modifier/species/applies_to(datum/physiology/holder)
return TRUE

/datum/physiology_modifier/species/halfling
hunger_mod = 2

/datum/physiology_modifier/species/horc
hunger_mod = 2
hygiene_mod = 1.5

/datum/physiology_modifier/species/medicator
hygiene_mod = 1.25

/datum/physiology_modifier/species/werewolf
bleed_mod = 0.6
pain_mod = 0.2

/datum/physiology_modifier/species/automaton
bleed_mod = 0.7

/datum/physiology_modifier/species/aasimar
bleed_mod = 0.8
pain_mod = 0.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/datum/physiology_modifier/painkiller
id = "painkiller"
pain_mod = 0.5

/datum/physiology_modifier/persistence
id = "persistence"
pain_mod = 1.5
bleed_mod = 1.5

/datum/physiology_modifier/persistence_buff
id = "persistence_buff"
pain_mod = 0.85

/datum/physiology_modifier/flight
id = "flight"
stun_mod = 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/physiology_modifier/clan
id = "vampire"
bleed_mod = 0.5
Loading
Loading