-
-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Semi-Experimental] The coldbloodening (#2684)
- Loading branch information
1 parent
7544d7c
commit 5f1c555
Showing
13 changed files
with
215 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//Modular File for NSV species stuff | ||
|
||
///The species-level version of bodytemperature stabilization. | ||
/datum/species/proc/natural_bodytemperature_stabilization(mob/living/carbon/human/human_holder) | ||
if(HAS_TRAIT(human_holder, TRAIT_COLDBLOODED)) | ||
ectotherm_thermogenesis(human_holder) //Man I love the word "thermogenesis". Such a magic term for what is essentially just "makes heat". | ||
return 0 | ||
var/body_temperature_difference = BODYTEMP_NORMAL - human_holder.bodytemperature | ||
switch(human_holder.bodytemperature) | ||
if(-INFINITY to BODYTEMP_COLD_DAMAGE_LIMIT) //Cold damage limit is 50 below the default, the temperature where you start to feel effects. | ||
return max((body_temperature_difference * human_holder.metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM) | ||
if(BODYTEMP_COLD_DAMAGE_LIMIT to BODYTEMP_NORMAL) | ||
return max(body_temperature_difference * human_holder.metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, min(body_temperature_difference, BODYTEMP_AUTORECOVERY_MINIMUM/4)) | ||
if(BODYTEMP_NORMAL to BODYTEMP_HEAT_DAMAGE_LIMIT) // Heat damage limit is 50 above the default, the temperature where you start to feel effects. | ||
return min(body_temperature_difference * human_holder.metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, max(body_temperature_difference, -BODYTEMP_AUTORECOVERY_MINIMUM/4)) | ||
if(BODYTEMP_HEAT_DAMAGE_LIMIT to INFINITY) | ||
return min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers | ||
|
||
/** | ||
* A proc for coldblooded species' means of limited thermal control. Also known as "vibrating your muscles". | ||
* * Returns: Amount of kelvin adjustment performed, or ECTOTHERM_NO_THERMOGENESIS_NEEDED (-1) if we are fine. | ||
**/ | ||
/datum/species/proc/ectotherm_thermogenesis(mob/living/carbon/human/human_holder, use_temp_diff_range_check = TRUE) | ||
var/temperature_differential = BODYTEMP_NORMAL - human_holder.bodytemperature | ||
if(temperature_differential <= 0 || (use_temp_diff_range_check && temperature_differential < ECTOTHERM_THERMOGENESIS_MIN_COLDNESS)) | ||
return ECTOTHERM_NO_THERMOGENESIS_NEEDED | ||
var/adjustment = 0 | ||
if(temperature_differential < ECTOTHERM_THERMOGENESIS_CRIT_COLDNESS) | ||
if(human_holder.nutrition < ECTOTHERM_THERMOGENESIS_NUTRITION_USE * human_holder.metabolism_efficiency) | ||
return 0 | ||
adjustment = round(CLAMP(temperature_differential / ECTOTHERM_RECOVERY_DIVISOR * human_holder.metabolism_efficiency, ECTOTHERM_MIN_RECOVERY * human_holder.metabolism_efficiency, ECTOTHERM_MAX_RECOVERY * human_holder.metabolism_efficiency), 0.1) | ||
human_holder.adjust_nutrition(-ECTOTHERM_THERMOGENESIS_NUTRITION_USE * human_holder.metabolism_efficiency) | ||
else | ||
if(human_holder.nutrition < ECTOTHERM_MAJOR_THERMOGENESIS_NUTRITION_USE * human_holder.metabolism_efficiency) | ||
return 0 | ||
adjustment = round(CLAMP(temperature_differential / ECTOTHERM_RECOVERY_DIVISOR * human_holder.metabolism_efficiency, ECTOTHERM_MIN_RECOVERY * human_holder.metabolism_efficiency, ECTOTHERM_MAX_RECOVERY * human_holder.metabolism_efficiency * ECTOTHERM_CRIT_COLD_MAX_RECOVERY_MOD), 0.1) | ||
human_holder.adjust_nutrition(-ECTOTHERM_MAJOR_THERMOGENESIS_NUTRITION_USE * human_holder.metabolism_efficiency) | ||
human_holder.adjust_bodytemperature(adjustment) | ||
return adjustment |
67 changes: 67 additions & 0 deletions
67
nsv13/code/modules/mob/living/carbon/human/species_types/nsv_lizardpeople.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
//Modular NSV file for special stuff lizards have here. | ||
|
||
//Modular type attachment. | ||
/datum/species/lizard | ||
coldmod = 1 // Lizards here have exchanged their inherent damage modifier for them being cold-blooded. | ||
inherent_traits = list(TRAIT_COLDBLOODED) // The aforementioned coldbloodedness | ||
///Controls whether lizards use their muscles to generate additional heat if very cold. | ||
var/cold_stacks = 0 | ||
///Stores if we already sent them a message & adjusted stuff. | ||
var/fibrillating = FALSE | ||
///Used to store whether the signal to adjust mood due to good temperatures has been updated. | ||
var/is_comfy = FALSE | ||
|
||
//Another modular type attachment. | ||
/datum/species/lizard/ashwalker | ||
inherent_traits = list(TRAIT_NOGUNS,TRAIT_NOBREATH, TRAIT_COLDBLOODED) //Ashwalkers are also coldblooded [we have no lavaland so I don't have to worry about if lavaland always gens with survivable temps :) ] | ||
|
||
/datum/species/lizard/ectotherm_thermogenesis(mob/living/carbon/human/human_holder, use_temp_diff_range_check = TRUE) | ||
var/temp_diff = BODYTEMP_NORMAL - human_holder.bodytemperature | ||
switch(temp_diff) | ||
if(ECTOTHERM_THERMOGENESIS_CRIT_COLDNESS to INFINITY) //Being extremely cold quickly triggers thermogenesis. | ||
cold_stacks = min(cold_stacks + 3, LIZARD_ECTOTHERMISM_COLD_MAX_STACKS) | ||
if(ECTOTHERM_THERMOGENESIS_MIN_COLDNESS to ECTOTHERM_THERMOGENESIS_CRIT_COLDNESS) | ||
cold_stacks = min(cold_stacks + 1, LIZARD_ECTOTHERMISM_COLD_MAX_STACKS) //Basic cold takes some time to respond to. | ||
else | ||
cold_stacks = max(cold_stacks - 1, 0) //Takes a while to calm down muscles. | ||
|
||
if(cold_stacks < LIZARD_THERMOGENESIS_COLD_TRIGGER_STACKS && !fibrillating) | ||
return ECTOTHERM_NO_THERMOGENESIS_NEEDED | ||
if(!fibrillating) // !fibrillating reaching this point means enough stacks exist. | ||
to_chat(human_holder, "<span class='warning'>You start shivering and feel the urge to find a sunny spot!</span>") | ||
SEND_SIGNAL(human_holder, COMSIG_ADD_MOOD_EVENT, "lizard_shivers", /datum/mood_event/lizard_shivers) | ||
fibrillating = TRUE | ||
else if(cold_stacks == 0) //We also check if we have to stop vibrating here. | ||
to_chat(human_holder, "<span class='notice'>You stop shivering.</span>") | ||
SEND_SIGNAL(human_holder, COMSIG_CLEAR_MOOD_EVENT, "lizard_shivers") | ||
fibrillating = FALSE | ||
return ECTOTHERM_NO_THERMOGENESIS_NEEDED | ||
|
||
return ..(human_holder, FALSE) //We already use some fancy logic for our thermoregulation triggering so we don't use the normal temp difference check save for if we would get hot. | ||
|
||
//Modular proc attachment | ||
/datum/species/lizard/on_species_loss(mob/living/carbon/human/C, datum/species/new_species, pref_load) //Human variable, named C. What did they mean by this? | ||
SEND_SIGNAL(C, COMSIG_CLEAR_MOOD_EVENT, "lizard_shivers") //Safely remove if our species is changed. | ||
SEND_SIGNAL(C, COMSIG_CLEAR_MOOD_EVENT, "comfy_liz_temp") | ||
return ..() | ||
|
||
//Lizards are most comfortable between 30 and 60°C. Good luck managing to stabilize at that temp, but hey if you manage to, you get a mood buff! | ||
#define LIZARD_COMFY_TEMP_MIN 303.15 | ||
#define LIZARD_COMFY_TEMP_MAX 333.15 //From what I read some terran lizards have ~40-45°C as their upper targeted bounds, buut firstly these are space lizards, and secondly this is already hard enough to hit, so I extended it to 60°C. | ||
|
||
/datum/species/lizard/spec_life(mob/living/carbon/human/H) | ||
. = ..() | ||
var/owner_bodytemperature = H.bodytemperature | ||
if(owner_bodytemperature < LIZARD_COMFY_TEMP_MIN || owner_bodytemperature > LIZARD_COMFY_TEMP_MAX) //Should be low on processing since the first condition will catch almost all the time. | ||
if(!is_comfy) | ||
return | ||
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "comfy_liz_temp") | ||
is_comfy = FALSE | ||
return | ||
if(is_comfy) | ||
return | ||
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "comfy_liz_temp", /datum/mood_event/comfy_lizard_temperature) | ||
is_comfy = TRUE | ||
|
||
#undef LIZARD_COMFY_TEMP_MIN | ||
#undef LIZARD_COMFY_TEMP_MAX |
Oops, something went wrong.