diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm
index a8a65a9873a..23a5a69039b 100644
--- a/code/modules/clothing/spacesuits/rig/rig.dm
+++ b/code/modules/clothing/spacesuits/rig/rig.dm
@@ -15,6 +15,7 @@
req_one_access = list()
req_access = list()
w_class = 5
+ action_button_name = "Toggle Heatsink"
// These values are passed on to all component pieces.
armor = list(melee = 40, bullet = 5, laser = 20,energy = 5, bomb = 35, bio = 100, rad = 20)
@@ -54,6 +55,12 @@
var/image/mob_icon // Holder for on-mob icon.
var/list/installed_modules = list() // Power consumption/use bookkeeping.
+ // Cooling system vars.
+ var/cooling_on = 0 //is it turned on?
+ var/max_cooling = 15 // in degrees per second - probably don't need to mess with heat capacity here
+ var/charge_consumption = 2 // charge per second at max_cooling //more effective on a rig, because it's all built in already
+ var/thermostat = T20C
+
// Rig status vars.
var/open = 0 // Access panel status.
var/locked = 1 // Lock status.
@@ -94,6 +101,7 @@
usr << "The access panel is [locked? "locked" : "unlocked"]."
usr << "The maintenance panel is [open ? "open" : "closed"]."
usr << "Hardsuit systems are [offline ? "offline" : "online"]."
+ usr << "The cooling stystem is [cooling_on ? "active" : "inactive"]."
if(open)
usr << "It's equipped with [english_list(installed_modules)]."
@@ -302,8 +310,97 @@
piece.item_flags |= (STOPPRESSUREDAMAGE|AIRTIGHT)
update_icon(1)
-/obj/item/weapon/rig/process()
+/obj/item/weapon/rig/ui_action_click()
+ toggle_cooling(usr)
+/obj/item/weapon/rig/proc/toggle_cooling(var/mob/user)
+ if(cooling_on)
+ turn_cooling_off(user)
+ else
+ turn_cooling_on(user)
+
+/obj/item/weapon/rig/proc/turn_cooling_on(var/mob/user)
+ if(!cell)
+ return
+ if(cell.charge <= 0)
+ user << "\The [src] has no power!."
+ return
+ if(!suit_is_deployed())
+ user << "The hardsuit needs to be deployed first!."
+ return
+
+ cooling_on = 1
+ usr << "You switch \the [src]'s cooling system on."
+
+
+/obj/item/weapon/rig/proc/turn_cooling_off(var/mob/user, var/failed)
+ if(failed) visible_message("\The [src]'s cooling system clicks and whines as it powers down.")
+ else usr << "You switch \the [src]'s cooling system off."
+ cooling_on = 0
+
+/obj/item/weapon/rig/proc/get_environment_temperature()
+ if (ishuman(loc))
+ var/mob/living/carbon/human/H = loc
+ if(istype(H.loc, /obj/mecha))
+ var/obj/mecha/M = H.loc
+ return M.return_temperature()
+ else if(istype(H.loc, /obj/machinery/atmospherics/unary/cryo_cell))
+ var/obj/machinery/atmospherics/unary/cryo_cell/cryo = H.loc
+ return cryo.air_contents.temperature
+
+ var/turf/T = get_turf(src)
+ if(istype(T, /turf/space))
+ return 0 //space has no temperature, this just makes sure the cooling unit works in space
+
+ var/datum/gas_mixture/environment = T.return_air()
+ if (!environment)
+ return 0
+
+ return environment.temperature
+
+/obj/item/weapon/rig/proc/attached_to_back(mob/M)
+ if (!ishuman(M))
+ return 0
+
+ var/mob/living/carbon/human/H = M
+
+ if (!H.wear_suit || H.back != src)
+ return 0
+
+ return 1
+
+/obj/item/weapon/rig/proc/coolingProcess()
+ if (!cooling_on || !cell)
+ return
+
+ if (!ismob(loc))
+ return
+
+ if (!attached_to_back(loc)) //make sure the rig's not just in their hands
+ return
+
+ if (!suit_is_deployed()) //inbuilt systems only work on the suit they're designed to work on
+ return
+
+ var/mob/living/carbon/human/H = loc
+
+ var/efficiency = 1 - H.get_pressure_weakness() //you need to have a good seal for effective cooling
+ var/env_temp = get_environment_temperature() //wont save you from a fire
+ var/temp_adj = min(H.bodytemperature - max(thermostat, env_temp), max_cooling)
+
+ if (temp_adj < 0.5) //only cools, doesn't heat, also we don't need extreme precision
+ return
+
+ var/charge_usage = (temp_adj/max_cooling)*charge_consumption
+
+ H.bodytemperature -= temp_adj*efficiency
+
+ cell.use(charge_usage)
+
+ if(cell.charge <= 0)
+ turn_cooling_off(H, 1)
+
+/obj/item/weapon/rig/process()
// If we've lost any parts, grab them back.
var/mob/living/M
for(var/obj/item/piece in list(gloves,boots,helmet,chest))
@@ -312,6 +409,8 @@
M = piece.loc
M.unEquip(piece)
piece.forceMove(src)
+ // Run through cooling
+ coolingProcess()
if(!istype(wearer) || loc != wearer || wearer.back != src || canremove || !cell || cell.charge <= 0)
if(!cell || cell.charge <= 0)
diff --git a/html/changelogs/anewbe.yml b/html/changelogs/anewbe.yml
new file mode 100644
index 00000000000..553c159292c
--- /dev/null
+++ b/html/changelogs/anewbe.yml
@@ -0,0 +1,37 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+#################################
+
+# Your name.
+author: Anewbe
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - rscadd: "Hardsuits (RIGs) now have an inbuilt suit cooling system, toggled via HUD button. This only works when the hardsuit is fully deployed, and drains charge from its power cell."
+