Files
Paradise/code/game/machinery/spaceheater.dm
Charlie NolanGitHubBurzahGDNAffectedArc07FunnyMan3595paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>warriorstar-orionGDN
d3584b1d1c LINDA -> MILLA (#25328)
* LINDA -> MILLA

* Tiles now change their atmos mode properly.

* Fixed a bug that made walls generate supercold air when deconstructed/destroyed.

* Apply suggestions from code review

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Begone, var!

* MILLA -> milla

* Lint.

* More lint.

* Prevent negative/NaN atmos from spreading.

* Made fires start more reliably.

* Undef what the rest should not see.

* Enums are nice.

* Match LINDA better.

* Debugging verbs.

* Debug verb fixes.

* Labelled more lavaland stuff with ATMOS_MODE_LAVALAND

* Block superconductivity on a couple more things for Lavaland.

* Updated milla.dll

* Lavaland map fixes.

* Missed a spot.

* Begone, var! (again)

* Add libmilla_ci.so for continuous integration tests.

* Install/contributing instructions for MILLA.

* Directional plasmaglass windows on shuttles shouldn't stop protecting from heat after moving.

* Banish bad naming.

* Better naming and debug stats for SSair.

* Apply suggestions from code review

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Magic numbers and formatting.

* Don't screw up the temperature during reactions.

* Efficiency and readability.

* Fix hotspots.

* Removed redundant safety (MILLA will already output an error)

* Optimizations.

* oops

* TGS build script update.

* Change API of gas_mixture and how you get one from a turf.

* Get in there.

* so many vars

* MILLA binary updates.

* Lint

* Made MT cost more honest.

* Gave MILLA a read-only mode.

* More read-only vs synchronized mode work.

* Even more.

* Synchronize disposals.

* Updated a bunch of stuff to use SSair.synchronize or GM.synchronize.

* MILLA <3 Tracy

* lint

* cargo fmt

* more lint

* Test needed MILLA sync.

* Silence atmos machinery that's behaving as intended, but continue objecting to other potential failures to synchronize.

* Push new MILLA DLL

* Build MILLA

* Update PR instructions for MILLA.

* Add some fancy plasmaglass windows to the Lifebringers' ship.

* The golems remembered that they should insulate *all* their engines.

* First round of TM bugfixes.

* Build MILLA

* fix two lavaland ruin turf types

* bunch more maps

* fixes milla ci and makes the interesting turf verb better

* Solid turfs can no longer conduct heat (for now...)

* Made indoor tiles in beach and winter biodomes not lavaland air.

* Re-added random IT teleport, adjusted warning message

* Fixed a tinted window on Lavaland to be a plasglass window instead.

* Made firelocks and holofans heatproof

* Made RPD auto-wrench pipes if you have a wrench in your offhand.

* Runtime fixes.

* Made visuals update more reliably.

* Lint

* Update .github/CONTRIBUTING.md

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Build MILLA

* The Syndicate have installed tiny fans on their research base.

* The syndicate have figured out how to make plastitanium windows heatproof.

* This is getting out of hand. Now there are two of them.

* Un-break the auto-wrenching that I broke before committing.

* Build MILLA

* Build MILLA

* Massive MILLA refactor, assorted bugfixes.

* Build MILLA

* Explicit typing.

* Less sleeping/blocking.

* Build MILLA

* Yes, yes, this part can sleep.

* Build MILLA

* SSair reporting improvements.

* Build MILLA

* Please do not dock twice and splat yourself.

* Build MILLA

* Pls to not make SM go nuts.

* Build MILLA

* Build MILLA

* Added stricter lower bounds on plasmafire, fixing perpetually-burning SM.

* Build MILLA

* Lint

* Temporary logging, begone.

* Build MILLA

* Prevent hotspot strobing.

* Add in radiate_to_spess behavior.

* Build MILLA

* progress

* Compiling is good.

* bugfixes

* Progress.

* Ruins update.

* This one exists.

* Fixup temporary hotspots to last longer than one tick.

* Add/fix comments.

* Cut the slash.

* Fix test.

* No sleep for you.

* Build MILLA

* Prevent nested MILLA safety from runtiming.

* Build MILLA

* Runtime fix.

* Build MILLA

* Fix canisters not updating icon when gas contents change.

* Build MILLA

* Build MILLA

* Fixed an issue that made mechs very cold on environment air.

* Build MILLA

* oops

* Build MILLA

* Walls can make loud noises again.

* Build MILLA

* Fixes a rare runtime.

* Build MILLA

* Update .github/DOWNLOADING.md

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Review suggestions

* Lint

* Build MILLA

* bound_mixtures now only contains mixtures that can be written

* Build MILLA

* Apply suggestions from code review

Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Build MILLA

* Restore the original async behavior of pyro anomalies.

* Build MILLA

* Build MILLA

* Make the safety assertion in /datum/milla_safe safer.

* Build MILLA

---------

Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>
Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Co-authored-by: paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
Co-authored-by: warriorstar-orion <orion@snowfrost.garden>
Co-authored-by: GDN <Roanrichards1@Gmail.com>
2024-06-09 07:18:11 +00:00

198 lines
5.6 KiB
Plaintext

/obj/machinery/space_heater
anchored = FALSE
density = TRUE
icon = 'icons/obj/atmos.dmi'
icon_state = "sheater0"
name = "space heater"
desc = "Made by Space Amish using traditional space techniques, this heater is guaranteed not to set the station on fire."
max_integrity = 250
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, RAD = 100, FIRE = 80, ACID = 10)
var/obj/item/stock_parts/cell/cell
var/on = FALSE
var/open = FALSE
var/set_temperature = 50 // in celcius, add T0C for kelvin
var/heating_power = 40000
/obj/machinery/space_heater/get_cell()
return cell
/obj/machinery/space_heater/Initialize(mapload)
. = ..()
cell = new /obj/item/stock_parts/cell(src)
update_icon()
return
/obj/machinery/space_heater/Destroy()
QDEL_NULL(cell)
return ..()
/obj/machinery/space_heater/update_icon_state()
icon_state = "sheater[on]"
/obj/machinery/space_heater/update_overlays()
. = ..()
if(open)
. += "sheater-open"
/obj/machinery/space_heater/examine(mob/user)
. = ..()
. += "The heater is [on ? "on" : "off"] and the hatch is [open ? "open" : "closed"]."
if(open)
. += "The power cell is [cell ? "installed" : "missing"]."
else
. += "The charge meter reads [cell ? round(cell.percent(),1) : 0]%"
/obj/machinery/space_heater/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
..(severity)
return
if(cell)
cell.emp_act(severity)
..(severity)
/obj/machinery/space_heater/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/stock_parts/cell))
if(open)
if(cell)
to_chat(user, "There is already a power cell inside.")
return
else
// insert cell
var/obj/item/stock_parts/cell/C = user.get_active_hand()
if(istype(C))
if(user.drop_item())
cell = C
C.forceMove(src)
C.add_fingerprint(user)
user.visible_message("<span class='notice'>[user] inserts a power cell into [src].</span>", "<span class='notice'>You insert the power cell into [src].</span>")
else
to_chat(user, "The hatch must be open to insert a power cell.")
return
else
return ..()
/obj/machinery/space_heater/screwdriver_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
open = !open
if(open)
SCREWDRIVER_OPEN_PANEL_MESSAGE
else
SCREWDRIVER_CLOSE_PANEL_MESSAGE
update_icon()
if(!open && user.machine == src)
user << browse(null, "window=spaceheater")
user.unset_machine()
/obj/machinery/space_heater/attack_hand(mob/user as mob)
src.add_fingerprint(user)
interact(user)
/obj/machinery/space_heater/interact(mob/user as mob)
if(open)
var/dat
dat = "Power cell: "
if(cell)
dat += "<a href='byond://?src=[UID()];op=cellremove'>Installed</a><br>"
else
dat += "<a href='byond://?src=[UID()];op=cellinstall'>Removed</a><br>"
dat += "Power Level: [cell ? round(cell.percent(),1) : 0]%<br><br>"
dat += "Set Temperature: "
dat += "<a href='byond://?src=[UID()];op=temp;val=-5'>-</a>"
dat += " [set_temperature]&deg;C "
dat += "<a href='byond://?src=[UID()];op=temp;val=5'>+</a><br>"
user.set_machine(src)
user << browse("<!DOCTYPE html><meta charset='utf-8'><head><title>Space Heater Control Panel</title></head><tt>[dat]</tt>", "window=spaceheater")
onclose(user, "spaceheater")
else
on = !on
user.visible_message("<span class='notice'>[user] switches [on ? "on" : "off"] [src].</span>","<span class='notice'>You switch [on ? "on" : "off"] [src].</span>")
update_icon()
return
/obj/machinery/space_heater/Topic(href, href_list)
if(..())
return 1
if((in_range(src, usr) && isturf(src.loc)) || (issilicon(usr)))
usr.set_machine(src)
switch(href_list["op"])
if("temp")
var/value = text2num(href_list["val"])
// limit to 20-90 degC
set_temperature = dd_range(0, 90, set_temperature + value)
if("cellremove")
if(open && cell && !usr.get_active_hand())
cell.update_icon()
usr.put_in_hands(cell)
cell.add_fingerprint(usr)
cell = null
usr.visible_message("<span class='notice'>[usr] removes the power cell from [src].</span>", "<span class='notice'>You remove the power cell from [src].</span>")
if("cellinstall")
if(open && !cell)
var/obj/item/stock_parts/cell/C = usr.get_active_hand()
if(istype(C))
usr.drop_item()
cell = C
C.loc = src
C.add_fingerprint(usr)
usr.visible_message("<span class='notice'>[usr] inserts a power cell into [src].</span>", "<span class='notice'>You insert the power cell into [src].</span>")
updateDialog()
else
usr << browse(null, "window=spaceheater")
usr.unset_machine()
return
/obj/machinery/space_heater/process()
var/datum/milla_safe/space_heater_process/milla = new()
milla.invoke_async(src)
/datum/milla_safe/space_heater_process
/datum/milla_safe/space_heater_process/on_run(obj/machinery/space_heater/heater)
if(heater.on)
if(heater.cell && heater.cell.charge > 0)
var/turf/simulated/L = get_turf(heater)
if(!istype(L))
return
var/datum/gas_mixture/env = get_turf_air(L)
if(env.temperature() == heater.set_temperature + T0C)
return
var/transfer_moles = 0.25 * env.total_moles()
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(!removed)
return
var/heat_capacity = removed.heat_capacity()
if(heat_capacity)
if(removed.temperature() < heater.set_temperature + T0C)
removed.set_temperature(min(removed.temperature() + heater.heating_power / heat_capacity, 1000))
else
removed.set_temperature(max(removed.temperature() - heater.heating_power / heat_capacity, TCMB))
heater.cell.use(heater.heating_power / 20000)
env.merge(removed)
else
heater.on = FALSE
heater.update_icon()