mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-18 14:12:20 +00:00
Atmos control auto-update fixes
Air alarms now auto-refresh and have a mechanism to heat or cool rooms. Space heaters can both heat and cool rooms
This commit is contained in:
@@ -13,9 +13,19 @@
|
|||||||
var/overridden = 0 //not set yet, can't think of a good way to do it
|
var/overridden = 0 //not set yet, can't think of a good way to do it
|
||||||
req_access = list(access_ce)
|
req_access = list(access_ce)
|
||||||
|
|
||||||
|
|
||||||
|
/obj/machinery/computer/atmoscontrol/attack_ai(var/mob/user as mob)
|
||||||
|
return interact(user)
|
||||||
|
|
||||||
|
/obj/machinery/computer/atmoscontrol/attack_paw(var/mob/user as mob)
|
||||||
|
return interact(user)
|
||||||
|
|
||||||
/obj/machinery/computer/atmoscontrol/attack_hand(mob/user)
|
/obj/machinery/computer/atmoscontrol/attack_hand(mob/user)
|
||||||
if(..())
|
if(..())
|
||||||
return
|
return
|
||||||
|
return interact(user)
|
||||||
|
|
||||||
|
/obj/machinery/computer/atmoscontrol/interact(mob/user)
|
||||||
user.set_machine(src)
|
user.set_machine(src)
|
||||||
if(allowed(user))
|
if(allowed(user))
|
||||||
overridden = 1
|
overridden = 1
|
||||||
@@ -62,7 +72,6 @@
|
|||||||
return
|
return
|
||||||
if(href_list["reset"])
|
if(href_list["reset"])
|
||||||
current = null
|
current = null
|
||||||
src.updateUsrDialog()
|
|
||||||
if(href_list["alarm"])
|
if(href_list["alarm"])
|
||||||
current = locate(href_list["alarm"])
|
current = locate(href_list["alarm"])
|
||||||
if(href_list["command"])
|
if(href_list["command"])
|
||||||
@@ -129,6 +138,11 @@
|
|||||||
selected[2] = selected[4]
|
selected[2] = selected[4]
|
||||||
if(selected[3] > selected[4])
|
if(selected[3] > selected[4])
|
||||||
selected[3] = selected[4]
|
selected[3] = selected[4]
|
||||||
|
|
||||||
|
//Sets the temperature the built-in heater/cooler tries to maintain.
|
||||||
|
if(env == "temperature")
|
||||||
|
current.target_temperature = (selected[2] + selected[3])/2
|
||||||
|
|
||||||
spawn(1)
|
spawn(1)
|
||||||
updateUsrDialog()
|
updateUsrDialog()
|
||||||
return
|
return
|
||||||
@@ -167,7 +181,7 @@
|
|||||||
spawn(5)
|
spawn(5)
|
||||||
src.updateUsrDialog()
|
src.updateUsrDialog()
|
||||||
return
|
return
|
||||||
src.updateUsrDialog()
|
updateUsrDialog()
|
||||||
|
|
||||||
//copypasta from alarm code, changed to work with this without derping hard
|
//copypasta from alarm code, changed to work with this without derping hard
|
||||||
//---START COPYPASTA----
|
//---START COPYPASTA----
|
||||||
@@ -185,7 +199,7 @@
|
|||||||
output += {"
|
output += {"
|
||||||
<a href='?src=\ref[src];alarm=\ref[current];screen=[AALARM_SCREEN_SCRUB]'>Scrubbers Control</a><br>
|
<a href='?src=\ref[src];alarm=\ref[current];screen=[AALARM_SCREEN_SCRUB]'>Scrubbers Control</a><br>
|
||||||
<a href='?src=\ref[src];alarm=\ref[current];screen=[AALARM_SCREEN_VENT]'>Vents Control</a><br>
|
<a href='?src=\ref[src];alarm=\ref[current];screen=[AALARM_SCREEN_VENT]'>Vents Control</a><br>
|
||||||
<a href='?src=\ref[src];alarm=\ref[current];screen=[AALARM_SCREEN_MODE]'>Set envirenomentals mode</a><br>
|
<a href='?src=\ref[src];alarm=\ref[current];screen=[AALARM_SCREEN_MODE]'>Set environmental mode</a><br>
|
||||||
<a href='?src=\ref[src];alarm=\ref[current];screen=[AALARM_SCREEN_SENSORS]'>Sensor Control</a><br>
|
<a href='?src=\ref[src];alarm=\ref[current];screen=[AALARM_SCREEN_SENSORS]'>Sensor Control</a><br>
|
||||||
<HR>
|
<HR>
|
||||||
"}
|
"}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#define AALARM_MODE_SCRUBBING 1
|
#define AALARM_MODE_SCRUBBING 1
|
||||||
#define AALARM_MODE_REPLACEMENT 2 //like scrubbing, but faster.
|
#define AALARM_MODE_REPLACEMENT 2 //like scrubbing, but faster.
|
||||||
#define AALARM_MODE_PANIC 3 //constantly sucks all air
|
#define AALARM_MODE_PANIC 3 //constantly sucks all air
|
||||||
#define AALARM_MODE_CYCLE 4 //sucks off all air, then refill and swithes to scrubbing
|
#define AALARM_MODE_CYCLE 4 //sucks off all air, then refill and switches to scrubbing
|
||||||
#define AALARM_MODE_FILL 5 //emergency fill
|
#define AALARM_MODE_FILL 5 //emergency fill
|
||||||
|
|
||||||
#define AALARM_SCREEN_MAIN 1
|
#define AALARM_SCREEN_MAIN 1
|
||||||
@@ -46,6 +46,9 @@
|
|||||||
#define RCON_AUTO 2
|
#define RCON_AUTO 2
|
||||||
#define RCON_YES 3
|
#define RCON_YES 3
|
||||||
|
|
||||||
|
//1000 joules equates to about 1 degree every 2 seconds for a single tile of air.
|
||||||
|
#define MAX_ENERGY_CHANGE 2000
|
||||||
|
|
||||||
//all air alarms in area are connected via magic
|
//all air alarms in area are connected via magic
|
||||||
/area
|
/area
|
||||||
var/obj/machinery/alarm/master_air_alarm
|
var/obj/machinery/alarm/master_air_alarm
|
||||||
@@ -82,6 +85,9 @@
|
|||||||
var/area/alarm_area
|
var/area/alarm_area
|
||||||
var/danger_level = 0
|
var/danger_level = 0
|
||||||
|
|
||||||
|
var/target_temperature = T0C+20
|
||||||
|
var/regulating_temperature = 0
|
||||||
|
|
||||||
var/datum/radio_frequency/radio_connection
|
var/datum/radio_frequency/radio_connection
|
||||||
|
|
||||||
var/list/TLV = list()
|
var/list/TLV = list()
|
||||||
@@ -95,6 +101,7 @@
|
|||||||
TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
|
TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
|
||||||
TLV["pressure"] = list(0,ONE_ATMOSPHERE*0.10,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60) /* kpa */
|
TLV["pressure"] = list(0,ONE_ATMOSPHERE*0.10,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60) /* kpa */
|
||||||
TLV["temperature"] = list(20, 40, 140, 160) // K
|
TLV["temperature"] = list(20, 40, 140, 160) // K
|
||||||
|
target_temperature = 90
|
||||||
|
|
||||||
New()
|
New()
|
||||||
..()
|
..()
|
||||||
@@ -111,7 +118,7 @@
|
|||||||
TLV["plasma"] = list(-1.0, -1.0, 0.2, 0.5) // Partial pressure, kpa
|
TLV["plasma"] = list(-1.0, -1.0, 0.2, 0.5) // Partial pressure, kpa
|
||||||
TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
|
TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa
|
||||||
TLV["pressure"] = list(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.10,ONE_ATMOSPHERE*1.20) /* kpa */
|
TLV["pressure"] = list(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.10,ONE_ATMOSPHERE*1.20) /* kpa */
|
||||||
TLV["temperature"] = list(T0C, T0C+10, T0C+40, T0C+66) // K
|
TLV["temperature"] = list(T0C-26, T0C, T0C+40, T0C+66) // K
|
||||||
|
|
||||||
initialize()
|
initialize()
|
||||||
set_frequency(frequency)
|
set_frequency(frequency)
|
||||||
@@ -151,6 +158,41 @@
|
|||||||
current_settings = TLV["temperature"]
|
current_settings = TLV["temperature"]
|
||||||
var/temperature_dangerlevel = get_danger_level(environment.temperature, current_settings)
|
var/temperature_dangerlevel = get_danger_level(environment.temperature, current_settings)
|
||||||
|
|
||||||
|
//Handle temperature adjustment here.
|
||||||
|
if(temperature_dangerlevel || regulating_temperature)
|
||||||
|
//If it goes too far, we should adjust ourselves back before stopping.
|
||||||
|
if(!regulating_temperature)
|
||||||
|
regulating_temperature = 1
|
||||||
|
visible_message("\The [src] clicks as it starts [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
|
||||||
|
"You hear a click and a faint electronic hum.")
|
||||||
|
|
||||||
|
if(target_temperature > T0C + 90)
|
||||||
|
target_temperature = T0C + 90
|
||||||
|
|
||||||
|
if(target_temperature < T0C - 40)
|
||||||
|
target_temperature = T0C - 40
|
||||||
|
|
||||||
|
var/datum/gas_mixture/gas = location.remove_air(0.25*environment.total_moles)
|
||||||
|
var/heat_capacity = gas.heat_capacity()
|
||||||
|
var/energy_used = max( abs( heat_capacity*(gas.temperature - target_temperature) ), MAX_ENERGY_CHANGE)
|
||||||
|
|
||||||
|
//Use power. Assuming that each power unit represents 1000 watts....
|
||||||
|
use_power(energy_used/1000, ENVIRON)
|
||||||
|
|
||||||
|
//We need to cool ourselves.
|
||||||
|
if(environment.temperature > target_temperature)
|
||||||
|
gas.temperature -= energy_used/heat_capacity
|
||||||
|
else
|
||||||
|
gas.temperature -= energy_used/heat_capacity
|
||||||
|
|
||||||
|
environment.merge(gas)
|
||||||
|
|
||||||
|
if(abs(environment.temperature - target_temperature) <= 0.5)
|
||||||
|
regulating_temperature = 0
|
||||||
|
visible_message("\The [src] clicks quietly as it stops [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
|
||||||
|
"You hear a click as a faint electronic humming stops.")
|
||||||
|
|
||||||
|
|
||||||
var/old_danger_level = danger_level
|
var/old_danger_level = danger_level
|
||||||
danger_level = max(pressure_dangerlevel,
|
danger_level = max(pressure_dangerlevel,
|
||||||
oxygen_dangerlevel,
|
oxygen_dangerlevel,
|
||||||
@@ -513,11 +555,16 @@
|
|||||||
//END HACKING//
|
//END HACKING//
|
||||||
///////////////
|
///////////////
|
||||||
|
|
||||||
|
attack_ai(mob/user)
|
||||||
|
return interact(user)
|
||||||
|
|
||||||
attack_hand(mob/user)
|
attack_hand(mob/user)
|
||||||
. = ..()
|
. = ..()
|
||||||
if (.)
|
if (.)
|
||||||
return
|
return
|
||||||
|
return interact(user)
|
||||||
|
|
||||||
|
interact(mob/user)
|
||||||
user.set_machine(src)
|
user.set_machine(src)
|
||||||
|
|
||||||
if ( (get_dist(src, user) > 1 ))
|
if ( (get_dist(src, user) > 1 ))
|
||||||
@@ -900,6 +947,11 @@ table tr:first-child th:first-child { border: none;}
|
|||||||
selected[2] = selected[4]
|
selected[2] = selected[4]
|
||||||
if(selected[3] > selected[4])
|
if(selected[3] > selected[4])
|
||||||
selected[3] = selected[4]
|
selected[3] = selected[4]
|
||||||
|
|
||||||
|
//Sets the temperature the built-in heater/cooler tries to maintain.
|
||||||
|
if(env == "temperature")
|
||||||
|
target_temperature = (selected[2] + selected[3])/2
|
||||||
|
|
||||||
apply_mode()
|
apply_mode()
|
||||||
|
|
||||||
if(href_list["screen"])
|
if(href_list["screen"])
|
||||||
|
|||||||
@@ -83,6 +83,10 @@
|
|||||||
|
|
||||||
attack_hand(mob/user as mob)
|
attack_hand(mob/user as mob)
|
||||||
src.add_fingerprint(user)
|
src.add_fingerprint(user)
|
||||||
|
interact(user)
|
||||||
|
|
||||||
|
interact(mob/user as mob)
|
||||||
|
|
||||||
if(open)
|
if(open)
|
||||||
|
|
||||||
var/dat
|
var/dat
|
||||||
@@ -127,7 +131,7 @@
|
|||||||
var/value = text2num(href_list["val"])
|
var/value = text2num(href_list["val"])
|
||||||
|
|
||||||
// limit to 20-90 degC
|
// limit to 20-90 degC
|
||||||
set_temperature = dd_range(20, 90, set_temperature + value)
|
set_temperature = dd_range(0, 90, set_temperature + value)
|
||||||
|
|
||||||
if("cellremove")
|
if("cellremove")
|
||||||
if(open && cell && !usr.get_active_hand())
|
if(open && cell && !usr.get_active_hand())
|
||||||
@@ -164,7 +168,7 @@
|
|||||||
var/turf/simulated/L = loc
|
var/turf/simulated/L = loc
|
||||||
if(istype(L))
|
if(istype(L))
|
||||||
var/datum/gas_mixture/env = L.return_air()
|
var/datum/gas_mixture/env = L.return_air()
|
||||||
if(env.temperature < (set_temperature+T0C))
|
if(env.temperature != set_temperature + T0C)
|
||||||
|
|
||||||
var/transfer_moles = 0.25 * env.total_moles()
|
var/transfer_moles = 0.25 * env.total_moles()
|
||||||
|
|
||||||
@@ -176,10 +180,12 @@
|
|||||||
|
|
||||||
var/heat_capacity = removed.heat_capacity()
|
var/heat_capacity = removed.heat_capacity()
|
||||||
//world << "heating ([heat_capacity])"
|
//world << "heating ([heat_capacity])"
|
||||||
if(heat_capacity == 0 || heat_capacity == null) // Added check to avoid divide by zero (oshi-) runtime errors -- TLE
|
if(heat_capacity) // Added check to avoid divide by zero (oshi-) runtime errors -- TLE
|
||||||
heat_capacity = 1
|
if(removed.temperature < set_temperature + T0C)
|
||||||
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000) // Added min() check to try and avoid wacky superheating issues in low gas scenarios -- TLE
|
removed.temperature = min(removed.temperature + heating_power/heat_capacity, 1000) // Added min() check to try and avoid wacky superheating issues in low gas scenarios -- TLE
|
||||||
cell.use(heating_power/20000)
|
else
|
||||||
|
removed.temperature = max(removed.temperature - heating_power/heat_capacity, TCMB)
|
||||||
|
cell.use(heating_power/20000)
|
||||||
|
|
||||||
//world << "now at [removed.temperature]"
|
//world << "now at [removed.temperature]"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user