Add backwards-compability for 0.4.14
This commit is contained in:
parent
ef37c38ca4
commit
a2c4961f28
16
init.lua
16
init.lua
@ -7,6 +7,14 @@ else
|
||||
end
|
||||
F = function(f) return minetest.formspec_escape(S(f)) end
|
||||
|
||||
-- Compability for 0.4.14 or earlier
|
||||
local colorize
|
||||
if core.colorize then
|
||||
colorize = core.colorize
|
||||
else
|
||||
colorize = function(color, text) return text end
|
||||
end
|
||||
|
||||
doc = {}
|
||||
|
||||
-- Some informational variables
|
||||
@ -756,7 +764,7 @@ function doc.formspec_error_no_categories()
|
||||
local formstring = "size[8,6]textarea[0.25,0;8,6;;"
|
||||
formstring = formstring ..
|
||||
minetest.formspec_escape(
|
||||
core.colorize(COLOR_ERROR, S("Error: No help available.")) .. "\n\n" ..
|
||||
colorize(COLOR_ERROR, S("Error: No help available.")) .. "\n\n" ..
|
||||
S("No categories have been registered, but they are required to provide help.\nThe Documentation System [doc] does not come with help contents on its own, it needs additional mods to add help content. Please make sure such mods are enabled on for this world, and try again.")) .. "\n\n" ..
|
||||
S("Recommended mods: doc_basics, doc_items, doc_identifier, doc_encyclopedia.")
|
||||
formstring = formstring .. ";]button_exit[3,5;2,1;okay;"..F("OK").."]"
|
||||
@ -766,7 +774,7 @@ end
|
||||
function doc.formspec_error_hidden(category_id, entry_id)
|
||||
local formstring = "size[8,6]textarea[0.25,0;8,6;;"
|
||||
formstring = formstring .. minetest.formspec_escape(
|
||||
core.colorize(COLOR_ERROR, S("Error: Access denied.")) .. "\n\n" ..
|
||||
colorize(COLOR_ERROR, S("Error: Access denied.")) .. "\n\n" ..
|
||||
S("Access to the requested entry has been denied; this entry is secret. You may unlock access by progressing in the game. Figure out on your own how to unlock this entry."))
|
||||
formstring = formstring .. ";]button_exit[3,5;2,1;okay;"..F("OK").."]"
|
||||
return formstring
|
||||
@ -918,10 +926,10 @@ function doc.formspec_category(id, playername)
|
||||
local new = total - viewed - hidden
|
||||
-- TODO/FIXME: Check if number of hidden/viewed entries is always correct
|
||||
if viewed < total then
|
||||
formstring = formstring .. core.colorize(COLOR_NOT_VIEWED, minetest.formspec_escape(S("New entries: @1", new)))
|
||||
formstring = formstring .. colorize(COLOR_NOT_VIEWED, minetest.formspec_escape(S("New entries: @1", new)))
|
||||
if hidden > 0 then
|
||||
formstring = formstring .. "\n"
|
||||
formstring = formstring .. core.colorize(COLOR_HIDDEN, minetest.formspec_escape(S("Hidden entries: @1", hidden))).."]"
|
||||
formstring = formstring .. colorize(COLOR_HIDDEN, minetest.formspec_escape(S("Hidden entries: @1", hidden))).."]"
|
||||
else
|
||||
formstring = formstring .. "]"
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user