diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm index e4c67685091..ebb30ec25be 100644 --- a/code/__HELPERS/lists.dm +++ b/code/__HELPERS/lists.dm @@ -318,6 +318,15 @@ if(R.fields[field] == value) 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 //All elements in the range [1,toIndex) before the move will be before the pivot afterwards diff --git a/code/datums/climate.dm b/code/datums/climate.dm index 7c6e15fd933..569114997c3 100644 --- a/code/datums/climate.dm +++ b/code/datums/climate.dm @@ -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 //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 + var/name = "climate" var/datum/weather/current_weather var/list/datum/weather/forecasts = list() 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.") /datum/climate/arctic + name = "snow" //what scoreboard displays //some day this may not be the norm /datum/climate/arctic/New() @@ -98,6 +102,7 @@ /datum/weather/proc/tick() timeleft -= SS_WAIT_WEATHER + weathertracker[name] += SS_WAIT_WEATHER var/list/global_snowtiles = list() var/list/snow_state_to_texture = list() diff --git a/code/game/gamemodes/scoreboard.dm b/code/game/gamemodes/scoreboard.dm index 9411a8d522b..432c85dd7cc 100644 --- a/code/game/gamemodes/scoreboard.dm +++ b/code/game/gamemodes/scoreboard.dm @@ -538,6 +538,13 @@ dat += "Most Spread Disease: [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)
" for(var/datum/disease2/effect/e in D.effects) dat += "● Stage [e.stage] - [e.name]
" + if(weathertracker.len && map.climate) + dat += "Climate Composition: ([map.climate]) " + //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 += "
" //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) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 358e391d5dd..cdabfcbad1f 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -615,10 +615,10 @@ if(!map.climate) return 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) return - W.timeleft = round(nu) + W.timeleft = round(nu SECONDS,SS_WAIT_WEATHER) log_admin("[key_name(usr)] adjusted weather time.") message_admins("[key_name(usr)] adjusted weather time.", 1) climate_panel()