Climate on Scoreboard (#25479)

This commit is contained in:
Kurfursten
2019-12-22 12:46:22 -06:00
committed by jknpj
parent ecaf3aacd6
commit 262ea0db7f
4 changed files with 23 additions and 2 deletions

View File

@@ -318,6 +318,15 @@
if(R.fields[field] == value) if(R.fields[field] == value)
return R return R
//get total of nums in a list, ignores non-num values
//great with get_list_of_elements!
/proc/total_list(var/list/L)
var/total = 0
for(var/element in L)
if(!isnum(element))
continue
total += element
return total
//Move a single element from position fromIndex within a list, to position toIndex //Move a single element from position fromIndex within a list, to position toIndex
//All elements in the range [1,toIndex) before the move will be before the pivot afterwards //All elements in the range [1,toIndex) before the move will be before the pivot afterwards

View File

@@ -10,7 +10,10 @@
//Forecast will stay unchanged until there are less than PREDICTION_MINIMUM weathers, at which point it will make a new forecast //Forecast will stay unchanged until there are less than PREDICTION_MINIMUM weathers, at which point it will make a new forecast
//Every forecast is freshly generated, which means forecasts change! //Every forecast is freshly generated, which means forecasts change!
var/list/weathertracker = list() //associative list, gathers time spent one each weather for scoreboard
/datum/climate /datum/climate
var/name = "climate"
var/datum/weather/current_weather var/datum/weather/current_weather
var/list/datum/weather/forecasts = list() var/list/datum/weather/forecasts = list()
var/cycle_freq = list(3 MINUTES,6 MINUTES) //shortest possible time, longest possible time until next weather var/cycle_freq = list(3 MINUTES,6 MINUTES) //shortest possible time, longest possible time until next weather
@@ -74,6 +77,7 @@
WARNING("Change weather was called with [weather], neither a weather datum nor a path.") WARNING("Change weather was called with [weather], neither a weather datum nor a path.")
/datum/climate/arctic /datum/climate/arctic
name = "snow" //what scoreboard displays
//some day this may not be the norm //some day this may not be the norm
/datum/climate/arctic/New() /datum/climate/arctic/New()
@@ -98,6 +102,7 @@
/datum/weather/proc/tick() /datum/weather/proc/tick()
timeleft -= SS_WAIT_WEATHER timeleft -= SS_WAIT_WEATHER
weathertracker[name] += SS_WAIT_WEATHER
var/list/global_snowtiles = list() var/list/global_snowtiles = list()
var/list/snow_state_to_texture = list() var/list/snow_state_to_texture = list()

View File

@@ -538,6 +538,13 @@
dat += "<B>Most Spread Disease:</B> [dis_name ? "[dis_name]":"[D.form] #[add_zero("[D.uniqueID]", 4)]-[add_zero("[D.subID]", 4)]"][nickname] (Origin: [D.origin], Strength: [D.strength]%, spread among [score["disease_most_count"]] mobs)<BR>" dat += "<B>Most Spread Disease:</B> [dis_name ? "[dis_name]":"[D.form] #[add_zero("[D.uniqueID]", 4)]-[add_zero("[D.subID]", 4)]"][nickname] (Origin: [D.origin], Strength: [D.strength]%, spread among [score["disease_most_count"]] mobs)<BR>"
for(var/datum/disease2/effect/e in D.effects) for(var/datum/disease2/effect/e in D.effects)
dat += "&#x25CF; Stage [e.stage] - <b>[e.name]</b><BR>" dat += "&#x25CF; Stage [e.stage] - <b>[e.name]</b><BR>"
if(weathertracker.len && map.climate)
dat += "<B>Climate Composition: ([map.climate])</B> "
//first, total ticks
var/totalticks = total_list(get_list_of_elements(weathertracker))
for(var/element in weathertracker)
dat += "[element] ([round(weathertracker[element]*100/totalticks)]%) "
dat += "<BR>"
//Vault and away mission specific scoreboard elements //Vault and away mission specific scoreboard elements
//The process_scoreboard() proc returns a list of strings associated with their score value (the number that's added to the total score) //The process_scoreboard() proc returns a list of strings associated with their score value (the number that's added to the total score)

View File

@@ -615,10 +615,10 @@
if(!map.climate) if(!map.climate)
return return
var/datum/weather/W = map.climate.current_weather var/datum/weather/W = map.climate.current_weather
var/nu = input(usr, "Enter remaining time (deciseconds)", "Adjust Timeleft", W.timeleft) as null|num var/nu = input(usr, "Enter remaining time (nearest 2 seconds)", "Adjust Timeleft", W.timeleft / (1 SECONDS)) as null|num
if(!nu) if(!nu)
return return
W.timeleft = round(nu) W.timeleft = round(nu SECONDS,SS_WAIT_WEATHER)
log_admin("[key_name(usr)] adjusted weather time.") log_admin("[key_name(usr)] adjusted weather time.")
message_admins("<span class='notice'>[key_name(usr)] adjusted weather time.</span>", 1) message_admins("<span class='notice'>[key_name(usr)] adjusted weather time.</span>", 1)
climate_panel() climate_panel()