From e004d1c4ec26e47627220ae283e12072b747d80c Mon Sep 17 00:00:00 2001 From: Atermonera Date: Mon, 1 Jan 2018 23:43:09 -0800 Subject: [PATCH 1/3] Weather app has atmospheric scan --- .../objects/items/devices/communicator/UI.dm | 21 +++++- .../items/devices/communicator/helper.dm | 27 ++++++++ nano/templates/communicator.tmpl | 66 ++++++++++++++++++- polaris.dme | 3 +- 4 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 code/game/objects/items/devices/communicator/helper.dm diff --git a/code/game/objects/items/devices/communicator/UI.dm b/code/game/objects/items/devices/communicator/UI.dm index 77ce5b03c13..002146dd491 100644 --- a/code/game/objects/items/devices/communicator/UI.dm +++ b/code/game/objects/items/devices/communicator/UI.dm @@ -14,6 +14,7 @@ var/im_list_ui[0] //List of messages. var/weather[0] + var/injection = null var/modules_ui[0] //Home screen info. //First we add other 'local' communicators. @@ -70,8 +71,22 @@ //Weather reports. for(var/datum/planet/planet in planet_controller.planets) if(planet.weather_holder && planet.weather_holder.current_weather) - weather[++weather.len] = list("Planet" = planet.name, "Weather" = planet.weather_holder.current_weather.name, "Temperature" = (round(planet.weather_holder.temperature*1000)/1000),\ - "High" = planet.weather_holder.current_weather.temp_high, "Low" = planet.weather_holder.current_weather.temp_low, "Wind" = "[planet.weather_holder.wind_speed]|[dir2text(planet.weather_holder.wind_dir)]") + var/list/W = list( + "Planet" = planet.name, + "Time" = planet.current_time.show_time("hh:mm"), + "Weather" = planet.weather_holder.current_weather.name, + "Temperature" = planet.weather_holder.temperature, + "High" = planet.weather_holder.current_weather.temp_high, + "Low" = planet.weather_holder.current_weather.temp_low) + weather[++weather.len] = W +// world << "Temperature, unrounded: [planet.weather_holder.temperature]" +// world << "Temperature: [round(planet.weather_holder.temperature)]" +// world << "High, unrounded: [planet.weather_holder.current_weather.temp_high]" +// world << "High: [round(planet.weather_holder.current_weather.temp_high)]" +// world << "Low, unrounded: [planet.weather_holder.current_weather.temp_low]" +// world << "Low: [round(planet.weather_holder.current_weather.temp_low)]" + + injection = "
Test
" //Modules for homescreen. for(var/list/R in modules) @@ -98,6 +113,8 @@ data["homeScreen"] = modules_ui data["note"] = note // current notes data["weather"] = weather + data["aircontents"] = src.analyze_air() + data["injection"] = injection // update the ui if it exists, returns null if no ui is passed/found ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) diff --git a/code/game/objects/items/devices/communicator/helper.dm b/code/game/objects/items/devices/communicator/helper.dm new file mode 100644 index 00000000000..9c121112ac2 --- /dev/null +++ b/code/game/objects/items/devices/communicator/helper.dm @@ -0,0 +1,27 @@ +/obj/item/device/communicator/proc/analyze_air() + var/list/results = list() + var/turf/T = get_turf(src.loc) + if(!isnull(T)) + var/datum/gas_mixture/environment = T.return_air() + var/pressure = environment.return_pressure() + var/total_moles = environment.total_moles + if (total_moles) + var/o2_level = environment.gas["oxygen"]/total_moles + var/n2_level = environment.gas["nitrogen"]/total_moles + var/co2_level = environment.gas["carbon_dioxide"]/total_moles + var/phoron_level = environment.gas["phoron"]/total_moles + var/unknown_level = 1-(o2_level+n2_level+co2_level+phoron_level) + results = list( + "pressure" = "[round(pressure,0.1)]", + "nitrogen" = "[round(n2_level*100,0.1)]", + "oxygen" = "[round(o2_level*100,0.1)]", + "carbon_dioxide" = "[round(co2_level*100,0.1)]", + "phoron" = "[round(phoron_level*100,0.01)]", + "other" = "[round(unknown_level, 0.01)]", + "temp" = "[round(environment.temperature-T0C,0.1)]", + "reading" = 1 + ) + + if(isnull(results)) + results = list("reading" = 0) + return results \ No newline at end of file diff --git a/nano/templates/communicator.tmpl b/nano/templates/communicator.tmpl index 00f58378be5..9ce85c759c3 100644 --- a/nano/templates/communicator.tmpl +++ b/nano/templates/communicator.tmpl @@ -242,15 +242,75 @@ Used In File(s): code\game\objects\items\devices\communicator\communicator.dm
{{:helper.link('Home', 'home', {'switch_tab' : 1})}}

