no help entries for non-enableable plugins

develop
myk002 2022-07-20 13:34:29 -07:00
parent 1f3c4cdd18
commit 048b20ac45
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 18 additions and 1 deletions

@ -3147,6 +3147,21 @@ static int internal_getCommandHelp(lua_State *L)
return 1; return 1;
} }
static int internal_isPluginEnableable(lua_State *L)
{
auto plugins = Core::getInstance().getPluginManager();
const char *name = luaL_checkstring(L, 1);
auto plugin = plugins->getPluginByName(name);
if (plugin)
lua_pushboolean(L, plugin->can_be_enabled());
else
lua_pushnil(L);
return 1;
}
static int internal_threadid(lua_State *L) static int internal_threadid(lua_State *L)
{ {
std::stringstream ss; std::stringstream ss;
@ -3221,6 +3236,7 @@ static const luaL_Reg dfhack_internal_funcs[] = {
{ "listPlugins", internal_listPlugins }, { "listPlugins", internal_listPlugins },
{ "listCommands", internal_listCommands }, { "listCommands", internal_listCommands },
{ "getCommandHelp", internal_getCommandHelp }, { "getCommandHelp", internal_getCommandHelp },
{ "isPluginEnableable", internal_isPluginEnableable },
{ "threadid", internal_threadid }, { "threadid", internal_threadid },
{ "md5File", internal_md5file }, { "md5File", internal_md5file },
{ NULL, NULL } { NULL, NULL }

@ -305,7 +305,8 @@ local function scan_plugins(old_db, db)
HELP_SOURCES.RENDERED or HELP_SOURCES.PLUGIN, HELP_SOURCES.RENDERED or HELP_SOURCES.PLUGIN,
command, {entry_types=entry_types}) command, {entry_types=entry_types})
end end
if not includes_plugin then if not includes_plugin and
dfhack.internal.isPluginEnableable(plugin) then
update_db(old_db, db, update_db(old_db, db,
has_rendered_help(plugin) and has_rendered_help(plugin) and
HELP_SOURCES.RENDERED or HELP_SOURCES.STUB, HELP_SOURCES.RENDERED or HELP_SOURCES.STUB,