Skip to content

Commit

Permalink
[MIRROR] Fixes space heater power usage (#1634)
Browse files Browse the repository at this point in the history
* Fixes space heater power usage

* Prepare for merge master

* restore mirror

---------

Co-authored-by: lessthanthree <[email protected]>
Co-authored-by: SomeRandomOwl <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Mar 28, 2024
1 parent ce6dafa commit 60c5030
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions code/game/machinery/spaceheater.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@
var/set_mode = HEATER_MODE_AUTO
///The temperature we trying to get to
var/target_temperature = T20C
///How much heat/cold we can deliver per tier
var/base_heating_power = 40 KILO JOULES

Check failure on line 31 in code/game/machinery/spaceheater.dm

View workflow job for this annotation

GitHub Actions / Run Linters

got 'KILO', expected one of: operator, field access, as, 'in', ';'
///How much heat/cold we can deliver
var/heating_power = 40000
var/heating_power = 40 KILO JOULES
///How efficiently we can deliver that heat/cold (higher indicates less cell consumption)
<<<<<<< HEAD
var/efficiency = 20000
=======
var/efficiency = 20
>>>>>>> d508152e7da ([MIRROR] Fixes space heater power usage (#1634))
///The amount of degrees above and below the target temperature for us to change mode to heater or cooler
var/temperature_tolerance = 1
///What's the middle point of our settable temperature (30 °C)
Expand Down Expand Up @@ -93,9 +99,16 @@
if(cell)
. += "The charge meter reads [cell ? round(cell.percent(), 1) : 0]%."
else
. += "There is no power cell installed."
. += span_warning("There is no power cell installed.")
if(in_range(user, src) || isobserver(user))
<<<<<<< HEAD
. += span_notice("The status display reads: Temperature range at <b>[settable_temperature_range]°C</b>.<br>Heating power at <b>[siunit(heating_power, "W", 1)]</b>.<br>Power consumption at <b>[(efficiency*-0.0025)+150]%</b>.") //100%, 75%, 50%, 25%
=======
var/target_temp = round(target_temperature - T0C, 1)
var/min_temp = max(settable_temperature_median - settable_temperature_range, TCMB) - T0C
var/max_temp = settable_temperature_median + settable_temperature_range - T0C
. += span_info("The status display reads:<br>Heating power: <b>[siunit(heating_power, "W", 1)] at [(efficiency / 20) * 100]% efficiency.</b><br>Target temperature: <b>[target_temp]°C \[[min_temp]°C - [max_temp]°C]</b>") // Base efficiency 100%, higher with upgraded components
>>>>>>> d508152e7da ([MIRROR] Fixes space heater power usage (#1634))
. += span_notice("<b>Right-click</b> to toggle [on ? "off" : "on"].")

/obj/machinery/space_heater/update_icon_state()
Expand Down Expand Up @@ -154,12 +167,15 @@
var/delta_temperature = required_energy / heat_capacity
if(mode == HEATER_MODE_COOL)
delta_temperature *= -1
if(delta_temperature)
for (var/turf/open/turf in ((local_turf.atmos_adjacent_turfs || list()) + local_turf))
var/datum/gas_mixture/turf_gasmix = turf.return_air()
turf_gasmix.temperature += delta_temperature
air_update_turf(FALSE, FALSE)
cell.use(required_energy / efficiency)

if(delta_temperature == 0)
return

for(var/turf/open/turf in ((local_turf.atmos_adjacent_turfs || list()) + local_turf))
var/datum/gas_mixture/turf_gasmix = turf.return_air()
turf_gasmix.temperature += delta_temperature
air_update_turf(FALSE, FALSE)
cell.use(required_energy / efficiency)

/obj/machinery/space_heater/RefreshParts()
. = ..()
Expand All @@ -170,10 +186,14 @@
for(var/datum/stock_part/capacitor/capacitor in component_parts)
cap += capacitor.tier

heating_power = laser * 40000
heating_power = laser * base_heating_power

settable_temperature_range = cap * 30
<<<<<<< HEAD
efficiency = (cap + 1) * 10000
=======
efficiency = (cap + 1) * 10
>>>>>>> d508152e7da ([MIRROR] Fixes space heater power usage (#1634))

target_temperature = clamp(target_temperature,
max(settable_temperature_median - settable_temperature_range, TCMB),
Expand Down Expand Up @@ -459,7 +479,11 @@
max(settable_temperature_median - settable_temperature_range, TCMB),
settable_temperature_median + settable_temperature_range)

<<<<<<< HEAD
chem_heating_power = efficiency/20000 //1-2.5
=======
chem_heating_power = efficiency / 20
>>>>>>> d508152e7da ([MIRROR] Fixes space heater power usage (#1634))

#undef HEATER_MODE_STANDBY
#undef HEATER_MODE_HEAT
Expand Down

0 comments on commit 60c5030

Please sign in to comment.