Display version in end credits screen

This helps verify speedruns, since things like room routing
or other subtle things may be version dependent.
This commit is contained in:
Aaron Suen 2024-02-11 17:20:39 -05:00
parent c105ca4ff7
commit b8cc40015d
8 changed files with 37 additions and 15 deletions

View File

@ -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"

2
.gitattributes vendored
View File

@ -1,4 +1,4 @@
.cdbrelease.lua export-subst
version.lua export-subst
.cdb-* export-ignore
.git* export-ignore
.lua* export-ignore

View File

@ -12,6 +12,7 @@ globals = {
"piredo_items",
"piredo_schems",
"piredo_map",
"piredo_version",
"translated_stats",
}
color = false

View File

@ -11,4 +11,5 @@ piredo_player
piredo_items
piredo_schems
piredo_map
piredo_version
translated_stats

View File

@ -85,3 +85,5 @@ do
end
shareglobal("translated_stats", include("translated"))
shareglobal("piredo_version", include("version"))

View File

@ -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

View File

@ -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,
"",

View File

@ -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",