Skip to content

Commit

Permalink
Merge pull request #13 from noelle-lavenza/loaf-fix/alchemy-fix-two
Browse files Browse the repository at this point in the history
Fix heater temperature issues
  • Loading branch information
MistakeNot4892 authored Aug 17, 2024
2 parents 79523a1 + c404802 commit c3cb48a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
13 changes: 9 additions & 4 deletions code/game/atoms_temperature.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,21 @@
// Nullspace is room temperature, clearly.
return T20C

/// Returns the coefficient used for ambient temperature equalisation.
/// Mainly used to prevent vacuum from cooling down objects.
/atom/proc/get_ambient_temperature_coefficient()
if(isturf(loc))
//scale the thermal mass coefficient so that 1atm = 1x, 0atm = 0x, 10atm = 10x
return loc.return_air().return_pressure() / ONE_ATMOSPHERE
return 1

// TODO: move mob bodytemperature onto this proc.
/atom/proc/ProcessAtomTemperature()
SHOULD_NOT_SLEEP(TRUE)

// Get our ambient temperature if possible.
var/adjust_temp = get_ambient_temperature()
var/thermal_mass_coefficient = get_thermal_mass_coefficient()
if(isturf(loc))
//scale the thermal mass coefficient so that 1atm = 1x, 0atm = 0x, 10atm = 10x
thermal_mass_coefficient *= (loc.return_air().return_pressure() / ONE_ATMOSPHERE)
var/thermal_mass_coefficient = get_thermal_mass_coefficient() * get_ambient_temperature_coefficient()

// Determine if our temperature needs to change.
var/old_temp = temperature
Expand Down
14 changes: 6 additions & 8 deletions code/game/objects/structures/fires.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@
if(. && lit == FIRE_LIT)
refresh_affected_exterior_turfs()

/obj/structure/fire_source/proc/get_current_burn_temperature()
var/datum/gas_mixture/environment = return_air()
return max(environment?.temperature, last_fuel_burn_temperature)

/obj/structure/fire_source/proc/refresh_affected_exterior_turfs()

if(lit != FIRE_LIT)
Expand Down Expand Up @@ -380,22 +376,24 @@
return loc?.get_contained_external_atoms()

/obj/structure/fire_source/proc/get_effective_burn_temperature()
if(lit != FIRE_LIT)
return 0
var/draught_mult = get_draught_multiplier()
if(draught_mult <= 0)
return 0
var/ambient_temperature = get_ambient_temperature(absolute = TRUE)
// The effective burn temperature can't go below ambient (no cold flames) or above the actual burn temperature.
return clamp(last_fuel_burn_temperature * draught_mult, ambient_temperature, last_fuel_burn_temperature)
return clamp((last_fuel_burn_temperature - T0C) * draught_mult + T0C, ambient_temperature, last_fuel_burn_temperature)

// If absolute == TRUE, return our actual ambient temperature, otherwise return our effective burn temperature when lit.
/obj/structure/fire_source/get_ambient_temperature(absolute = FALSE)
. = ..()
if(absolute || lit != FIRE_LIT)
return ..() // just normal room temperature
return get_effective_burn_temperature() // heat up to our burn temperature

/obj/structure/fire_source/get_ambient_temperature_coefficient()
if(lit == FIRE_LIT)
return 1 // Don't use the turf coefficient!
return ..()

/obj/structure/fire_source/ProcessAtomTemperature()
. = ..()
if(lit == FIRE_LIT)
Expand Down

0 comments on commit c3cb48a

Please sign in to comment.