Skip to content

Commit

Permalink
Refactor: Animal temperature (#5930) [testmerge][7d94c6e]
Browse files Browse the repository at this point in the history
commit 7d94c6e
Author: Antoonij <[email protected]>
Date:   Sun Oct 6 18:11:41 2024 +0300

    bugfix

commit 765d34a
Author: Antoonij <[email protected]>
Date:   Sat Oct 5 17:07:18 2024 +0300

    fix for blob

commit ca2dfaf
Merge: f051eeb 2a35223
Author: Aziz Chynaliev <[email protected]>
Date:   Sat Oct 5 18:39:17 2024 +0500

    Merge remote-tracking branch 'origin/master220' into zweifactor

commit f051eeb
Merge: da23987 86ec6b6
Author: Antoonij <[email protected]>
Date:   Thu Oct 3 15:29:25 2024 +0200

    Merge branch 'master220' into zweifactor

commit da23987
Merge: ffca8c3 9ffd4c3
Author: Antoonij <[email protected]>
Date:   Sun Sep 29 19:09:18 2024 +0200

    Merge branch 'master220' into zweifactor

commit ffca8c3
Author: Antoonij <[email protected]>
Date:   Sat Sep 28 21:48:12 2024 +0200

    fix

commit c4e5894
Merge: 2fcc6c5 7b0200f
Author: Antoonij <[email protected]>
Date:   Sat Sep 28 21:34:52 2024 +0200

    Merge branch 'master220' into zweifactor

commit 2fcc6c5
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 21:46:56 2024 +0200

    mor readability

commit 5fcd273
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 21:30:00 2024 +0200

    some evolution go back

commit 6b96b55
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 21:28:59 2024 +0200

    UPD читаемости

commit ffe32f0
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 15:57:18 2024 +0200

    попытки исправить номер 3

commit d5f0ff6
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 15:50:18 2024 +0200

    ищу причины поломки карт часть 2

commit 49a2c21
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 15:12:18 2024 +0200

    попытки починить карту номер 1

commit fc4642b
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 15:01:32 2024 +0200

    clrf type

commit 60d28d4
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 14:57:39 2024 +0200

    опять трейлинг?

commit 2c30505
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 14:53:25 2024 +0200

    thank you prefabs

commit 43e34ef
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 14:49:10 2024 +0200

    final????

commit 8c23cda
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 14:41:38 2024 +0200

    forgotten things nr2

commit 581b1b2
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 14:34:03 2024 +0200

    fix forgotten things nr1

commit a209e91
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 14:21:22 2024 +0200

    pre pr improve

commit e3a8b93
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 14:19:56 2024 +0200

    dme

commit 8ec8390
Author: Antoonij <[email protected]>
Date:   Sun Sep 22 14:18:42 2024 +0200

    final
  • Loading branch information
Bizzonium committed Oct 6, 2024
1 parent 5d81376 commit 6668f0a
Show file tree
Hide file tree
Showing 70 changed files with 602 additions and 158 deletions.
3 changes: 0 additions & 3 deletions _maps/map_files/RandomZLevels/evil_santa.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@
/mob/living/simple_animal/pet/penguin/emperor{
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0);
faction = list("hostile","syndicate","winter");
minbodytemp = 0
},
/turf/simulated/floor/plating/ice/smooth,
/area/vision_change_area/awaymission/evil_santa_storm)
Expand Down Expand Up @@ -4533,7 +4532,6 @@
"MD" = (
/mob/living/simple_animal/pet/penguin/baby{
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0);
minbodytemp = 0
},
/turf/simulated/floor/plating/ice/smooth,
/area/vision_change_area/awaymission/evil_santa_storm)
Expand Down Expand Up @@ -5263,7 +5261,6 @@
"Sx" = (
/mob/living/simple_animal/pet/penguin/eldrich{
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0);
minbodytemp = 0
},
/turf/simulated/floor/plating/ice/smooth,
/area/vision_change_area/awaymission/evil_santa_storm)
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,9 @@
#define COMPONENT_RIDDEN_STOP_Z_MOVE 1
#define COMPONENT_RIDDEN_ALLOW_Z_MOVE 2

/// Source: /mob/living/simple_animal/handle_environment(datum/gas_mixture/environment)
#define COMSIG_ANIMAL_HANDLE_ENVIRONMENT "animal_handle_environment"

