Add header to sections

This commit is contained in:
Y. Wang 2023-09-27 18:45:42 +02:00
parent 610c72ccf9
commit 9af31611b4
3 changed files with 15 additions and 2 deletions

View File

@ -53,6 +53,10 @@ local function htmono(str)
return string.format("<mono>%s</mono>", htescape(str))
end
local function htheader(str)
return string.format("<b>%s</b>", 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("<action name=playhorn><style color=cyan>%s</style></action>", 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

View File

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

View File

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