Skip to content

Instantly share code, notes, and snippets.

@andythenorth
Created August 22, 2023 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andythenorth/bd8f4481745589b152b75745a83b0980 to your computer and use it in GitHub Desktop.
Save andythenorth/bd8f4481745589b152b75745a83b0980 to your computer and use it in GitHub Desktop.
function IndustryProductionIncreaseHistory(vulcan_town, extra_params) {
local industry = extra_params[0];
if (industry in ::persistent_storage.industry_production_increase_timeseries) {
// we clone the timeseries so we can non-destructively reverse it for iterating over
local industry_timeseries_clone = clone(::persistent_storage.industry_production_increase_timeseries[industry]);
industry_timeseries_clone.reverse();
local counter = 0;
local next_string = null;
foreach (increase_date in industry_timeseries_clone) {
if (counter == 0) {
next_string = GSText(GSText.STR_TOWN_STORY_INDUSTRY_REPORT_HISTORY_DATE_NO_RECURSE, increase_date);
}
else {
next_string = GSText(GSText.STR_TOWN_STORY_INDUSTRY_REPORT_HISTORY_DATE_RECURSE, increase_date, next_string);
}
counter++;
}
return next_string;
}
else {
return GSText(GSText.STR_CABBAGE);
}
}
---
STR_TOWN_STORY_INDUSTRY_REPORT_HISTORY_DATE_RECURSE :{DATE_LONG} {STRING}
STR_TOWN_STORY_INDUSTRY_REPORT_HISTORY_DATE_NO_RECURSE :{DATE_LONG}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment