Fix missing player marker
This commit is contained in:
parent
da2c510835
commit
a45e3ca66a
|
@ -20,9 +20,27 @@ local function unknown_biome_tile(x, y, scale, variant)
|
|||
return tile:format(x, y, scale, scale, cartographer.skin.unknown_biome_texture .. "." .. tostring(variant) .. ".png");
|
||||
end
|
||||
|
||||
-- Generate formspec markup for a given map
|
||||
-- data: The mapping data
|
||||
-- x: The X position of the map (in map coordinates)
|
||||
-- y: The Z position of the map (in map coordinates)
|
||||
-- w: The width of the map (in map coordinates)
|
||||
-- h: The height of the map (in map coordinates)
|
||||
-- player_x: The X position of the player marker (in map coordinates)
|
||||
-- player_y: The Y position of the player marker (in map coordinates)
|
||||
-- detail: The detail level
|
||||
-- map_scale: Integer scaling factor for displaying a zoomed-out map
|
||||
-- (Optional) is_visible: Callback to determine if a tile should be drawn
|
||||
-- (Optional) get_marker: Callback to get the marker for any given tile
|
||||
-- (Optional) user: userdata passed to the is_visible/get_marker callbacks
|
||||
--
|
||||
-- Returns a formspec string
|
||||
local function generate_map(data, x, y, w, h, player_x, player_y, detail, map_scale, is_visible, get_marker, user)
|
||||
local str = "";
|
||||
local random = PcgRandom(x + y + w + h); -- TODO: Better seed
|
||||
player_x = math.floor(player_x / map_scale + 0.5);
|
||||
player_y = math.floor(player_y / map_scale + 0.5);
|
||||
|
||||
for i = x,x + w,1 do
|
||||
local fx = (i - x) * (scale - 0.01);
|
||||
local column = data.generated[i * map_scale];
|
||||
|
|
Loading…
Reference in New Issue
Block a user