diff --git a/commands.lua b/commands.lua index fb026f7..9872810 100644 --- a/commands.lua +++ b/commands.lua @@ -6,20 +6,6 @@ minetest.register_chatcommand("map", { local player = minetest.get_player_by_name(name); local pos = player:get_pos(); - local spawn_x = nil; - local spawn_y = nil; - if _cartographer.spawns[name] then - spawn_x = tochunk(_cartographer.spawns[name].x); - spawn_y = tochunk(_cartographer.spawns[name].z); - end - - local death_x = nil; - local death_y = nil; - if _cartographer.last_deaths[name] then - death_x = tochunk(_cartographer.last_deaths[name].x); - death_y = tochunk(_cartographer.last_deaths[name].z); - end - local player_x = tochunk(pos.x); local player_y = tochunk(pos.z); @@ -27,7 +13,7 @@ minetest.register_chatcommand("map", { detail = MAXINT; end - minetest.show_formspec(name, "map", cartographer.get_map_formspec(data, tochunk(pos.x), tochunk(pos.z), 40, 40, spawn_x, spawn_y, death_x, death_y, detail)); + minetest.show_formspec(name, "map", cartographer.get_map_formspec(data, tochunk(pos.x), tochunk(pos.z), 40, 40, detail)); end, }) diff --git a/init.lua b/init.lua index 8c0b49d..2754b9b 100644 --- a/init.lua +++ b/init.lua @@ -10,8 +10,6 @@ _cartographer = { biome_lookup = {}, maps = minetest.deserialize(mod_storage:get_string("maps")) or {}, next_map_id = mod_storage:get_int("next_map_id"), - last_deaths = minetest.deserialize(mod_storage:get_string("deaths")) or {}, - spawns = minetest.deserialize(mod_storage:get_string("spawns")) or {}, materials_by_name = {}, materials_by_group = {}, @@ -29,8 +27,6 @@ local function save() mod_storage:set_string("maps", minetest.serialize(_cartographer.maps)); mod_storage:set_int("next_map_id", _cartographer.next_map_id); mod_storage:set_string("map", minetest.serialize(data.generated)); - mod_storage:set_string("deaths", minetest.serialize(_cartographer.last_deaths)); - mod_storage:set_string("spawns", minetest.serialize(_cartographer.spawns)); end minetest.register_on_shutdown(save); minetest.register_on_leaveplayer(save); @@ -49,16 +45,6 @@ function fromchunk(coord) return math.floor(coord * _cartographer.CHUNK_SIZE); end -minetest.register_on_respawnplayer(function(player) - _cartographer.last_deaths[player:get_player_name()] = player:get_pos(); -end) - -minetest.register_on_newplayer(function(player) - minetest.after(1, function(player) - _cartographer.spawns[player:get_player_name()] = player:get_pos(); - end, player); -end) - -- The path to this mod, for including files local modpath = minetest.get_modpath("cartographer"); diff --git a/items.lua b/items.lua index 0f4496c..380fc7a 100644 --- a/items.lua +++ b/items.lua @@ -9,20 +9,6 @@ minetest.register_node("cartographer:map", { local pos = player:get_pos(); local name = player:get_player_name(); - local spawn_x = nil; - local spawn_y = nil; - if _cartographer.spawns[name] ~= nil then - spawn_x = tochunk(_cartographer.spawns[name].x); - spawn_y = tochunk(_cartographer.spawns[name].z); - end - - local death_x = nil; - local death_y = nil; - if _cartographer.last_deaths[name] ~= nil then - death_x = tochunk(_cartographer.last_deaths[name].x); - death_y = tochunk(_cartographer.last_deaths[name].z); - end - local player_x = tochunk(pos.x); local player_y = tochunk(pos.z); @@ -41,7 +27,7 @@ minetest.register_node("cartographer:map", { cartographer.fill_local(id, player_x, player_y); - minetest.show_formspec(player:get_player_name(), "map", cartographer.get_map_formspec_map(data, cartographer.get_map(id), player_x, player_y, spawn_x, spawn_y, death_x, death_y)); + minetest.show_formspec(player:get_player_name(), "map", cartographer.get_map_formspec_map(data, cartographer.get_map(id), player_x, player_y)); return stack; end, @@ -59,20 +45,6 @@ minetest.register_node("cartographer:map", { on_rightclick = function(pos, node, player, itemstack, pointed_thing) local meta = minetest.get_meta(pos); - local spawn_x = nil; - local spawn_y = nil; - if _cartographer.spawns[name] ~= nil then - spawn_x = tochunk(_cartographer.spawns[name].x); - spawn_y = tochunk(_cartographer.spawns[name].z); - end - - local death_x = nil; - local death_y = nil; - if _cartographer.last_deaths[name] ~= nil then - death_x = tochunk(_cartographer.last_deaths[name].x); - death_y = tochunk(_cartographer.last_deaths[name].z); - end - local player_x = tochunk(pos.x); local player_y = tochunk(pos.z); @@ -86,7 +58,7 @@ minetest.register_node("cartographer:map", { cartographer.fill_local(id, player_x, player_y); - minetest.show_formspec(player:get_player_name(), "map", cartographer.get_map_formspec_map(data, cartographer.get_map(id), player_x, player_y, spawn_x, spawn_y, death_x, death_y)); + minetest.show_formspec(player:get_player_name(), "map", cartographer.get_map_formspec_map(data, cartographer.get_map(id), player_x, player_y)); end, }); diff --git a/map_formspec.lua b/map_formspec.lua index 1a7ba58..ba2a598 100644 --- a/map_formspec.lua +++ b/map_formspec.lua @@ -15,7 +15,7 @@ local map_formspec_prefix = [[ local tile = "image[%f,%f;%f,%f;%s]"; local marker = "animated_image[%f,%f;%f,%f;%s:%d,%d]"; -local function generate_map(data, x, y, w, h, player_x, player_y, spawn_x, spawn_y, death_x, death_y, detail, map_scale, is_visible, user) +local function generate_map(data, x, y, w, h, player_x, player_y, detail, map_scale, is_visible, user) local str = ""; local random = PcgRandom(x + y + w + h); -- TODO: Better seed for i = x,x + w,1 do @@ -52,10 +52,6 @@ local function generate_map(data, x, y, w, h, player_x, player_y, spawn_x, spawn if i == player_x and j == player_y then str = str..marker:format(fx, fy - (height * 0.05), scale, scale, "cartographer_player_icon.png", 2, 500) - -- elseif i == death_x and j == death_y then - -- str = str..marker:format(fx, fy - (height * 0.025), scale, scale, "dicon.png") - -- elseif i == spawn_x and j == spawn_y then - -- str = str..marker:format(fx, fy - (height * 0.025), scale, scale, "cartographer_home_icon.png") end end end @@ -64,10 +60,10 @@ local function generate_map(data, x, y, w, h, player_x, player_y, spawn_x, spawn return str; end -function cartographer.get_map_formspec(data, x, y, w, h, spawn_x, spawn_y, death_x, death_y, detail) - return map_formspec_prefix:format(w * scale, h * scale)..generate_map(data, x - (w * 0.5), y - (h * 0.5), w, h, x, y, spawn_x, spawn_y, death_x, death_y, detail, 4); +function cartographer.get_map_formspec(data, x, y, w, h, detail) + return map_formspec_prefix:format(w * scale, h * scale)..generate_map(data, x - (w * 0.5), y - (h * 0.5), w, h, x, y, detail, 4); end -function cartographer.get_map_formspec_map(data, map, x, y, spawn_x, spawn_y, death_x, death_y) - return map_formspec_prefix:format(map.w * scale, map.h * scale)..generate_map(data, map.x, map.z, map.w, map.h, x, y, spawn_x, spawn_y, death_x, death_y, map.detail, 1, cartographer.is_filled, map); +function cartographer.get_map_formspec_map(data, map, x, y) + return map_formspec_prefix:format(map.w * scale, map.h * scale)..generate_map(data, map.x, map.z, map.w, map.h, x, y, map.detail, 1, cartographer.is_filled, map); end diff --git a/scanner.lua b/scanner.lua index 8119f49..a528a2c 100644 --- a/scanner.lua +++ b/scanner.lua @@ -173,7 +173,6 @@ function cartographer.scan_regions() y = startpos.y + CHUNK_SIZE, z = startpos.z + CHUNK_SIZE, }; - --vector.add(startpos, CHUNK_SIZE); if data.generated[startpos.x] ~= nil and data.generated[startpos.x][startpos.z] ~= nil then return;