Fixes many basic mobs not being vulnerable to extreme atmospheres and temperatures by making it the default (#71817)

## About The Pull Request
**In short:**
This PR causes cows, pigs, rabbits, sheep, cockroaches, mothroaches and
mice to take damage in dangerous atmospheres and temperatures.

**In long:**
So simple mobs take damage from extreme atmospheres and temperatures by
default, this is not the case with basic mobs however. Basic mobs can be
given the `atmos_requirements` and `basic_body_temp_sensitive` elements
to accomplish this, but these are missing on a number of basic mobs that
probably shouldn't be able to survive in space.

This PR gives basic mobs the `atmos_requirements` and
`basic_body_temp_sensitive` elements by default, using the same values
as default simple mobs do. These values have been overridden in the
cases where this was done by the original simple mob (cockroaches and
lavaland mobs) or where the basic mob already had one of the elements
with different values (space bunnies and void puppies).

Not every mob is vulnerable to temperature or atmosphere though. Setting
`unsuitable_atmos_damage` to 0 will make it so the mob isn't given the
`atmos_requirements` element. Setting both
`minimum_survivable_temperature` and `maximum_survivable_temperature` to
0 will make it so the mob isn't given the `basic_body_temp_sensitive`
element.

I'm not sure if this is the best way of doing this. I don't know if mobs
dying to extreme atmos/temp by default was left behind with simple mobs
for a reason or if it was just forgotten about.
## Why It's Good For The Game
Cows, pigs, rabbits, sheep, cockroaches, mothroaches and mice are
probably not intended to be space-faring animals.

Basic mobs matching the same default atmosphere and temperature
vulnerabilities as simple mobs makes it harder to overlook that when
porting them to basic mobs.
## Changelog
🆑
fix: cows, pigs, rabbits, sheep, cockroaches, mothroaches and mice now
take damage in hazardous atmospheres and temperatures
/🆑
This commit is contained in:
kawoppi
2022-12-09 19:27:09 +01:00
committed by GitHub
parent d2f7770394
commit 81012494d1
8 changed files with 41 additions and 68 deletions
+22
View File
@@ -85,6 +85,20 @@
///Sentience type, for slime potions. SHOULD BE AN ELEMENT BUT I DONT CARE ABOUT IT FOR NOW
var/sentience_type = SENTIENCE_ORGANIC
///Leaving something at 0 means it's off - has no maximum.
var/list/habitable_atmos = list("min_oxy" = 5, "max_oxy" = 0, "min_plas" = 0, "max_plas" = 1, "min_co2" = 0, "max_co2" = 5, "min_n2" = 0, "max_n2" = 0)
///This damage is taken when atmos doesn't fit all the requirements above. Set to 0 to avoid adding the atmos_requirements element.
var/unsuitable_atmos_damage = 1
///Minimal body temperature without receiving damage
var/minimum_survivable_temperature = 250
///Maximal body temperature without receiving damage
var/maximum_survivable_temperature = 350
///This damage is taken when the body temp is too cold. Set both this and unsuitable_heat_damage to 0 to avoid adding the basic_body_temp_sensitive element.
var/unsuitable_cold_damage = 1
///This damage is taken when the body temp is too hot. Set both this and unsuitable_cold_damage to 0 to avoid adding the basic_body_temp_sensitive element.
var/unsuitable_heat_damage = 1
/mob/living/basic/Initialize(mapload)
. = ..()
@@ -102,6 +116,14 @@
if(speak_emote)
speak_emote = string_list(speak_emote)
if(unsuitable_atmos_damage != 0)
//String assoc list returns a cached list, so this is like a static list to pass into the element below.
habitable_atmos = string_assoc_list(habitable_atmos)
AddElement(/datum/element/atmos_requirements, habitable_atmos, unsuitable_atmos_damage)
if(unsuitable_cold_damage != 0 && unsuitable_heat_damage != 0)
AddElement(/datum/element/basic_body_temp_sensitive, minimum_survivable_temperature, maximum_survivable_temperature, unsuitable_cold_damage, unsuitable_heat_damage)
/mob/living/basic/Life(delta_time = SSMOBS_DT, times_fired)
. = ..()
///Automatic stamina re-gain