mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 16:39:33 +01:00
49 lines
1.2 KiB
Lua
Executable file
49 lines
1.2 KiB
Lua
Executable file
#! /usr/bin/env lua
|
|
-- Script to automatically generate mods/HUD/mcl_credits/people.lua from CREDITS.md
|
|
-- Run from MCL2 root folder
|
|
|
|
local colors = {
|
|
["Creator of MineClone"] = "0x0A9400",
|
|
["Creator of MineClone2"] = "0xFBF837",
|
|
["Maintainers"] = "0xFF51D5",
|
|
["Developers"] = "0xF84355",
|
|
["Contributors"] = "0x52FF00",
|
|
["MineClone5"] = "0xA60014",
|
|
["Original Mod Authors"] = "0x343434",
|
|
["3D Models"] = "0x0019FF",
|
|
["Textures"] = "0xFF9705",
|
|
["Translations"] = "0x00FF60",
|
|
["Special thanks"] = "0x00E9FF",
|
|
}
|
|
|
|
local from = io.open("CREDITS.md", "r")
|
|
local to = io.open("mods/HUD/mcl_credits/people.lua", "w")
|
|
|
|
to:write([[
|
|
local modname = minetest.get_current_modname()
|
|
local S = minetest.get_translator(modname)
|
|
|
|
]])
|
|
|
|
to:write("return {\n")
|
|
|
|
local started_block = false
|
|
|
|
for line in from:lines() do
|
|
if line:find("## ") == 1 then
|
|
if started_block then
|
|
to:write("\t}},\n")
|
|
end
|
|
local title = line:sub(4, #line)
|
|
to:write("\t{S(\"" .. title .. "\"), " .. (colors[title] or "0xFFFFFF") .. ", {\n")
|
|
started_block = true
|
|
elseif line:find("*") == 1 then
|
|
to:write("\t\t\"" .. line:sub(3, #line) .. "\",\n")
|
|
end
|
|
end
|
|
|
|
if started_block then
|
|
to:write("\t}},\n")
|
|
end
|
|
|
|
to:write("}\n")
|