From df8dbcdab4e7e26d545e784d5c733c79f228ca28 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 13 Dec 2022 00:02:37 +0100 Subject: [PATCH] [MIRROR] Fixes many basic mobs not being vulnerable to extreme atmospheres and temperatures by making it the default [MDB IGNORE] (#18029) * Fixes many basic mobs not being vulnerable to extreme atmospheres and temperatures by making it the default * borgi update Co-authored-by: kawoppi <94711066+kawoppi@users.noreply.github.com> Co-authored-by: tastyfish --- code/modules/mob/living/basic/basic.dm | 22 +++++++++++++++ .../mob/living/basic/farm_animals/rabbit.dm | 27 +++++-------------- .../mob/living/basic/lavaland/mining.dm | 4 ++- code/modules/mob/living/basic/pets/dog.dm | 3 +++ code/modules/mob/living/basic/pets/pet.dm | 15 ----------- .../living/basic/ruin_defender/stickman.dm | 17 +++--------- .../mob/living/basic/vermin/axolotl.dm | 14 ---------- .../mob/living/basic/vermin/cockroach.dm | 4 +++ .../mob/living/simple_animal/friendly/dogs.dm | 5 ++-- 9 files changed, 43 insertions(+), 68 deletions(-) diff --git a/code/modules/mob/living/basic/basic.dm b/code/modules/mob/living/basic/basic.dm index 232490128e0..1c08976beb0 100644 --- a/code/modules/mob/living/basic/basic.dm +++ b/code/modules/mob/living/basic/basic.dm @@ -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 diff --git a/code/modules/mob/living/basic/farm_animals/rabbit.dm b/code/modules/mob/living/basic/farm_animals/rabbit.dm index 78095d6f585..7677e6a98fd 100644 --- a/code/modules/mob/living/basic/farm_animals/rabbit.dm +++ b/code/modules/mob/living/basic/farm_animals/rabbit.dm @@ -31,6 +31,8 @@ attack_verb_continuous = "kicks" attack_verb_simple = "kick" butcher_results = list(/obj/item/food/meat/slab = 1) + unsuitable_cold_damage = 0.5 // Cold damage is 0.5 here to account for low health on the rabbit. + unsuitable_heat_damage = 0.5 // Heat damage is 0.5 here to account for low health on the rabbit. ai_controller = /datum/ai_controller/basic_controller/rabbit /// passed to animal_varity as the prefix icon. var/icon_prefix = "rabbit" @@ -85,27 +87,10 @@ icon_dead = "space_rabbit_white_dead" icon_prefix = "space_rabbit" ai_controller = /datum/ai_controller/basic_controller/rabbit/easter/space - // Minimum Allowable Body Temp, zero because we are meant to survive in space and we have a fucking RABBIT SPACE MASK. - var/minimum_survivable_temperature = 0 - // Maximum Allowable Body Temp, 1500 because we might overheat and die in said RABBIT SPACE MASK. - var/maximum_survivable_temperature = 1500 - -/mob/living/basic/rabbit/easter/space/Initialize(mapload) - . = ..() - // string_assoc_list returns a cached list, which we then use as a static list to pass into the below AddElement - var/list/habitable_atmos = string_assoc_list(list( - "min_oxy" = 0, - "max_oxy" = 0, - "min_plas" = 0, - "max_plas" = 0, - "min_co2" = 0, - "max_co2" = 0, - "min_n2" = 0, - "max_n2" = 0, - )) - AddElement(/datum/element/atmos_requirements, atmos_requirements = habitable_atmos, unsuitable_atmos_damage = 0) - // heat_damage is 0.5 here to account for low health on the rabbit. - AddElement(/datum/element/basic_body_temp_sensitive, min_body_temp = minimum_survivable_temperature, max_body_temp = maximum_survivable_temperature, cold_damage = 0, heat_damage = 0.5) + unsuitable_atmos_damage = 0 // Zero because we are meant to survive in space. + minimum_survivable_temperature = 0 // Minimum Allowable Body Temp, zero because we are meant to survive in space and we have a fucking RABBIT SPACE MASK. + maximum_survivable_temperature = 1500 // Maximum Allowable Body Temp, 1500 because we might overheat and die in said RABBIT SPACE MASK. + unsuitable_cold_damage = 0 // Zero because we are meant to survive in space. /datum/ai_controller/basic_controller/rabbit/easter/space planning_subtrees = list(/datum/ai_planning_subtree/random_speech/rabbit/easter/space) diff --git a/code/modules/mob/living/basic/lavaland/mining.dm b/code/modules/mob/living/basic/lavaland/mining.dm index 66900814b5d..c34c16d8545 100644 --- a/code/modules/mob/living/basic/lavaland/mining.dm +++ b/code/modules/mob/living/basic/lavaland/mining.dm @@ -3,10 +3,12 @@ combat_mode = TRUE faction = list("mining") + unsuitable_atmos_damage = 0 + minimum_survivable_temperature = 0 + maximum_survivable_temperature = INFINITY /mob/living/basic/mining/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_LAVA_IMMUNE, INNATE_TRAIT) ADD_TRAIT(src, TRAIT_ASHSTORM_IMMUNE, INNATE_TRAIT) AddElement(/datum/element/mob_killed_tally, "mobs_killed_mining") - AddElement(/datum/element/basic_body_temp_sensitive, max_body_temp = INFINITY) diff --git a/code/modules/mob/living/basic/pets/dog.dm b/code/modules/mob/living/basic/pets/dog.dm index 71f6c4a5e00..ac1df3c4567 100644 --- a/code/modules/mob/living/basic/pets/dog.dm +++ b/code/modules/mob/living/basic/pets/dog.dm @@ -711,6 +711,9 @@ GLOBAL_LIST_INIT(strippable_corgi_items, create_strippable_list(list( icon_dead = "void_puppy_dead" nofur = TRUE held_state = "void_puppy" + unsuitable_atmos_damage = 0 + minimum_survivable_temperature = TCMB + maximum_survivable_temperature = T0C + 40 /mob/living/basic/pet/dog/corgi/puppy/void/Initialize(mapload) . = ..() diff --git a/code/modules/mob/living/basic/pets/pet.dm b/code/modules/mob/living/basic/pets/pet.dm index ea8181628b3..3f67e56f179 100644 --- a/code/modules/mob/living/basic/pets/pet.dm +++ b/code/modules/mob/living/basic/pets/pet.dm @@ -17,21 +17,6 @@ /mob/living/basic/pet/Initialize(mapload) . = ..() - // String assoc list returns a cached list, so this is like a static list to pass into the element below. - var/static/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, - ) - - AddElement(/datum/element/atmos_requirements, atmos_requirements = habitable_atmos, unsuitable_atmos_damage = 1) - AddElement(/datum/element/basic_body_temp_sensitive) - /// Can set the collar var beforehand to start the pet with a collar. if(collar) collar = new(src) diff --git a/code/modules/mob/living/basic/ruin_defender/stickman.dm b/code/modules/mob/living/basic/ruin_defender/stickman.dm index be3424105d0..68e2b50d1c7 100644 --- a/code/modules/mob/living/basic/ruin_defender/stickman.dm +++ b/code/modules/mob/living/basic/ruin_defender/stickman.dm @@ -16,26 +16,15 @@ attack_sound = 'sound/weapons/punch1.ogg' combat_mode = TRUE faction = list("stickman") + unsuitable_atmos_damage = 7.5 + unsuitable_cold_damage = 7.5 + unsuitable_heat_damage = 7.5 ai_controller = /datum/ai_controller/basic_controller/stickman /mob/living/basic/stickman/Initialize(mapload) . = ..() - // String assoc list returns a cached list, so this is like a static list to pass into the element below. - var/list/habitable_atmos = string_assoc_list(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, - )) - new /obj/effect/temp_visual/paper_scatter(get_turf(src)) - AddElement(/datum/element/basic_body_temp_sensitive, cold_damage = 7.5, heat_damage = 7.5) - AddElement(/datum/element/atmos_requirements, atmos_requirements = habitable_atmos, unsuitable_atmos_damage = 7.5) /datum/ai_controller/basic_controller/stickman blackboard = list( diff --git a/code/modules/mob/living/basic/vermin/axolotl.dm b/code/modules/mob/living/basic/vermin/axolotl.dm index 63fa841c622..a56f1df5909 100644 --- a/code/modules/mob/living/basic/vermin/axolotl.dm +++ b/code/modules/mob/living/basic/vermin/axolotl.dm @@ -35,20 +35,6 @@ . = ..() ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) - var/list/habitable_atmos = string_assoc_list(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, - )) - - AddElement(/datum/element/atmos_requirements, habitable_atmos, unsuitable_atmos_damage = 1) - AddElement(/datum/element/basic_body_temp_sensitive) - /datum/ai_controller/basic_controller/axolotl ai_traits = STOP_MOVING_WHEN_PULLED ai_movement = /datum/ai_movement/basic_avoidance diff --git a/code/modules/mob/living/basic/vermin/cockroach.dm b/code/modules/mob/living/basic/vermin/cockroach.dm index 79d0d2e1c39..71b1fbf67f2 100644 --- a/code/modules/mob/living/basic/vermin/cockroach.dm +++ b/code/modules/mob/living/basic/vermin/cockroach.dm @@ -25,6 +25,10 @@ basic_mob_flags = DEL_ON_DEATH faction = list("hostile", FACTION_MAINT_CREATURES) + unsuitable_atmos_damage = 0 + minimum_survivable_temperature = 270 + maximum_survivable_temperature = INFINITY + ai_controller = /datum/ai_controller/basic_controller/cockroach var/cockroach_cell_line = CELL_LINE_TABLE_COCKROACH diff --git a/modular_skyrat/master_files/code/modules/mob/living/simple_animal/friendly/dogs.dm b/modular_skyrat/master_files/code/modules/mob/living/simple_animal/friendly/dogs.dm index aa3228c0288..b8b1d68c4f8 100644 --- a/modular_skyrat/master_files/code/modules/mob/living/simple_animal/friendly/dogs.dm +++ b/modular_skyrat/master_files/code/modules/mob/living/simple_animal/friendly/dogs.dm @@ -59,6 +59,8 @@ gold_core_spawnable = NO_SPAWN nofur = TRUE ai_controller = /datum/ai_controller/dog/borgi + unsuitable_atmos_damage = 0 + minimum_survivable_temperature = 0 // These lights enable when E-N is emagged light_system = MOVABLE_LIGHT_DIRECTIONAL @@ -72,9 +74,6 @@ /mob/living/basic/pet/dog/corgi/borgi/Initialize(mapload) . = ..() - RemoveElement(/datum/element/atmos_requirements) - RemoveElement(/datum/element/basic_body_temp_sensitive) - AddElement(/datum/element/basic_body_temp_sensitive, min_body_temp = 0) var/static/list/borgi_drops = list(/obj/effect/decal/cleanable/oil/slippery) AddElement(/datum/element/death_drops, borgi_drops)