/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) // Label is what the entry is describing // Type identifies which unit or other special characters to use // Val is the information reported // Bad_high/_low are the values outside of which the entry reports as dangerous // Poor_high/_low are the values outside of which the entry reports as unideal // Values were extracted from the template itself results = list( list("entry" = "Pressure", "units" = "kPa", "val" = "[round(pressure,0.1)]", "bad_high" = 120, "poor_high" = 110, "poor_low" = 95, "bad_low" = 80), list("entry" = "Temperature", "units" = "°C", "val" = "[round(environment.temperature-T0C,0.1)]", "bad_high" = 35, "poor_high" = 25, "poor_low" = 15, "bad_low" = 5), list("entry" = "Oxygen", "units" = "kPa", "val" = "[round(o2_level*100,0.1)]", "bad_high" = 140, "poor_high" = 135, "poor_low" = 19, "bad_low" = 17), list("entry" = "Nitrogen", "units" = "kPa", "val" = "[round(n2_level*100,0.1)]", "bad_high" = 105, "poor_high" = 85, "poor_low" = 50, "bad_low" = 40), list("entry" = "Carbon Dioxide", "units" = "kPa", "val" = "[round(co2_level*100,0.1)]", "bad_high" = 10, "poor_high" = 5, "poor_low" = 0, "bad_low" = 0), list("entry" = "Phoron", "units" = "kPa", "val" = "[round(phoron_level*100,0.01)]", "bad_high" = 0.5, "poor_high" = 0, "poor_low" = 0, "bad_low" = 0), list("entry" = "Other", "units" = "kPa", "val" = "[round(unknown_level, 0.01)]", "bad_high" = 1, "poor_high" = 0.5, "poor_low" = 0, "bad_low" = 0) ) if(isnull(results)) results = list(list("entry" = "pressure", "units" = "kPa", "val" = "0", "bad_high" = 120, "poor_high" = 110, "poor_low" = 95, "bad_low" = 80)) return results // Proc - compile_news() // Parameters - none // Description - Returns the list of newsfeeds, compiled for template processing /obj/item/device/communicator/proc/compile_news() var/list/feeds = list() for(var/datum/feed_channel/channel in news_network.network_channels) var/list/messages = list() if(!channel.censored) var/index = 0 for(var/datum/feed_message/FM in channel.messages) index++ var/list/msgdata = list( "author" = FM.author, "body" = FM.body, "img" = null, "message_type" = FM.message_type, "time_stamp" = FM.time_stamp, "caption" = FM.caption, "index" = index ) if(FM.img) msgdata["img"] = icon2base64(FM.img) messages[++messages.len] = msgdata feeds[++feeds.len] = list( "name" = channel.channel_name, "censored" = channel.censored, "author" = channel.author, "messages" = messages, "index" = feeds.len + 1 // actually align them, since I guess the population of the list doesn't occur until after the evaluation of the new entry's contents ) return feeds // Proc - get_recent_news() // Parameters - none // Description - Returns the latest three newscasts, compiled for template processing /obj/item/device/communicator/proc/get_recent_news() var/list/news = list() // Compile all the newscasts for(var/datum/feed_channel/channel in news_network.network_channels) if(!channel.censored) for(var/datum/feed_message/FM in channel.messages) var/body = replacetext(FM.body, "\n", "
") news[++news.len] = list( "channel" = channel.channel_name, "author" = FM.author, "body" = body, "message_type" = FM.message_type, "time_stamp" = FM.time_stamp, "has_image" = (FM.img != null), "caption" = FM.caption, "time" = FM.post_time ) // Cut out all but the youngest three if(news.len > 3) sortByKey(news, "time") news.Cut(1, news.len - 2) // Last three have largest timestamps, youngest posts news.Swap(1, 3) // List is sorted in ascending order of timestamp, we want descending return news