// /obj signals

///from base of obj/deconstruct(): (disassembled)
Expand Down
77 changes: 77 additions & 0 deletions code/datums/components/animal_temperature.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/datum/component/animal_temperature
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
/// Min body temp
var/minbodytemp
/// Max body temp
var/maxbodytemp
/// Damage when below min temp
var/cold_damage
/// Damage when above max temp
var/heat_damage
/// If true - alert will be shown
var/show_alert

/datum/component/animal_temperature/Initialize(
minbodytemp = 250,
maxbodytemp = 350,
cold_damage = 2,
heat_damage = 2,
show_alert = FALSE
)
if(!isanimal(parent))
return COMPONENT_INCOMPATIBLE

src.minbodytemp = minbodytemp
src.maxbodytemp = maxbodytemp
src.cold_damage = cold_damage
src.heat_damage = heat_damage
src.show_alert = show_alert

/datum/component/animal_temperature/RegisterWithParent()
RegisterSignal(parent, COMSIG_ANIMAL_HANDLE_ENVIRONMENT, PROC_REF(handle_environment))

/datum/component/animal_temperature/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_ANIMAL_HANDLE_ENVIRONMENT)

/datum/component/animal_temperature/proc/handle_environment(datum/source, datum/gas_mixture/environment)
SIGNAL_HANDLER

var/mob/living/simple_animal/animal = source

INVOKE_ASYNC(src, PROC_REF(regulate_temperature), animal, environment)
INVOKE_ASYNC(src, PROC_REF(check_temperature), animal)

/datum/component/animal_temperature/proc/regulate_temperature(mob/living/simple_animal/animal, datum/gas_mixture/environment)
var/areatemp = animal.get_temperature(environment)

if(abs(areatemp - animal.bodytemperature) > 5)
var/diff = areatemp - animal.bodytemperature
diff = diff / 5
animal.adjust_bodytemperature(diff)

return

/datum/component/animal_temperature/proc/check_temperature(mob/living/simple_animal/animal)
if(animal.bodytemperature < minbodytemp)
animal.adjustHealth(cold_damage)

if(show_alert)
animal.throw_alert("temp", /atom/movable/screen/alert/cold, get_severity(animal))

return TRUE

if(animal.bodytemperature > maxbodytemp)
animal.adjustHealth(heat_damage)

if(show_alert)
animal.throw_alert("temp", /atom/movable/screen/alert/hot, get_severity(animal))

return TRUE

animal.clear_alert("temp")
return FALSE

/datum/component/animal_temperature/proc/get_severity(mob/living/simple_animal/animal)
var/multiplier = animal.bodytemperature < minbodytemp ? (1 / minbodytemp) : (1 / maxbodytemp)
var/severity = CEILING(abs(animal.bodytemperature / multiplier), 1)
return min(severity, 3)
3 changes: 2 additions & 1 deletion code/datums/dog_fashion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@
..()
ADD_TRAIT(doggo, TRAIT_NO_BREATH, CORGI_HARDSUIT_TRAIT)
doggo.atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
doggo.minbodytemp = 0
var/datum/component/animal_temperature/temp = doggo.GetComponent(/datum/component/animal_temperature)
temp?.minbodytemp = 0

/datum/dog_fashion/head/fried_vox_empty
name = "Colonel REAL_NAME"
Expand Down
17 changes: 13 additions & 4 deletions code/game/gamemodes/blob/blobs/blob_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
faction = list(ROLE_BLOB)
bubble_icon = "blob"
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 0
maxbodytemp = 360
universal_speak = 1 //So mobs can understand them when a blob uses Blob Broadcast
sentience_type = SENTIENCE_OTHER
gold_core_spawnable = NO_SPAWN
Expand All @@ -21,6 +19,13 @@
var/mob/camera/blob/overmind = null
tts_seed = "Earth"

/mob/living/simple_animal/hostile/blob/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
maxbodytemp = 360, \
minbodytemp = 0, \
)

/mob/living/simple_animal/hostile/blob/proc/adjustcolors(var/a_color)
if(a_color)
color = a_color
Expand Down Expand Up @@ -184,8 +189,6 @@
attacktext = "ударяет"
attack_sound = 'sound/effects/blobattack.ogg'
speak_emote = list("gurgles")
minbodytemp = 0
maxbodytemp = 360
force_threshold = 10
mob_size = MOB_SIZE_LARGE
environment_smash = ENVIRONMENT_SMASH_STRUCTURES
Expand All @@ -195,6 +198,12 @@
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
move_resist = MOVE_FORCE_OVERPOWERING

