diff --git a/config/pollution_grading.lua b/config/pollution_grading.lua new file mode 100644 index 00000000..b19fd3ef --- /dev/null +++ b/config/pollution_grading.lua @@ -0,0 +1,7 @@ +-- This controls how pollution is viewed on the map +return { + reference_point = {x=0,y=0}, -- where pollution is read from + max_scalar = 0.5, -- the scale between true max and max + min_scalar = 0.17, -- the scale between the lowest max and min + update_delay = 15 -- time in minutes between view updates +} \ No newline at end of file diff --git a/modules/addons/pollution-grading.lua b/modules/addons/pollution-grading.lua new file mode 100644 index 00000000..8166cebd --- /dev/null +++ b/modules/addons/pollution-grading.lua @@ -0,0 +1,13 @@ +local Event = require 'utils.event' +local config = require 'config.pollution_grading' + +local delay = config.update_delay * 3600 -- convert from minutes to ticks +Event.on_nth_tick(delay,function() + local surface = game.surfaces[1] + local true_max = surface.get_pollution(config.reference_point) + local max = true_max*config.max_scalar + local min = max*config.min_scalar + local settings = game.map_settings.pollution + settings.expected_max_per_chunk = max + settings.min_to_show_per_chunk = min +end) \ No newline at end of file