From 7b7f7548ce31b2eb94b98d831f3e57aa07d65040 Mon Sep 17 00:00:00 2001 From: Hugues Ross Date: Sat, 13 Jun 2020 16:50:34 -0400 Subject: [PATCH] Resolve TODOs --- autofill.lua | 4 ++-- init.lua | 2 +- map_api.lua | 20 +++++++++++++++++--- settingtypes.txt | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/autofill.lua b/autofill.lua index c5bdd0e..609774b 100644 --- a/autofill.lua +++ b/autofill.lua @@ -23,8 +23,8 @@ if settings.autofill_freq ~= 0 then map:fill_local(pos.x, pos.z); end end - for i = -2,2 do - for j = -2,2 do + for i = -4,4 do + for j = -4,4 do local adjusted_pos = { x = pos.x + chunk.from(i), y = pos.y, diff --git a/init.lua b/init.lua index 4e73e58..edf86e9 100644 --- a/init.lua +++ b/init.lua @@ -6,7 +6,7 @@ local settings = { autofill_freq = tonumber(minetest.settings:get("autofill_freq")) or 5, autosave_freq = tonumber(minetest.settings:get("autosave_freq")) or 60, backup_scan_freq = tonumber(minetest.settings:get("backup_scan_freq")) or 5, - backup_scan_count = tonumber(minetest.settings:get("backup_scan_count")) or 10, + backup_scan_count = tonumber(minetest.settings:get("backup_scan_count")) or 20, }; -- Includes diff --git a/map_api.lua b/map_api.lua index c6fd035..95e7cd9 100644 --- a/map_api.lua +++ b/map_api.lua @@ -82,9 +82,23 @@ end function Map.fill_local(self, x, z) x, z = self:to_coordinates(x, z, true); - -- TODO: Adjust size to match map scale - if x >= -2 and x <= self.w + 1 and z >= -2 and z <= self.h + 1 then - self:fill_area(x - 2, z - 2, 5, 5); + local scale_sizes = { + 7, + 5, + 5, + 3, + 3, + 3, + 1, + 1, + }; + + local fill_size = scale_sizes[math.min(self.scale, #scale_sizes)]; + local fill_radius = math.floor(fill_size / 2); + + if x >= 0 - fill_radius and x <= self.w + (fill_radius - 1) + and z >= 0 - fill_radius and z <= self.h + (fill_radius - 1) then + self:fill_area(x - fill_radius, z - fill_radius, fill_size, fill_size); end end diff --git a/settingtypes.txt b/settingtypes.txt index 099554a..e1184a9 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -11,4 +11,4 @@ autosave_freq (Data Auto-Save Frequency) int 60 0 3600 backup_scan_freq (Map Scan Frequency) int 5 0 3600 # The number of map sections that this mod scans at a time. Set to 0 to scan all relevant areas -backup_scan_count (Map Scan Rate) int 10 0 100 +backup_scan_count (Map Scan Rate) int 20 0 100