how to block external widgets for a game

how to block external widgets for a game

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

how to block external widgets for a game

Post 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.
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: how to block external widgets for a game

Post 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
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: how to block external widgets for a game

Post 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.
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: how to block external widgets for a game

Post 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.

Code: Select all

self.autoUserWidgets = false
*Note: Completed untested.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: how to block external widgets for a game

Post 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)
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: how to block external widgets for a game

Post by Niobium »

bobthedinosaur wrote:Are you talking about this widget handler? http://pastebin.com/9HqQssnw
That one already loads user widgets as disabled from the looks of it
Post Reply

Return to “Lua Scripts”