/mob/living/simple_animal/hostile/ancient_robot_leg/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
minbodytemp = 0, \
maxbodytemp = 360, \
)

/mob/living/simple_animal/hostile/blob/blobbernaut/Initialize(mapload)
. = ..()
Expand Down
15 changes: 13 additions & 2 deletions code/game/gamemodes/clockwork/clockwork_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
attack_sound = 'sound/weapons/bladeslice.ogg'
tts_seed = "Earth"
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 0
pressure_resistance = 100
a_intent = INTENT_HARM
stop_automated_movement = TRUE
Expand All @@ -32,6 +31,12 @@
light_power = 1.1
var/deflect_chance = 30

/mob/living/simple_animal/hostile/clockwork/marauder/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
minbodytemp = 0, \
)

/mob/living/simple_animal/hostile/clockwork/marauder/hostile
AIStatus = AI_ON

Expand Down Expand Up @@ -128,12 +133,18 @@
icon_resting = "mouse_clockwork_sleep"
icon = 'icons/mob/clockwork_mobs.dmi'
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 0
pressure_resistance = 100
universal_speak = 1
gold_core_spawnable = NO_SPAWN
tts_seed = "Earth"

/mob/living/simple_animal/mouse/clockwork/ComponentInitialize()
. = ..()
AddComponent( \
/datum/component/animal_temperature, \
minbodytemp = 0, \
)

/mob/living/simple_animal/mouse/clockwork/handle_automated_action()
if(!isturf(loc))
return
Expand Down
9 changes: 7 additions & 2 deletions code/game/gamemodes/devil/imp/imp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
status_flags = CANPUSH
attack_sound = 'sound/misc/demon_attack1.ogg'
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 250 //Weak to cold
maxbodytemp = INFINITY
faction = list("hell")
attacktext = "неистово терзает"
maxHealth = 200
Expand All @@ -35,6 +33,13 @@
of intentionally harming a fellow devil.</B>"


/mob/living/simple_animal/imp/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
minbodytemp = 250, \
maxbodytemp = INFINITY, \
)

/mob/living/simple_animal/imp/Initialize(mapload)
. = ..()
add_movespeed_modifier(/datum/movespeed_modifier/imp_boost)
Expand Down
9 changes: 7 additions & 2 deletions code/game/gamemodes/miniantags/borer/borer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@
speed = 5

atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 0
maxbodytemp = 1500

var/static/list/borer_names = list(
"Primary", "Secondary", "Tertiary", "Quaternary", "Quinary", "Senary",
Expand Down Expand Up @@ -154,6 +152,13 @@
truename = "[borer_names[min(generation, borer_names.len)]] [rand(1000,9999)]"
GrantBorerActions()

/mob/living/simple_animal/borer/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
maxbodytemp = 1500, \
minbodytemp = 0, \
)

/mob/living/simple_animal/borer/attack_ghost(mob/user)
if(cannotPossess(user))
to_chat(user, span_boldnotice("Upon using the antagHUD you forfeited the ability to join the round."))
Expand Down
9 changes: 7 additions & 2 deletions code/game/gamemodes/miniantags/bot_swarm/swarmer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@
icon_gib = null
wander = 0
harm_intent_damage = 5
minbodytemp = 0
maxbodytemp = 500
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
unsuitable_atmos_damage = 0
melee_damage_lower = 15
Expand Down Expand Up @@ -107,6 +105,13 @@
var/resources = 0 //Resource points, generated by consuming metal/glass
var/max_resources = 200

/mob/living/simple_animal/hostile/swarmer/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
maxbodytemp = 500, \
minbodytemp = 0, \
)

/mob/living/simple_animal/hostile/swarmer/Login()
..()
to_chat(src, "<b>You are a swarmer, a weapon of a long dead civilization. Until further orders from your original masters are received, you must continue to consume and replicate.</b>")
Expand Down
8 changes: 6 additions & 2 deletions code/game/gamemodes/miniantags/demons/demon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
attack_sound = 'sound/misc/demon_attack1.ogg'
death_sound = 'sound/misc/demon_dies.ogg'
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 0
maxbodytemp = INFINITY
faction = list(ROLE_DEMON)
attacktext = "неистово терзает"
maxHealth = 200
Expand All @@ -44,6 +42,12 @@
whisper_action.Grant(src)
addtimer(CALLBACK(src, PROC_REF(attempt_objectives)), 5 SECONDS)

