Rigs now have suit coolers

This commit is contained in:
Anewbe
2016-08-27 15:44:12 -05:00
parent 75ebc5429c
commit ae17ac061d
2 changed files with 136 additions and 1 deletions

View File

@@ -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 ? "<font color='red'>offline</font>" : "<font color='green'>online</font>"]."
usr << "The cooling stystem is [cooling_on ? "active" : "inactive"]."
if(open)
usr << "It's equipped with [english_list(installed_modules)]."
@@ -302,8 +310,96 @@
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()
else
turn_cooling_on()
/obj/item/weapon/rig/proc/turn_cooling_on()
if(!cell)
return
if(cell.charge <= 0)
usr << "<span class='notice'>\The [src] has no power!.</span>"
return
if(!suit_is_deployed())
usr << "<span class='notice'>The hardsuit needs to be deployed first!.</span>"
return
cooling_on = 1
usr << "<span class='notice'>You switch \the [src]'s cooling system on.</span>"
/obj/item/weapon/rig/proc/turn_cooling_off(var/failed)
if(failed) visible_message("\The [src]'s cooling system clicks and whines as it powers down.")
else usr << "<span class='notice'>You switch \the [src]'s cooling system off.</span>"
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))
return H.loc: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(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 +408,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)

View File

@@ -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."