Page 1 of 1
how to block external widgets for a game
Posted: 28 Dec 2010, 05:08
by bobthedinosaur
I hear lots of talk about it, but I haven't found which files do this and how this works. Any one have some working examples to show off? Black list/ white list could work too. I just want something to stop 3rd part widgets that conflict with a game's widget system.
Re: how to block external widgets for a game
Posted: 29 Dec 2010, 15:40
by SirMaverick
bobthedinosaur wrote:I hear lots of talk about it,
You probably mostly hear the rage of players that cry because their widgets don't work in some mods that block user widgets by default even if you can use your local widgets, just not by default. (And they also spread many
lies false statements about it.)
but I haven't found which files do this and how this works. Any one have some working examples to show off?
In CA etc. it's done in the widget handler. When it starts it reads config if user widgets should be blocked or not (that's why you need to reload luaui when changing that option) by changing the virtual file system access mode (VFSMODE).
If it should block local widgets it only reads the mod widgets (VFS.ZIP), else it reads both: either VFS.RAW_FIRST or VFS.ZIP_FIRST depending you want preference on local or mod widgets - that's configurable, too.
See e.g.
http://trac.caspring.org/browser/trunk/ ... idgets.lua lines 63ff.
chili ui for changing options:
http://trac.caspring.org/browser/trunk/ ... idgets.lua
Re: how to block external widgets for a game
Posted: 29 Dec 2010, 18:24
by bobthedinosaur
Sounds complicated. I'd settle for this
some mods that block user widgets by default even if you can use your local widgets, just not by default.
if I knew how.
Re: how to block external widgets for a game
Posted: 30 Dec 2010, 00:52
by Niobium
bobthedinosaur wrote:Sounds complicated. I'd settle for this
some mods that block user widgets by default even if you can use your local widgets, just not by default.
if I knew how.
Easiest way* is to put a copy of the default widget handler widgets.lua into your mod, and then look for the following lines:
Code: Select all
local autoUserWidgets = Spring.GetConfigInt('LuaAutoEnableUserWidgets', 1)
self.autoUserWidgets = (autoUserWidgets ~= 0)
Which is loading the users preference as to whether they want their user widgets to enable themselves automatically. So you just remove loading their preference and replace it with a solid no.
*Note: Completed untested.
Re: how to block external widgets for a game
Posted: 30 Dec 2010, 18:34
by bobthedinosaur
Are you talking about this widget handler?
http://pastebin.com/9HqQssnw
I can't find any line in there that look like
local autoUserWidgets = Spring.GetConfigInt('LuaAutoEnableUserWidgets', 1)
self.autoUserWidgets = (autoUserWidgets ~= 0)
Re: how to block external widgets for a game
Posted: 30 Dec 2010, 18:49
by SirMaverick
Re: how to block external widgets for a game
Posted: 31 Dec 2010, 00:55
by Niobium
That one already loads user widgets as disabled from the looks of it