+

Curren Conditions:

+
+ {{if data.aircontents.reading == 1}} +
+ Pressure: +
+
+ {{:helper.string('{1} kPa', data.aircontents.pressure < 80 || data.aircontents.pressure > 120 ? 'bad' : data.aircontents.pressure < 95 || data.aircontents.pressure > 110 ? 'average' : 'good' , data.aircontents.pressure)}} +
+
+ Temperature: +
+
+ {{:helper.string('{1} °C', data.aircontents.temp < 5 || data.aircontents.temp > 35 ? 'bad' : data.aircontents.temp < 15 || data.aircontents.temp > 25 ? 'average' : 'good' , data.aircontents.temp)}} +
+
+
+ Oxygen: +
+
+ {{:helper.string('{1}%', data.aircontents.oxygen < 17 ? 'bad' : data.aircontents.oxygen < 19 ? 'average' : 'good' , data.aircontents.oxygen)}} +
+
+ Nitrogen: +
+
+ {{:helper.string('{1}%', data.aircontents.nitrogen > 82 ? 'bad' : data.aircontents.nitrogen > 80 ? 'average' : 'good' , data.aircontents.nitrogen)}} +
+ {{if data.aircontents.carbon_dioxide > 0}} +
+ Carbon Dioxide: +
+
+ {{:helper.string('{1}%', data.aircontents.carbon_dioxide > 5 ? 'bad' : 'good' , data.aircontents.carbon_dioxide)}} +
+ {{/if}} + {{if data.aircontents.phoron > 0}} +
+ Phoron: +
+
+ {{:helper.string('{1}%', data.aircontents.phoron > 0 ? 'bad' : 'good' , data.aircontents.phoron)}} +
+ {{/if}} + {{if data.aircontents.other > 0}} +
+ Unknown: +
+
+ {{:data.aircontents.other}}% +
+ {{/if}} + {{else}} +
+ Unable to get air reading +
+ {{/if}} +
+ +

Weather Reports:

