mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-21 12:16:44 +01:00
@@ -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,16 @@
|
||||
//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 - T0C,
|
||||
"High" = planet.weather_holder.current_weather.temp_high - T0C,
|
||||
"Low" = planet.weather_holder.current_weather.temp_low - T0C)
|
||||
weather[++weather.len] = W
|
||||
|
||||
injection = "<div>Test</div>"
|
||||
|
||||
//Modules for homescreen.
|
||||
for(var/list/R in modules)
|
||||
@@ -98,6 +107,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)
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user