diff --git a/init.lua b/init.lua index bda3045..9b4655a 100644 --- a/init.lua +++ b/init.lua @@ -53,13 +53,9 @@ local modpath = minetest.get_modpath("cartographer"); -- Includes dofile(modpath .. "/commands.lua"); dofile(modpath .. "/scanner.lua"); +dofile(modpath .. "/skin_api.lua"); dofile(modpath .. "/map_api.lua"); dofile(modpath .. "/map_formspec.lua"); dofile(modpath .. "/marker_formspec.lua"); dofile(modpath .. "/items.lua"); dofile(modpath .. "/table.lua"); - --- Setup mod/game support -if minetest.get_modpath("default") then - dofile(modpath .. "/repixture.lua"); -end diff --git a/map_formspec.lua b/map_formspec.lua index b6c8348..77b496e 100644 --- a/map_formspec.lua +++ b/map_formspec.lua @@ -15,6 +15,11 @@ local map_formspec_prefix = [[ local tile = "image[%f,%f;%f,%f;%s]"; local marker = "animated_image[%f,%f;%f,%f;;%s;%d;%d]"; +-- Generate formspec markup for an unknown biome tile +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 + 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 @@ -24,7 +29,7 @@ local function generate_map(data, x, y, w, h, player_x, player_y, detail, map_sc for j = y + h,y,-1 do local fy = (y + h - j) * (scale - 0.01); if column == nil or column[j * map_scale] == nil or (is_visible and not is_visible(user, i, j)) then - str = str..tile:format(fx, fy, scale, scale, "cartographer_unknown_biome." .. tostring(get_variant(random)) .. ".png") + str = str .. unknown_biome_tile(fx, fy, scale, get_variant(random)); else local name = minetest.get_biome_name(column[j * map_scale].biome); local height = column[j * map_scale].height; @@ -40,11 +45,12 @@ local function generate_map(data, x, y, w, h, player_x, player_y, detail, map_sc end if biome == nil then - -- minetest.chat_send_all(name); - str = str..tile:format(fx, fy, scale, scale, "cartographer_unknown_biome." .. tostring(get_variant(random)) .. ".png") + str = str .. unknown_biome_tile(fx, fy, scale, get_variant(random)); else if height > 0 then - str = str..tile:format(fx, fy - (height * 0.05) + scale - 0.01, scale, (height * 0.05) + 0.01, "cartographer_cliff.png") + str = str..tile:format(fx, fy - (height * 0.05) + scale - 0.01, + scale, (height * 0.05) + 0.01, + cartographer.skin.cliff_texture .. ".png"); end str = str..tile:format(fx, fy - (height * 0.05), scale, scale, biome .. "." .. tostring(get_variant(random)) .. ".png" .. mod) @@ -58,7 +64,11 @@ local function generate_map(data, x, y, w, h, player_x, player_y, detail, map_sc end 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) + str = str..marker:format(fx, fy - (height * 0.05), + scale, scale, + cartographer.skin.player_icon.texture .. ".png", + cartographer.skin.player_icon.frame_count, + cartographer.skin.player_icon.frame_duration); end end end diff --git a/mod.conf b/mod.conf index 46d05be..611eab3 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,2 @@ name = cartographer -description = Adds an unlockable world map -optional_depends = crafting +description = A game-agnostic mapmaking API. Needs additional mods to function. diff --git a/repixture.lua b/repixture.lua deleted file mode 100644 index c264b03..0000000 --- a/repixture.lua +++ /dev/null @@ -1,112 +0,0 @@ --- Biomes -cartographer.register_biome("Marsh", { - "cartographer_simple_land", - "cartographer_colored_land", -}); -cartographer.register_biome("Swamp", { - "cartographer_simple_land", - "cartographer_colored_land", - "cartographer_colored_land", - "cartographer_swamp", -}); -cartographer.register_biome("Deep Forest", { - "cartographer_simple_forest", - "cartographer_colored_forest", - "cartographer_deep_forest", -}); -cartographer.register_biome("Forest", { - "cartographer_simple_forest", - "cartographer_colored_forest", - "cartographer_dense_forest", -}); -cartographer.register_biome("Grove", { - "cartographer_simple_forest", - "cartographer_colored_forest", - "cartographer_grove", -}); -cartographer.register_biome("Wilderness", { - "cartographer_simple_forest", - "cartographer_colored_forest", -}); -cartographer.register_biome("Grassland", { - "cartographer_simple_land", - "cartographer_colored_land", -}); -cartographer.register_biome("Orchard", { - "cartographer_simple_forest", - "cartographer_colored_forest", -}); -cartographer.register_biome("Chaparral", { - "cartographer_simple_land", - "cartographer_colored_land", - "cartographer_colored_land", - "cartographer_chaparral", -}); -cartographer.register_biome("Savanna", { - "cartographer_simple_land", - "cartographer_colored_land", - "cartographer_colored_land", - "cartographer_savanna", -}); -cartographer.register_biome("Desert", { - "cartographer_simple_land", - "cartographer_colored_sand", - "cartographer_colored_sand", -}); -cartographer.register_biome("Wasteland", { - "cartographer_simple_land", - "cartographer_colored_sand", - "cartographer_colored_sand", - "cartographer_wasteland", -}, 1); -cartographer.register_biome("Wasteland", { - "cartographer_simple_water", - "cartographer_colored_water", -}, nil, 0); -cartographer.register_biome("Grassland Ocean", { - "cartographer_simple_water", - "cartographer_colored_water", -}, nil, 0); -cartographer.register_biome("Grassland Ocean", { - "cartographer_simple_land", - "cartographer_colored_sand", -}, 1); -cartographer.register_biome("Gravel Beach", { - "cartographer_simple_water", - "cartographer_colored_water", -}, nil, 0); -cartographer.register_biome("Gravel Beach", { - "cartographer_simple_land", - "cartographer_colored_sand", - "cartographer_gravel", -}, 1); -cartographer.register_biome("Savanna Ocean", { - "cartographer_simple_water", - "cartographer_colored_water", -}, nil, 0); -cartographer.register_biome("Savanna Ocean", { - "cartographer_simple_land", - "cartographer_colored_sand", -}, 1); - --- Materials -cartographer.register_map_material_name("default:paper", "paper", 1); -cartographer.register_map_material_name("default:lump_coal", "pigment"); -cartographer.register_map_material_name("default:block_coal", "pigment", 9); - --- Crafting Recipes -crafting.register_craft({ - output = "cartographer:simple_table", - items = { - "default:fiber 2", - "default:stick 8", - "group:wood 6", - }, -}); -crafting.register_craft({ - output = "cartographer:standard_table", - items = { - "cartographer:simple_table", - "default:ingot_steel 6", - }, -}); diff --git a/skin_api.lua b/skin_api.lua new file mode 100644 index 0000000..9672f72 --- /dev/null +++ b/skin_api.lua @@ -0,0 +1,15 @@ +-- Table used for skinning cartographer's look and feel +cartographer.skin = { + -- The texture to use in maps for the sides of tiles + cliff_texture = "cartographer_cliff", + + -- The animated texture data to use for the player icon + player_icon = { + frame_count = 2, + frame_duration = 500, + texture = "cartographer_player_icon", + }, + + -- The texture to use in maps when biome data is missing or empty + unknown_biome_texture = "cartographer_unknown_biome", +}; diff --git a/textures/cartographer_chaparral.1.png b/textures/cartographer_chaparral.1.png deleted file mode 100644 index d6ffa2b..0000000 Binary files a/textures/cartographer_chaparral.1.png and /dev/null differ diff --git a/textures/cartographer_chaparral.2.png b/textures/cartographer_chaparral.2.png deleted file mode 100644 index 8e4d975..0000000 Binary files a/textures/cartographer_chaparral.2.png and /dev/null differ diff --git a/textures/cartographer_chaparral.3.png b/textures/cartographer_chaparral.3.png deleted file mode 100644 index 28add66..0000000 Binary files a/textures/cartographer_chaparral.3.png and /dev/null differ diff --git a/textures/cartographer_chaparral.4.png b/textures/cartographer_chaparral.4.png deleted file mode 100644 index cd2bfc4..0000000 Binary files a/textures/cartographer_chaparral.4.png and /dev/null differ diff --git a/textures/cartographer_colored_forest.1.png b/textures/cartographer_colored_forest.1.png deleted file mode 100644 index 9f7b92d..0000000 Binary files a/textures/cartographer_colored_forest.1.png and /dev/null differ diff --git a/textures/cartographer_colored_forest.2.png b/textures/cartographer_colored_forest.2.png deleted file mode 100644 index 2d87633..0000000 Binary files a/textures/cartographer_colored_forest.2.png and /dev/null differ diff --git a/textures/cartographer_colored_forest.3.png b/textures/cartographer_colored_forest.3.png deleted file mode 100644 index 677bc84..0000000 Binary files a/textures/cartographer_colored_forest.3.png and /dev/null differ diff --git a/textures/cartographer_colored_forest.4.png b/textures/cartographer_colored_forest.4.png deleted file mode 100644 index b6b215d..0000000 Binary files a/textures/cartographer_colored_forest.4.png and /dev/null differ diff --git a/textures/cartographer_colored_land.1.png b/textures/cartographer_colored_land.1.png deleted file mode 100644 index ba36228..0000000 Binary files a/textures/cartographer_colored_land.1.png and /dev/null differ diff --git a/textures/cartographer_colored_land.2.png b/textures/cartographer_colored_land.2.png deleted file mode 100644 index d059ac4..0000000 Binary files a/textures/cartographer_colored_land.2.png and /dev/null differ diff --git a/textures/cartographer_colored_land.3.png b/textures/cartographer_colored_land.3.png deleted file mode 100644 index fad0351..0000000 Binary files a/textures/cartographer_colored_land.3.png and /dev/null differ diff --git a/textures/cartographer_colored_land.4.png b/textures/cartographer_colored_land.4.png deleted file mode 100644 index e424810..0000000 Binary files a/textures/cartographer_colored_land.4.png and /dev/null differ diff --git a/textures/cartographer_colored_sand.1.png b/textures/cartographer_colored_sand.1.png deleted file mode 100644 index 4488c91..0000000 Binary files a/textures/cartographer_colored_sand.1.png and /dev/null differ diff --git a/textures/cartographer_colored_sand.2.png b/textures/cartographer_colored_sand.2.png deleted file mode 100644 index 551bb07..0000000 Binary files a/textures/cartographer_colored_sand.2.png and /dev/null differ diff --git a/textures/cartographer_colored_sand.3.png b/textures/cartographer_colored_sand.3.png deleted file mode 100644 index 230e597..0000000 Binary files a/textures/cartographer_colored_sand.3.png and /dev/null differ diff --git a/textures/cartographer_colored_sand.4.png b/textures/cartographer_colored_sand.4.png deleted file mode 100644 index 0b8a56e..0000000 Binary files a/textures/cartographer_colored_sand.4.png and /dev/null differ diff --git a/textures/cartographer_colored_water.1.png b/textures/cartographer_colored_water.1.png deleted file mode 100644 index 0484906..0000000 Binary files a/textures/cartographer_colored_water.1.png and /dev/null differ diff --git a/textures/cartographer_colored_water.2.png b/textures/cartographer_colored_water.2.png deleted file mode 100644 index 0484906..0000000 Binary files a/textures/cartographer_colored_water.2.png and /dev/null differ diff --git a/textures/cartographer_colored_water.3.png b/textures/cartographer_colored_water.3.png deleted file mode 100644 index bce4fe5..0000000 Binary files a/textures/cartographer_colored_water.3.png and /dev/null differ diff --git a/textures/cartographer_colored_water.4.png b/textures/cartographer_colored_water.4.png deleted file mode 100644 index f532cb3..0000000 Binary files a/textures/cartographer_colored_water.4.png and /dev/null differ diff --git a/textures/cartographer_deep_forest.1.png b/textures/cartographer_deep_forest.1.png deleted file mode 100644 index 439ef83..0000000 Binary files a/textures/cartographer_deep_forest.1.png and /dev/null differ diff --git a/textures/cartographer_deep_forest.2.png b/textures/cartographer_deep_forest.2.png deleted file mode 100644 index 5479bf4..0000000 Binary files a/textures/cartographer_deep_forest.2.png and /dev/null differ diff --git a/textures/cartographer_deep_forest.3.png b/textures/cartographer_deep_forest.3.png deleted file mode 100644 index 40c2310..0000000 Binary files a/textures/cartographer_deep_forest.3.png and /dev/null differ diff --git a/textures/cartographer_deep_forest.4.png b/textures/cartographer_deep_forest.4.png deleted file mode 100644 index 4a86574..0000000 Binary files a/textures/cartographer_deep_forest.4.png and /dev/null differ diff --git a/textures/cartographer_dense_forest.1.png b/textures/cartographer_dense_forest.1.png deleted file mode 100644 index ecfff27..0000000 Binary files a/textures/cartographer_dense_forest.1.png and /dev/null differ diff --git a/textures/cartographer_dense_forest.2.png b/textures/cartographer_dense_forest.2.png deleted file mode 100644 index c653a25..0000000 Binary files a/textures/cartographer_dense_forest.2.png and /dev/null differ diff --git a/textures/cartographer_dense_forest.3.png b/textures/cartographer_dense_forest.3.png deleted file mode 100644 index 202f74c..0000000 Binary files a/textures/cartographer_dense_forest.3.png and /dev/null differ diff --git a/textures/cartographer_dense_forest.4.png b/textures/cartographer_dense_forest.4.png deleted file mode 100644 index 94beda5..0000000 Binary files a/textures/cartographer_dense_forest.4.png and /dev/null differ diff --git a/textures/cartographer_gravel.1.png b/textures/cartographer_gravel.1.png deleted file mode 100644 index e14ad17..0000000 Binary files a/textures/cartographer_gravel.1.png and /dev/null differ diff --git a/textures/cartographer_gravel.2.png b/textures/cartographer_gravel.2.png deleted file mode 100644 index f214380..0000000 Binary files a/textures/cartographer_gravel.2.png and /dev/null differ diff --git a/textures/cartographer_gravel.3.png b/textures/cartographer_gravel.3.png deleted file mode 100644 index bd931e1..0000000 Binary files a/textures/cartographer_gravel.3.png and /dev/null differ diff --git a/textures/cartographer_gravel.4.png b/textures/cartographer_gravel.4.png deleted file mode 100644 index 6f28529..0000000 Binary files a/textures/cartographer_gravel.4.png and /dev/null differ diff --git a/textures/cartographer_grove.1.png b/textures/cartographer_grove.1.png deleted file mode 100644 index db5dc7b..0000000 Binary files a/textures/cartographer_grove.1.png and /dev/null differ diff --git a/textures/cartographer_grove.2.png b/textures/cartographer_grove.2.png deleted file mode 100644 index 4d93bf4..0000000 Binary files a/textures/cartographer_grove.2.png and /dev/null differ diff --git a/textures/cartographer_grove.3.png b/textures/cartographer_grove.3.png deleted file mode 100644 index 98e84e2..0000000 Binary files a/textures/cartographer_grove.3.png and /dev/null differ diff --git a/textures/cartographer_grove.4.png b/textures/cartographer_grove.4.png deleted file mode 100644 index b81e5fe..0000000 Binary files a/textures/cartographer_grove.4.png and /dev/null differ diff --git a/textures/cartographer_savanna.1.png b/textures/cartographer_savanna.1.png deleted file mode 100644 index eecf993..0000000 Binary files a/textures/cartographer_savanna.1.png and /dev/null differ diff --git a/textures/cartographer_savanna.2.png b/textures/cartographer_savanna.2.png deleted file mode 100644 index ca6ea25..0000000 Binary files a/textures/cartographer_savanna.2.png and /dev/null differ diff --git a/textures/cartographer_savanna.3.png b/textures/cartographer_savanna.3.png deleted file mode 100644 index a7deab2..0000000 Binary files a/textures/cartographer_savanna.3.png and /dev/null differ diff --git a/textures/cartographer_savanna.4.png b/textures/cartographer_savanna.4.png deleted file mode 100644 index 63b6b2a..0000000 Binary files a/textures/cartographer_savanna.4.png and /dev/null differ diff --git a/textures/cartographer_simple_forest.1.png b/textures/cartographer_simple_forest.1.png deleted file mode 100644 index 8207b61..0000000 Binary files a/textures/cartographer_simple_forest.1.png and /dev/null differ diff --git a/textures/cartographer_simple_forest.2.png b/textures/cartographer_simple_forest.2.png deleted file mode 100644 index fd79bf8..0000000 Binary files a/textures/cartographer_simple_forest.2.png and /dev/null differ diff --git a/textures/cartographer_simple_forest.3.png b/textures/cartographer_simple_forest.3.png deleted file mode 100644 index 97ac39c..0000000 Binary files a/textures/cartographer_simple_forest.3.png and /dev/null differ diff --git a/textures/cartographer_simple_forest.4.png b/textures/cartographer_simple_forest.4.png deleted file mode 100644 index 459331d..0000000 Binary files a/textures/cartographer_simple_forest.4.png and /dev/null differ diff --git a/textures/cartographer_simple_land.1.png b/textures/cartographer_simple_land.1.png deleted file mode 100644 index 0eedeed..0000000 Binary files a/textures/cartographer_simple_land.1.png and /dev/null differ diff --git a/textures/cartographer_simple_land.2.png b/textures/cartographer_simple_land.2.png deleted file mode 100644 index d4ea928..0000000 Binary files a/textures/cartographer_simple_land.2.png and /dev/null differ diff --git a/textures/cartographer_simple_land.3.png b/textures/cartographer_simple_land.3.png deleted file mode 100644 index 4c933ef..0000000 Binary files a/textures/cartographer_simple_land.3.png and /dev/null differ diff --git a/textures/cartographer_simple_land.4.png b/textures/cartographer_simple_land.4.png deleted file mode 100644 index fdceb10..0000000 Binary files a/textures/cartographer_simple_land.4.png and /dev/null differ diff --git a/textures/cartographer_simple_water.1.png b/textures/cartographer_simple_water.1.png deleted file mode 100644 index 4ec3706..0000000 Binary files a/textures/cartographer_simple_water.1.png and /dev/null differ diff --git a/textures/cartographer_simple_water.2.png b/textures/cartographer_simple_water.2.png deleted file mode 100644 index 4ec3706..0000000 Binary files a/textures/cartographer_simple_water.2.png and /dev/null differ diff --git a/textures/cartographer_simple_water.3.png b/textures/cartographer_simple_water.3.png deleted file mode 100644 index 56a4e0a..0000000 Binary files a/textures/cartographer_simple_water.3.png and /dev/null differ diff --git a/textures/cartographer_simple_water.4.png b/textures/cartographer_simple_water.4.png deleted file mode 100644 index ef6db3e..0000000 Binary files a/textures/cartographer_simple_water.4.png and /dev/null differ diff --git a/textures/cartographer_swamp.1.png b/textures/cartographer_swamp.1.png deleted file mode 100644 index dd4ac25..0000000 Binary files a/textures/cartographer_swamp.1.png and /dev/null differ diff --git a/textures/cartographer_swamp.2.png b/textures/cartographer_swamp.2.png deleted file mode 100644 index 6282bad..0000000 Binary files a/textures/cartographer_swamp.2.png and /dev/null differ diff --git a/textures/cartographer_swamp.3.png b/textures/cartographer_swamp.3.png deleted file mode 100644 index e625b20..0000000 Binary files a/textures/cartographer_swamp.3.png and /dev/null differ diff --git a/textures/cartographer_swamp.4.png b/textures/cartographer_swamp.4.png deleted file mode 100644 index bad5aaa..0000000 Binary files a/textures/cartographer_swamp.4.png and /dev/null differ diff --git a/textures/cartographer_wasteland.1.png b/textures/cartographer_wasteland.1.png deleted file mode 100644 index 656dc27..0000000 Binary files a/textures/cartographer_wasteland.1.png and /dev/null differ diff --git a/textures/cartographer_wasteland.2.png b/textures/cartographer_wasteland.2.png deleted file mode 100644 index 0872179..0000000 Binary files a/textures/cartographer_wasteland.2.png and /dev/null differ diff --git a/textures/cartographer_wasteland.3.png b/textures/cartographer_wasteland.3.png deleted file mode 100644 index fb069b4..0000000 Binary files a/textures/cartographer_wasteland.3.png and /dev/null differ diff --git a/textures/cartographer_wasteland.4.png b/textures/cartographer_wasteland.4.png deleted file mode 100644 index 571c8f1..0000000 Binary files a/textures/cartographer_wasteland.4.png and /dev/null differ