Skip to content

Instantly share code, notes, and snippets.

@SmallJoker
Last active February 17, 2019 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SmallJoker/03c92442c4b81a6d2e7573c7950a10cc to your computer and use it in GitHub Desktop.
Save SmallJoker/03c92442c4b81a6d2e7573c7950a10cc to your computer and use it in GitHub Desktop.
ASCII-Art in the terminal based on the biome information
-- Minetest Lua mod to have a rudimentary display of the biomes in your world
-- CC0, Written by Krock/SmallJoker 2019
-- Sample image: https://krock-works.uk.to/u/ethereal_cc57167_ASCII_map.png
local STEPSIZE = 32
local X_RADIUS = 1000
local Z_RADIUS = 1000
local CHARACTERS = {
"x", ".", "+", "@", "#",
"▨", "□", "■",
"○", "●",
"▷", "▶",
"⬟", "⬠",
"⬥", "⬦",
"⭙", "⦿", "✪", "✠"
}
minetest.after(2, function()
print("Seed: " .. minetest.get_mapgen_setting("seed"))
print("Stepsize: " .. STEPSIZE)
print("X-Radius: " .. X_RADIUS)
print("Z-Radius: " .. Z_RADIUS)
local biome_names = {}
for z = -Z_RADIUS, Z_RADIUS, STEPSIZE do
local x_slice = {}
for x = -X_RADIUS, X_RADIUS, STEPSIZE do
local data = minetest.get_biome_data({
x = x,
y = 10,
z = z
})
local name = minetest.get_biome_name(data.biome)
local found = table.indexof(biome_names, name)
if found < 0 then
found = #biome_names + 1
biome_names[found] = name
end
x_slice[#x_slice + 1] = CHARACTERS[found]
end
print(table.concat(x_slice, " "))
end
print("Assignments:")
for i, name in ipairs(biome_names) do
print((" %s - %s"):format(CHARACTERS[i], name))
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment