diff --git a/init.lua b/init.lua index 1ecd162..ad4b69c 100644 --- a/init.lua +++ b/init.lua @@ -25,13 +25,15 @@ maps.sent = {} maps.posx = {} maps.posz = {} +local size = 80 + local worldpath = minetest.get_worldpath() local textures_dir = worldpath .. "/maps/" minetest.mkdir(textures_dir) maps.create_map = function(pos, player_name) - local minp = vector.multiply(vector.floor(vector.divide(pos, 64)), 64) - local maxp = vector.add(minp, vector.new(63, 63, 63)) + local minp = vector.multiply(vector.floor(vector.divide(pos, size)), size) + local maxp = vector.add(minp, vector.new(size - 1, size - 1, size - 1)) local prefix, _ = minetest.pos_to_string(maxp) prefix, _ = prefix:gsub("%(", "") @@ -88,8 +90,8 @@ maps.create_map = function(pos, player_name) { 0, 47, 0 }, -- leaves { 255, 0, 0 }, -- fire } - for x = 1,66,1 do - for z = 1,66,1 do + for x = 1,size,1 do + for z = 1,size,1 do local color = { 0 } pixels[z] = pixels[z] or {} pixels[z][x] = color @@ -99,8 +101,8 @@ maps.create_map = function(pos, player_name) local color_map = function(color, query) local positions = minetest.find_nodes_in_area_under_air(minp, maxp, query) for _, p in ipairs(positions) do - local z = p.z - minp.z + 2 - local x = p.x - minp.x + 2 + local z = p.z - minp.z + 1 + local x = p.x - minp.x + 1 pixels[z][x] = { color } end end @@ -200,7 +202,7 @@ minetest.register_globalstep( maps.create_map(pos, player_name) end - local x = (pos.x - minp.x - 32) * 4 + local x = (pos.x - minp.x - (size/2)) * 4 local y = (minp.z - pos.z) * 4 - 2 player:hud_change( maps.dots[player_name],