mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Climate on Scoreboard (#25479)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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>"
|
||||
for(var/datum/disease2/effect/e in D.effects)
|
||||
dat += "● 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
|
||||
//The process_scoreboard() proc returns a list of strings associated with their score value (the number that's added to the total score)
|
||||
|
||||
@@ -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("<span class='notice'>[key_name(usr)] adjusted weather time.</span>", 1)
|
||||
climate_panel()
|
||||
|
||||
Reference in New Issue
Block a user