Add nanomap to the Atmos Control Computer

* In addition to showing a list of air alarms, the atmos computer now shows them as pins on the nanomap.
* Since the atmos computer shows all z-levels, the nanomap will be mutli-z.  Limited to station levels of course.
This commit is contained in:
Leshana
2017-03-14 22:44:12 -04:00
parent 5744812469
commit 388d6785ec
4 changed files with 46 additions and 1 deletions

View File

@@ -35,12 +35,23 @@
// TODO: Move these to a cache, similar to cameras
for(var/obj/machinery/alarm/alarm in (monitored_alarms.len ? monitored_alarms : machines))
alarms[++alarms.len] = list("name" = sanitize(alarm.name), "ref"= "\ref[alarm]", "danger" = max(alarm.danger_level, alarm.alarm_area.atmosalm))
alarms[++alarms.len] = list(
"name" = sanitize(alarm.name),
"ref"= "\ref[alarm]",
"danger" = max(alarm.danger_level, alarm.alarm_area.atmosalm),
"x" = alarm.x,
"y" = alarm.y,
"z" = alarm.z)
data["alarms"] = alarms
data["station_levels"] = using_map.station_levels
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if(!ui)
ui = new(user, src, ui_key, "atmos_control.tmpl", src.name, 625, 625, state = state)
// adding a template with the key "mapContent" enables the map ui functionality
ui.add_template("mapContent", "atmos_control_map_content.tmpl")
// adding a template with the key "mapHeader" replaces the map header content
ui.add_template("mapHeader", "atmos_control_map_header.tmpl")
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)

View File

@@ -1,3 +1,6 @@
<div class="notice" style="height: 22px">
{{:helper.link('Show Air Alrms On Map', 'pin-s', {'showMap' : 1})}}
</div>
<div class='item'>
{{for data.alarms}}
{{:helper.link(value.name, null, {'alarm' : value.ref}, null, value.danger == 2 ? 'redButton' : (value.danger == 1 ? 'yellowButton' : null))}}

View File

@@ -0,0 +1,13 @@
<!--
Title: Atmos Control Console (Map Content)
Used In File(s): \code\modules\nano\modules\atmos_control.dm
-->
{{for data.alarms}}
{{if value.z == config.mapZLevel}}
<div class="mapIcon mapIcon16 linkActive {{:value.danger == 2 ? 'dead' : (value.danger == 1 ? 'deadish' : null)}}" style="left: {{:(value.x + 0.2)}}px; bottom: {{:(value.y - 14.75)}}px;" unselectable="on" data-href="{{: NanoUtility.generateHref({'alarm' : value.ref}) }}">
<div class="tooltip hidden">
<span>{{:value.name}}</span>
</div>
</div>
{{/if}}
{{/for}}

View File

@@ -0,0 +1,18 @@
<!--
Title: Atmos Control Console (Map Header)
Used In File(s): \code\modules\nano\modules\atmos_control.dm
-->
{{:helper.link('Show List', 'script', {'showMap' : 0})}}
<div style="float: right;">
<span style="float: left;">Z Level:&nbsp;</span>
{{for data.station_levels }}
{{:helper.link(value, null, {'mapZLevel' : value}) }}
{{/for}}
</div>
<div style="float: right; width: 240px;">
<span style="float: left;">Zoom Level:&nbsp;</span>
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x1.0</div>
<div unselectable="on" class="link zoomLink" data-zoom-level="6">x1.5</div>
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x2.0</div>
<div unselectable="on" class="link zoomLink" data-zoom-level="12">x2.5</div>
</div>