Merge pull request #2693 from myk002/myk_revert_always_enabled

remove unused always_enabled attribute for overlays
develop
Myk 2023-01-22 17:10:04 -08:00 committed by GitHub
commit ab10b84de4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 7 deletions

@ -125,10 +125,6 @@ The ``overlay.OverlayWidget`` superclass defines the following class attributes:
not annoy the player. Set to 0 to be called at the maximum rate. Be aware not annoy the player. Set to 0 to be called at the maximum rate. Be aware
that running more often than you really need to will impact game FPS, that running more often than you really need to will impact game FPS,
especially if your widget can run while the game is unpaused. especially if your widget can run while the game is unpaused.
- ``always_enabled`` (default: ``false``)
Set this to ``true`` if you don't want to let the user disable the widget.
This is useful for widgets that are controlled purely through their
triggers. See `gui/pathable` for an example.
Registering a widget with the overlay framework Registering a widget with the overlay framework
*********************************************** ***********************************************

@ -184,7 +184,6 @@ end
local function do_disable(args, quiet) local function do_disable(args, quiet)
local disable_fn = function(name, db_entry) local disable_fn = function(name, db_entry)
if db_entry.widget.always_enabled then return end
overlay_config[name].enabled = false overlay_config[name].enabled = false
if db_entry.widget.hotspot then if db_entry.widget.hotspot then
active_hotspot_widgets[name] = nil active_hotspot_widgets[name] = nil
@ -252,7 +251,7 @@ local function load_widget(name, widget_class)
local config = overlay_config[name] local config = overlay_config[name]
config.pos = sanitize_pos(config.pos or widget.default_pos) config.pos = sanitize_pos(config.pos or widget.default_pos)
widget.frame = make_frame(config.pos, widget.frame) widget.frame = make_frame(config.pos, widget.frame)
if config.enabled or widget.always_enabled then if config.enabled then
do_enable(name, true, true) do_enable(name, true, true)
else else
config.enabled = false config.enabled = false
@ -492,7 +491,6 @@ OverlayWidget.ATTRS{
hotspot=false, -- whether to call overlay_onupdate on all screens hotspot=false, -- whether to call overlay_onupdate on all screens
viewscreens={}, -- override with associated viewscreen or list of viewscrens viewscreens={}, -- override with associated viewscreen or list of viewscrens
overlay_onupdate_max_freq_seconds=5, -- throttle calls to overlay_onupdate overlay_onupdate_max_freq_seconds=5, -- throttle calls to overlay_onupdate
always_enabled=false, -- for overlays that should never be disabled
} }
function OverlayWidget:init() function OverlayWidget:init()