flickerstreak@159: --[[ Flick@234: ReAction Vehicle Exit button options module flickerstreak@159: --]] flickerstreak@159: flickerstreak@159: -- local imports flickerstreak@175: local addonName, addonTable = ... flickerstreak@175: local ReAction = addonTable.ReAction flickerstreak@159: local L = ReAction.L flickerstreak@159: flickerstreak@159: -- module declaration flickerstreak@159: local moduleID = "VehicleExit" flickerstreak@159: local module = ReAction:NewModule( moduleID ) flickerstreak@159: flickerstreak@159: -- Button class flickerstreak@159: local Button = ReAction.Button.VehicleExit flickerstreak@159: flickerstreak@159: -- module methods flickerstreak@159: function module:OnInitialize() flickerstreak@159: self.registered = { } flickerstreak@159: self.buttons = { } flickerstreak@159: flickerstreak@159: ReAction:RegisterBarOptionGenerator(self, "GetBarOptions") flickerstreak@159: end flickerstreak@159: flickerstreak@159: ---- Options ---- flickerstreak@159: local Handler = { } flickerstreak@159: local meta = { __index = Handler } flickerstreak@159: flickerstreak@159: function Handler:New(bar) flickerstreak@159: return setmetatable( flickerstreak@159: { flickerstreak@159: bar = bar flickerstreak@159: }, meta) flickerstreak@159: end flickerstreak@159: flickerstreak@159: function Handler:GetConfig() flickerstreak@222: return self.bar:GetConfig() flickerstreak@159: end flickerstreak@159: flickerstreak@159: function Handler:GetPassengerOnly() flickerstreak@159: return not self:GetConfig().withControls flickerstreak@159: end flickerstreak@159: flickerstreak@159: function Handler:SetPassengerOnly(info, value) flickerstreak@159: self:GetConfig().withControls = not value Flick@234: Button:UpdateRegistration(self.bar) flickerstreak@159: end flickerstreak@159: flickerstreak@159: flickerstreak@159: function module:GetBarOptions(bar) flickerstreak@159: if bar.config.type == moduleID then flickerstreak@159: return { flickerstreak@159: type = "group", flickerstreak@159: name = L["Exit Vehicle"], flickerstreak@159: handler = Handler:New(bar), flickerstreak@159: args = { flickerstreak@159: passengerOnly = { flickerstreak@159: name = L["Show only when passenger"], flickerstreak@159: desc = L["Only show the button when riding as a passenger in a vehicle (no vehicle controls)"], flickerstreak@159: order = 2, flickerstreak@159: width = "double", flickerstreak@159: type = "toggle", flickerstreak@159: get = "GetPassengerOnly", flickerstreak@159: set = "SetPassengerOnly", flickerstreak@159: }, flickerstreak@159: } flickerstreak@159: } flickerstreak@159: end flickerstreak@159: end flickerstreak@159: flickerstreak@159: