From 9af31611b448264708e574bf88de8a8afe1c0aa9 Mon Sep 17 00:00:00 2001 From: "Y. Wang" Date: Wed, 27 Sep 2023 18:45:42 +0200 Subject: [PATCH] Add header to sections --- init.lua | 10 ++++++++-- locale/template.txt | 6 ++++++ mod.conf | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index f8aaf75..954d216 100644 --- a/init.lua +++ b/init.lua @@ -53,6 +53,10 @@ local function htmono(str) return string.format("%s", htescape(str)) end +local function htheader(str) + return string.format("%s", htescape(str)) +end + local function describe_conns(conns) local connsdesc = {[0] = "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"} if type(conns) == "table" then @@ -298,10 +302,9 @@ local function doc_register_wagon(itemname) table.insert(desctext, tostring(prototype._doc_wagon_longdesc)) blankline(desctext) end + table.insert(desctext, htheader(S("Basic Information"))) table.insert(desctext, S("Itemstring: @1", htmono(itemname))) addlist(desctext, prototype.drops, S("Drops:"), S("Drops nothing"), false, function(_, v) return list_itemstring(v) end) - - blankline(desctext) addlist(desctext, prototype.drives_on, S("Drives on:"), nil, nil, htmono) addlist(desctext, prototype.coupler_types_front, S("Compatible front couplers:"), S2("Front coupler: @1", "Absent"), S2("Front coupler: @1", "Universal"), ht_coupler_name) addlist(desctext, prototype.coupler_types_back, S("Compatible rear couplers:"), S2("Rear coupler: @1", "Absent"), S2("Rear coupler: @1", "Universal"), ht_coupler_name) @@ -312,6 +315,7 @@ local function doc_register_wagon(itemname) table.insert(desctext, S("Horn sound: @1", hornsound and string.format("", htmono(hornsound.name)) or S("Undefined"))) blankline(desctext) + table.insert(desctext, htheader(S("Wagon Capacity"))) table.insert(desctext, S("Passenger seats: @1", prototype.max_passengers)) table.insert(desctext, S("Driver seats: @1", prototype.max_drivers)) if prototype.has_inventory then @@ -323,6 +327,7 @@ local function doc_register_wagon(itemname) end blankline(desctext) + table.insert(desctext, htheader(S("Wagon Appearance"))) table.insert(desctext, S("Mesh: @1", prototype.mesh and htmono(prototype.mesh) or "None")) addlist(desctext, prototype.textures, S("Textures:"), S("No textures"), false, function(_, v) return htmono(v) end) @@ -353,6 +358,7 @@ local function doc_register_wagon(itemname) end blankline(desctext) + table.insert(desctext, htheader(S("Implementation Details"))) local attachment_offset_support = S("Unsupported") if advtrains_attachment_offset_patch then local t = advtrains_attachment_offset_patch diff --git a/locale/template.txt b/locale/template.txt index 34417cb..614ef8f 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -45,3 +45,9 @@ Proper player attachment positioning: @1=Proper player attachment positioning: @ Custom instantiation callback: @1=Custom instantiation callback: @1 Custom step function: @1=Custom step function: @1 Custom velocity change callback: @1=Custom velocity change callback: @1 + +# Headings +Basic Information=Basic Information +Wagon Capacity=Wagon Capacity +Wagon Appearance=Wagon Appearance +Implementation Details=Implementation Details diff --git a/mod.conf b/mod.conf index fc2e419..1b54051 100644 --- a/mod.conf +++ b/mod.conf @@ -2,3 +2,4 @@ name=advtrains_doc_integration title=Documentation system integration for Advtrains depends=advtrains,doc optional_depends=advtrains_attachment_offset_patch,advtrains_livery_database,dlxtrains,doc_items,multi_component_liveries +supported_games=*,minetest_game