{{for data.weather}}
{{:value.Planet}}:
- Weather: {{:value.Weather}}, {{:value.Temperature - 273.15}}℃
- High: {{:value.High - 273.15}}℃ | Low: {{:value.Low - 273.15}}℃
- Wind: {{:value.Wind}} + Time: {{:value.Time}}
+ Weather: {{:value.Weather}}, {{:value.Temperature - 273.15}}°C
+ High: {{:value.High - 273.15}}°C | Low: {{:value.Low - 273.15}}°C
{{empty}} diff --git a/polaris.dme b/polaris.dme index 1559089da36..6efde5d1c9b 100644 --- a/polaris.dme +++ b/polaris.dme @@ -851,6 +851,7 @@ #include "code\game\objects\items\devices\whistle.dm" #include "code\game\objects\items\devices\communicator\cartridge.dm" #include "code\game\objects\items\devices\communicator\communicator.dm" +#include "code\game\objects\items\devices\communicator\helper.dm" #include "code\game\objects\items\devices\communicator\integrated.dm" #include "code\game\objects\items\devices\communicator\messaging.dm" #include "code\game\objects\items\devices\communicator\phone.dm" @@ -2371,7 +2372,7 @@ #include "code\ZAS\Zone.dm" #include "interface\interface.dm" #include "interface\skin.dmf" -#include "maps\southern_cross\southern_cross.dm" +#include "maps\northern_star\northern_star.dm" #include "maps\submaps\_readme.dm" #include "maps\submaps\cave_submaps\cave.dm" #include "maps\submaps\cave_submaps\cave_areas.dm" From d54830c253c7f2db8daaced2a6ee81dc58b34272 Mon Sep 17 00:00:00 2001 From: Atermonera Date: Mon, 1 Jan 2018 23:45:47 -0800 Subject: [PATCH 2/3] Didn't save a file --- nano/templates/communicator.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nano/templates/communicator.tmpl b/nano/templates/communicator.tmpl index 9ce85c759c3..cccee18182b 100644 --- a/nano/templates/communicator.tmpl +++ b/nano/templates/communicator.tmpl @@ -309,8 +309,8 @@ Used In File(s): code\game\objects\items\devices\communicator\communicator.dm
Time: {{:value.Time}}
- Weather: {{:value.Weather}}, {{:value.Temperature - 273.15}}°C
- High: {{:value.High - 273.15}}°C | Low: {{:value.Low - 273.15}}°C + Weather: {{:value.Weather}}, {{:value.Temperature}}°C
+ High: {{:value.High}}°C | Low: {{:value.Low}}°C
{{empty}} From 132e20ba521932b025370845812b8987d7ec037c Mon Sep 17 00:00:00 2001 From: Atermonera Date: Fri, 5 Jan 2018 23:04:51 -0800 Subject: [PATCH 3/3] Nanoui rounding --- code/game/objects/items/devices/communicator/UI.dm | 12 +++--------- nano/templates/communicator.tmpl | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/code/game/objects/items/devices/communicator/UI.dm b/code/game/objects/items/devices/communicator/UI.dm index 002146dd491..3c8cf50f51b 100644 --- a/code/game/objects/items/devices/communicator/UI.dm +++ b/code/game/objects/items/devices/communicator/UI.dm @@ -75,16 +75,10 @@ "Planet" = planet.name, "Time" = planet.current_time.show_time("hh:mm"), "Weather" = planet.weather_holder.current_weather.name, - "Temperature" = planet.weather_holder.temperature, - "High" = planet.weather_holder.current_weather.temp_high, - "Low" = planet.weather_holder.current_weather.temp_low) + "Temperature" = planet.weather_holder.temperature - T0C, + "High" = planet.weather_holder.current_weather.temp_high - T0C, + "Low" = planet.weather_holder.current_weather.temp_low - T0C) weather[++weather.len] = W -// world << "Temperature, unrounded: [planet.weather_holder.temperature]" -// world << "Temperature: [round(planet.weather_holder.temperature)]" -// world << "High, unrounded: [planet.weather_holder.current_weather.temp_high]" -// world << "High: [round(planet.weather_holder.current_weather.temp_high)]" -// world << "Low, unrounded: [planet.weather_holder.current_weather.temp_low]" -// world << "Low: [round(planet.weather_holder.current_weather.temp_low)]" injection = "
Test
" diff --git a/nano/templates/communicator.tmpl b/nano/templates/communicator.tmpl index cccee18182b..63674d3752b 100644 --- a/nano/templates/communicator.tmpl +++ b/nano/templates/communicator.tmpl @@ -309,8 +309,8 @@ Used In File(s): code\game\objects\items\devices\communicator\communicator.dm
Time: {{:value.Time}}
- Weather: {{:value.Weather}}, {{:value.Temperature}}°C
- High: {{:value.High}}°C | Low: {{:value.Low}}°C + Weather: {{:value.Weather}}, {{:helper.fixed(value.Temperature)}}°C
+ High: {{:helper.fixed(value.High)}}°C | Low: {{:helper.fixed(value.Low)}}°C
{{empty}}