mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-22 04:28:33 +01:00
Improves Area Atmos Computer
As in, the heavy scrubber controller computer. This adds a 'tag' version as well, that allows you to map in specific tagged ("scrubber_tag") computers so you can more accurately control what scrubber goes where. For example, if you had a map that was mostly phoron airlocks!!!
This commit is contained in:
@@ -6,177 +6,155 @@
|
||||
light_color = "#e6ffff"
|
||||
circuit = /obj/item/weapon/circuitboard/area_atmos
|
||||
|
||||
var/list/connectedscrubbers = new()
|
||||
var/list/connectedscrubbers = list()
|
||||
var/status = ""
|
||||
|
||||
var/range = 25
|
||||
|
||||
//Simple variable to prevent me from doing attack_hand in both this and the child computer
|
||||
var/zone = "This computer is working on a wireless range, the range is currently limited to 25 meters."
|
||||
var/zone = "This computer is working on a wireless range, the range is currently limited to "
|
||||
|
||||
New()
|
||||
..()
|
||||
//So the scrubbers have time to spawn
|
||||
spawn(10)
|
||||
scanscrubbers()
|
||||
/obj/machinery/computer/area_atmos/New()
|
||||
..()
|
||||
//So the scrubbers have time to spawn
|
||||
desc += "[range] meters."
|
||||
scanscrubbers()
|
||||
|
||||
attack_ai(var/mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
/obj/machinery/computer/area_atmos/attack_ai(var/mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
attack_hand(var/mob/user as mob)
|
||||
if(..(user))
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
var/dat = {"
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
a.green:link
|
||||
{
|
||||
color:#00CC00;
|
||||
}
|
||||
a.green:visited
|
||||
{
|
||||
color:#00CC00;
|
||||
}
|
||||
a.green:hover
|
||||
{
|
||||
color:#00CC00;
|
||||
}
|
||||
a.green:active
|
||||
{
|
||||
color:#00CC00;
|
||||
}
|
||||
a.red:link
|
||||
{
|
||||
color:#FF0000;
|
||||
}
|
||||
a.red:visited
|
||||
{
|
||||
color:#FF0000;
|
||||
}
|
||||
a.red:hover
|
||||
{
|
||||
color:#FF0000;
|
||||
}
|
||||
a.red:active
|
||||
{
|
||||
color:#FF0000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<center><h1>Area Air Control</h1></center>
|
||||
<font color="red">[status]</font><br>
|
||||
<a href="?src=\ref[src];scan=1">Scan</a>
|
||||
<table border="1" width="90%">"}
|
||||
for(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber in connectedscrubbers)
|
||||
dat += {"
|
||||
<tr>
|
||||
<td>
|
||||
[scrubber.name]<br>
|
||||
Pressure: [round(scrubber.air_contents.return_pressure(), 0.01)] kPa<br>
|
||||
Flow Rate: [round(scrubber.last_flow_rate,0.1)] L/s<br>
|
||||
</td>
|
||||
<td width="150">
|
||||
<a class="green" href="?src=\ref[src];scrub=\ref[scrubber];toggle=1">Turn On</a>
|
||||
<a class="red" href="?src=\ref[src];scrub=\ref[scrubber];toggle=0">Turn Off</a><br>
|
||||
Load: [round(scrubber.last_power_draw)] W
|
||||
</td>
|
||||
</tr>"}
|
||||
/obj/machinery/computer/area_atmos/attack_hand(var/mob/user as mob)
|
||||
if(..(user))
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
var/dat = {"
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
a.green:link
|
||||
{
|
||||
color:#00CC00;
|
||||
}
|
||||
a.green:visited
|
||||
{
|
||||
color:#00CC00;
|
||||
}
|
||||
a.green:hover
|
||||
{
|
||||
color:#00CC00;
|
||||
}
|
||||
a.green:active
|
||||
{
|
||||
color:#00CC00;
|
||||
}
|
||||
a.red:link
|
||||
{
|
||||
color:#FF0000;
|
||||
}
|
||||
a.red:visited
|
||||
{
|
||||
color:#FF0000;
|
||||
}
|
||||
a.red:hover
|
||||
{
|
||||
color:#FF0000;
|
||||
}
|
||||
a.red:active
|
||||
{
|
||||
color:#FF0000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<center><h1>Area Air Control</h1></center>
|
||||
<font color="red">[status]</font><br>
|
||||
<a href="?src=\ref[src];scan=1">Scan</a>
|
||||
<table border="1" width="90%">"}
|
||||
|
||||
for(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber in connectedscrubbers)
|
||||
dat += {"
|
||||
</table><br>
|
||||
<i>[zone]</i>
|
||||
</body>
|
||||
</html>"}
|
||||
user << browse("[dat]", "window=miningshuttle;size=400x400")
|
||||
status = ""
|
||||
<tr>
|
||||
<td>
|
||||
[scrubber.name]<br>
|
||||
Pressure: [round(scrubber.air_contents.return_pressure(), 0.01)] kPa<br>
|
||||
Flow Rate: [round(scrubber.last_flow_rate,0.1)] L/s<br>
|
||||
</td>
|
||||
<td width="150">
|
||||
<a class="green" href="?src=\ref[src];scrub=\ref[scrubber];toggle=1">Turn On</a>
|
||||
<a class="red" href="?src=\ref[src];scrub=\ref[scrubber];toggle=0">Turn Off</a><br>
|
||||
Load: [round(scrubber.last_power_draw)] W
|
||||
</td>
|
||||
</tr>"}
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
dat += {"
|
||||
</table><br>
|
||||
<i>[zone]</i>
|
||||
</body>
|
||||
</html>"}
|
||||
user << browse("[dat]", "window=miningshuttle;size=400x400")
|
||||
status = ""
|
||||
|
||||
/obj/machinery/computer/area_atmos/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
if(href_list["scan"])
|
||||
scanscrubbers()
|
||||
|
||||
else if(href_list["toggle"])
|
||||
var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber = locate(href_list["scrub"])
|
||||
|
||||
if(!validscrubber(scrubber))
|
||||
spawn(20)
|
||||
status = "ERROR: Couldn't connect to scrubber! (timeout)"
|
||||
connectedscrubbers -= scrubber
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
usr.set_machine(src)
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
scrubber.on = text2num(href_list["toggle"])
|
||||
scrubber.update_icon()
|
||||
|
||||
if(href_list["scan"])
|
||||
scanscrubbers()
|
||||
else if(href_list["toggle"])
|
||||
var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber = locate(href_list["scrub"])
|
||||
/obj/machinery/computer/area_atmos/proc/scanscrubbers()
|
||||
connectedscrubbers.Cut()
|
||||
|
||||
if(!validscrubber(scrubber))
|
||||
spawn(20)
|
||||
status = "ERROR: Couldn't connect to scrubber! (timeout)"
|
||||
connectedscrubbers -= scrubber
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
var/found = 0
|
||||
for(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber in range(range, src.loc))
|
||||
found = 1
|
||||
connectedscrubbers += scrubber
|
||||
|
||||
scrubber.on = text2num(href_list["toggle"])
|
||||
scrubber.update_icon()
|
||||
if(!found)
|
||||
status = "ERROR: No scrubber found!"
|
||||
|
||||
proc/validscrubber( var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber as obj )
|
||||
if(!isobj(scrubber) || get_dist(scrubber.loc, src.loc) > src.range || scrubber.loc.z != src.loc.z)
|
||||
return 0
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/computer/area_atmos/proc/validscrubber(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber)
|
||||
if((get_dist(src,scrubber) <= range) && src.z == scrubber.z)
|
||||
return 1
|
||||
|
||||
proc/scanscrubbers()
|
||||
connectedscrubbers = new()
|
||||
|
||||
var/found = 0
|
||||
for(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber in range(range, src.loc))
|
||||
if(istype(scrubber))
|
||||
found = 1
|
||||
connectedscrubbers += scrubber
|
||||
|
||||
if(!found)
|
||||
status = "ERROR: No scrubber found!"
|
||||
|
||||
src.updateUsrDialog()
|
||||
|
||||
return 0
|
||||
|
||||
// The one that only works in the same map area
|
||||
/obj/machinery/computer/area_atmos/area
|
||||
zone = "This computer is working in a wired network limited to this area."
|
||||
|
||||
validscrubber( var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber as obj )
|
||||
if(!isobj(scrubber))
|
||||
return 0
|
||||
/obj/machinery/computer/area_atmos/area/scanscrubbers()
|
||||
connectedscrubbers.Cut()
|
||||
|
||||
/*
|
||||
wow this is stupid, someone help me
|
||||
*/
|
||||
var/turf/T_src = get_turf(src)
|
||||
if(!T_src.loc) return 0
|
||||
var/area/A_src = T_src.loc
|
||||
var/found = 0
|
||||
var/area/A = get_area(src)
|
||||
for(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber in A)
|
||||
connectedscrubbers += scrubber
|
||||
found = 1
|
||||
|
||||
var/turf/T_scrub = get_turf(scrubber)
|
||||
if(!T_scrub.loc) return 0
|
||||
var/area/A_scrub = T_scrub.loc
|
||||
if(!found)
|
||||
status = "ERROR: No scrubber found!"
|
||||
|
||||
if(A_scrub != A_src)
|
||||
return 0
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/computer/area_atmos/area/validscrubber(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber)
|
||||
if(get_area(scrubber) == get_area(src))
|
||||
return 1
|
||||
|
||||
scanscrubbers()
|
||||
connectedscrubbers = new()
|
||||
|
||||
var/found = 0
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T.loc) return
|
||||
var/area/A = T.loc
|
||||
for(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber in world )
|
||||
var/turf/T2 = get_turf(scrubber)
|
||||
if(T2 && T2.loc)
|
||||
var/area/A2 = T2.loc
|
||||
if(istype(A2) && A2 == A)
|
||||
connectedscrubbers += scrubber
|
||||
found = 1
|
||||
|
||||
|
||||
if(!found)
|
||||
status = "ERROR: No scrubber found!"
|
||||
|
||||
src.updateUsrDialog()
|
||||
return 0
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// The one that only works in the same map area
|
||||
/obj/machinery/portable_atmospherics/powered/scrubber/huge/var/scrub_id = "generic"
|
||||
|
||||
/obj/machinery/computer/area_atmos/tag
|
||||
name = "Heavy Scrubber Control"
|
||||
zone = "This computer is operating industrial scrubbers nearby."
|
||||
var/scrub_id = "generic"
|
||||
var/last_scan = 0
|
||||
|
||||
/obj/machinery/computer/area_atmos/tag/scanscrubbers()
|
||||
if(last_scan && world.time - last_scan < 20 SECONDS)
|
||||
return 0
|
||||
else
|
||||
last_scan = world.time
|
||||
|
||||
connectedscrubbers.Cut()
|
||||
|
||||
for(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber in world)
|
||||
if(scrubber.scrub_id == src.scrub_id)
|
||||
connectedscrubbers += scrubber
|
||||
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/computer/area_atmos/tag/validscrubber(var/obj/machinery/portable_atmospherics/powered/scrubber/huge/scrubber)
|
||||
if(scrubber.scrub_id == src.scrub_id)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
Reference in New Issue
Block a user