Various Delta Time Fixes (#21871)

Organs were being given ~3 seconds of DT per ~2 seconds of real time,
because they were being hit by Process() TWICE, once during processing
for the "Set of all objects", and again during processing for the "Set
of all mobs". No species was hit harder than this but IPCs, who suffered
from having wildly inconsistent temperature mechanics that seemingly
never matched the expected numbers.

I have actually tested this PR to verify that it works. I even went the
extra mile to more extensively test IPC temperature mechanics to find a
separate bug unrelated to DTs that was causing suit coolers to just
straight up not work at all (space suit or otherwise) on a majority of
all IPC subspecies. I then tested the numbers in the PR for IPC cooling
to verify that things work as intended.

<img width="969" height="623" alt="image"
src="https://github.com/user-attachments/assets/01c3aca7-b436-4e52-86f7-aed847dcba5e"
/>

I also tweaked all the subsystems to have a small performance
improvement.

---------

Signed-off-by: VMSolidus <evilexecutive@gmail.com>
This commit is contained in:
VMSolidus
2026-02-26 20:28:20 -05:00
committed by GitHub
parent 8e602afb32
commit 1423fcd04e
19 changed files with 75 additions and 74 deletions
@@ -22,8 +22,11 @@
/// The power consumed when we are cooling down.
var/base_power_consumption = 8
/// The passive temperature change. Basically, cooling units counteract an IPC's passive temperature gain. But the IPC's temperature goes to get itself fucked if the cooling unit dies.
/// Remember, can be negative or positive. Depends on what we're trying to stabilize towards.
/**
* The passive temperature change in "Degrees Kelvin Per Second". This is reduced by a variety of conditions.
* Basically, cooling units counteract an IPC's passive temperature gain. But the IPC's temperature goes to get itself fucked if the cooling unit dies.
* Remember, can be negative or positive. Depends on what we're trying to stabilize towards.
*/
var/passive_temp_change = 2
/// The temperature that this cooling unit tries to regulate towards.
var/thermostat = T20C
@@ -41,6 +44,8 @@
var/safety_burnt = FALSE
/// If the thermostat is locked and thus cannot be changed. Used for spooky effects, like the high integrity damage in the positronic brain.
var/locked_thermostat = FALSE
/// The amount of degrees kelvin (per second) of heat the cooling unit will generate if it is blocked by a space suit.
var/spacesuited_heat_per_second = 5
/obj/item/organ/internal/machine/cooling_unit/Initialize()
. = ..()
@@ -138,13 +143,11 @@
if(prob(owner.bodytemperature * 0.1))
take_internal_damage(owner.bodytemperature * 0.01)
var/temperature_change = passive_temp_change
var/temperature_change = passive_temp_change * seconds_per_tick
if(owner.wear_suit)
if(!spaceproof && istype(owner.wear_suit, /obj/item/clothing/suit/space))
//cooling is going to SUCK if you have heat-regulating clothes
if(owner.bodytemperature < species.heat_level_3)
owner.bodytemperature = min(owner.bodytemperature + 5, owner.species.heat_level_2)
temperature_change *= 0.5
temperature_change *= 0.5
// Check if there is somehow no air, or if we are in an ambient without enough air to properly cool us.
if((!ambient || (ambient && owner.calculate_affecting_pressure(XGM_PRESSURE(ambient)) < owner.species.warning_low_pressure)))
@@ -365,14 +365,14 @@
else
owner.robot_pain.icon_state = null
/obj/item/organ/internal/machine/posibrain/low_integrity_damage(integrity)
/obj/item/organ/internal/machine/posibrain/low_integrity_damage(integrity, seconds_per_tick)
var/damage_probability = get_integrity_damage_probability(integrity)
if(prob(damage_probability))
if(SPT_PROB(damage_probability, seconds_per_tick))
to_chat(owner, SPAN_MACHINE_WARNING("Neural pathway error located at block 0x[generate_hex()]."))
take_internal_damage(2)
. = ..()
/obj/item/organ/internal/machine/posibrain/medium_integrity_damage(integrity)
/obj/item/organ/internal/machine/posibrain/medium_integrity_damage(integrity, seconds_per_tick)
var/damage_probability = get_integrity_damage_probability(integrity)
var/list/static/medium_integrity_damage_messages = list(
"Your neural subroutines' alarms are all going off at once.",
@@ -381,14 +381,14 @@
"Your software warns you of dangerously low neural coherence.",
"Your self-preservation subroutines threaten to kick in. [SPAN_DANGER("WARNING. WARNING.")]"
)
if(prob(damage_probability))
if(SPT_PROB(damage_probability, seconds_per_tick))
to_chat(owner, SPAN_MACHINE_WARNING(pick(medium_integrity_damage_messages)))
take_internal_damage(2)
. = ..()
/obj/item/organ/internal/machine/posibrain/high_integrity_damage(integrity)
/obj/item/organ/internal/machine/posibrain/high_integrity_damage(integrity, seconds_per_tick)
var/damage_probability = get_integrity_damage_probability(integrity)
if(prob(damage_probability))
if(SPT_PROB(damage_probability, seconds_per_tick))
var/damage_roll = rand(1, 50)
switch(damage_roll)
if(1 to 10)