diff --git a/.cdbrelease.lua b/.cdbrelease.lua index c679e23..6cb543c 100644 --- a/.cdbrelease.lua +++ b/.cdbrelease.lua @@ -1,14 +1,11 @@ -- LUALOCALS < --------------------------------------------------------- -local dofile, math, pairs, string, table, tonumber - = dofile, math, pairs, string, table, tonumber -local math_floor, string_format, table_concat, table_sort - = math.floor, string.format, table.concat, table.sort +local dofile, pairs, string, table + = dofile, pairs, string, table +local string_format, table_concat, table_sort + = string.format, table.concat, table.sort -- LUALOCALS > --------------------------------------------------------- -local stamp = tonumber("$Format:%at$") -if not stamp then return end -stamp = math_floor((stamp - 1540612800) / 60) -stamp = ("00000000" .. stamp):sub(-8) +local version = dofile("./mods/piredo_api/version.lua") -- luacheck: push -- luacheck: globals config readtext readbinary @@ -41,7 +38,7 @@ return { user = "Warr1024", pkg = "piranesi_redo", dev_state = "ACTIVELY_DEVELOPED", - version = stamp .. "-$Format:%h$", + version = version, type = "game", title = "Piranesi Restoration Project", short_description = "Discover the secrets of the space-bending house, in this polished" diff --git a/.gitattributes b/.gitattributes index 9ba6bc8..fbf7007 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ -.cdbrelease.lua export-subst +version.lua export-subst .cdb-* export-ignore .git* export-ignore .lua* export-ignore diff --git a/.luacheckrc b/.luacheckrc index 677a8af..d2d8cc4 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -12,6 +12,7 @@ globals = { "piredo_items", "piredo_schems", "piredo_map", + "piredo_version", "translated_stats", } color = false diff --git a/.lualocals b/.lualocals index 85b3df9..3eaae4f 100644 --- a/.lualocals +++ b/.lualocals @@ -11,4 +11,5 @@ piredo_player piredo_items piredo_schems piredo_map +piredo_version translated_stats \ No newline at end of file diff --git a/mods/piredo_api/init.lua b/mods/piredo_api/init.lua index f5927f9..247a79c 100644 --- a/mods/piredo_api/init.lua +++ b/mods/piredo_api/init.lua @@ -85,3 +85,5 @@ do end shareglobal("translated_stats", include("translated")) + +shareglobal("piredo_version", include("version")) diff --git a/mods/piredo_api/version.lua b/mods/piredo_api/version.lua new file mode 100644 index 0000000..e5a16a6 --- /dev/null +++ b/mods/piredo_api/version.lua @@ -0,0 +1,16 @@ +-- LUALOCALS < --------------------------------------------------------- +local math, string, tonumber + = math, string, tonumber +local math_floor, string_match + = math.floor, string.match +-- LUALOCALS > --------------------------------------------------------- + +local stamp = tonumber("$Format:%at$") +if not stamp then return end +stamp = math_floor((stamp - 1540612800) / 60) +stamp = ("00000000" .. stamp):sub(-8) + +local date = "$FORMAT:%as$"; +date = string_match(date, "^%d%d%d%d-%d%d-%d%d$") and date or nil + +return stamp .. "-$Format:%h$", date diff --git a/mods/piredo_player/endcredits.lua b/mods/piredo_player/endcredits.lua index 61611b2..e337ee0 100644 --- a/mods/piredo_player/endcredits.lua +++ b/mods/piredo_player/endcredits.lua @@ -1,8 +1,8 @@ -- LUALOCALS < --------------------------------------------------------- -local S, get_mod_api, ipairs, math, minetest, piredo_player, string, - table, tonumber, translated_stats - = S, get_mod_api, ipairs, math, minetest, piredo_player, string, - table, tonumber, translated_stats +local S, get_mod_api, ipairs, math, minetest, piredo_player, + piredo_version, string, table, tonumber, translated_stats + = S, get_mod_api, ipairs, math, minetest, piredo_player, + piredo_version, string, table, tonumber, translated_stats local math_floor, string_format, string_match, table_concat = math.floor, string.format, string.match, table.concat -- LUALOCALS > --------------------------------------------------------- @@ -53,11 +53,11 @@ local function getcredits(player, timer, completion) local lang = info and info.lang_code or srclang if lang == "" then lang = srclang end local prop = (translated_stats[lang] or 0) / translated_stats[srclang] + local devver = S("DEVELOPMENT VERSION") return { "", "", "", - "", S("Programming - Warr1024"), S("Writing and Design - iarbat"), S("See LICENSE.txt for all contributors"), @@ -68,6 +68,9 @@ local function getcredits(player, timer, completion) S("~ @1% translated into your language (@2)", math_floor(prop * 100), lang), "", + S("Version"), + piredo_version or devver, + "", S("Time"), timer, "", diff --git a/src/languages/en.json b/src/languages/en.json index db833f7..dce7d7e 100644 --- a/src/languages/en.json +++ b/src/languages/en.json @@ -66,6 +66,7 @@ "Completion": "Completion", "Crystal": "Crystal", "Cyan": "Cyan", + "DEVELOPMENT VERSION": "DEVELOPMENT VERSION", "Garlic Braid": "Garlic Braid", "Gold": "Gold", "Gold Crown": "Gold Crown", @@ -128,6 +129,7 @@ "The Tower": "The Tower", "The Treasure Room": "The Treasure Room", "Time": "Time", + "Version": "Version", "Watch": "Watch", "White": "White", "White Dandelion": "White Dandelion",