2022-12-19 16:52:04 +01:00

41 lines
1.1 KiB
Lua

if doc.sub.items then
local register_factoid = doc.sub.items.register_factoid
local function group_factoid(cat, gr, f)
register_factoid(cat, "groups", function(_, def)
return f(def.groups[gr] or 0) or ""
end)
end
for cat, cinfo in pairs{
nodes = {
advtrains_signal = function(x)
if x == 1 then
return "This is a signal with a static aspect."
elseif x == 2 then
return "This is a signal with an adjustable aspect."
end
end,
not_blocking_trains = "This block does not block trains.",
save_in_at_nodedb = "This block is saved in the Advtrains node database.",
},
craftitems = {
at_control = "This wagon has at least one driver stand.",
at_freight = "This wagon can hold freight.",
at_loco = "This wagon is a locomotive.",
at_pax = "This wagon has at least one seat for passengers.",
}
} do
for group, ginfo in pairs(cinfo) do
local tp = type(ginfo)
if tp == "string" then
group_factoid(cat, group, function(x)
if x > 0 then
return ginfo
end
end)
elseif tp == "function" then
group_factoid(cat, group, ginfo)
end
end
end
end