/mob/living/simple_animal/demon/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
maxbodytemp = INFINITY, \
minbodytemp = 0, \
)

/mob/living/simple_animal/demon/Destroy()
if(mind)
Expand Down
9 changes: 7 additions & 2 deletions code/game/gamemodes/miniantags/guardian/guardian.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
stop_automated_movement = 1
universal_speak = TRUE
attack_sound = 'sound/weapons/punch1.ogg'
minbodytemp = 0
maxbodytemp = INFINITY
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
attacktext = "бьёт"
maxHealth = INFINITY //The spirit itself is invincible
Expand Down Expand Up @@ -54,6 +52,13 @@
summoner = host
host.grant_guardian_actions(src)

/mob/living/simple_animal/hostile/guardian/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
maxbodytemp = INFINITY, \
minbodytemp = 0, \
)

/mob/living/simple_animal/hostile/guardian/med_hud_set_health()
if(summoner)
var/image/holder = hud_list[HEALTH_HUD]
Expand Down
6 changes: 5 additions & 1 deletion code/game/gamemodes/miniantags/morph/morph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)

minbodytemp = 0
maxHealth = 150
health = 150
environment_smash = 1
Expand Down Expand Up @@ -85,6 +84,11 @@
GLOB.morphs_alive_list += src
check_morphs()

/mob/living/simple_animal/hostile/morph/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
minbodytemp = 0, \
)

/**
* This proc enables or disables morph reproducing ability
Expand Down
8 changes: 6 additions & 2 deletions code/game/gamemodes/miniantags/revenant/revenant.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
response_disarm = "swings at"
response_harm = "punches"
unsuitable_atmos_damage = 0
minbodytemp = 0
maxbodytemp = INFINITY
harm_intent_damage = 0
friendly = "touches"
status_flags = 0
Expand Down Expand Up @@ -62,6 +60,12 @@
ADD_TRAIT(src, TRAIT_NO_FLOATING_ANIM, INNATE_TRAIT)
AddElement(/datum/element/simple_flying)

/mob/living/simple_animal/revenant/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
maxbodytemp = INFINITY, \
minbodytemp = 0, \
)

/mob/living/simple_animal/revenant/Life(seconds, times_fired)
..()
Expand Down
9 changes: 7 additions & 2 deletions code/game/gamemodes/shadowling/ascendant_shadowling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
attacktext = "кромсает"
attack_sound = 'sound/weapons/slash.ogg'

minbodytemp = 0
maxbodytemp = INFINITY
environment_smash = ENVIRONMENT_SMASH_RWALLS

faction = list("faithless")
Expand All @@ -43,6 +41,13 @@
icon_living = "NurnKal"
update_icon(UPDATE_OVERLAYS)

/mob/living/simple_animal/ascendant_shadowling/ComponentInitialize()
AddComponent( \
/datum/component/animal_temperature, \
maxbodytemp = INFINITY, \
minbodytemp = 0, \
)

/mob/living/simple_animal/ascendant_shadowling/Process_Spacemove(movement_dir = NONE, continuous_move = FALSE)
return TRUE //copypasta from carp code

Expand Down
5 changes: 3 additions & 2 deletions code/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,10 @@
occupantData["temperatureSuitability"] = 1
else if(isanimal(occupant))
var/mob/living/simple_animal/silly = occupant
if(silly.bodytemperature < silly.minbodytemp)
var/datum/component/animal_temperature/temp = silly.GetComponent(/datum/component/animal_temperature)
if(silly.bodytemperature < temp?.minbodytemp)
occupantData["temperatureSuitability"] = -3
else if(silly.bodytemperature > silly.maxbodytemp)
else if(silly.bodytemperature > temp?.maxbodytemp)
occupantData["temperatureSuitability"] = 3
// Blast you, imperial measurement system
occupantData["btCelsius"] = occupant.bodytemperature - T0C
Expand Down
Loading

0 comments on commit 6668f0a

Please sign in to comment.