Changes to how Vehicle Buttons work, try to forward the click to the original buttons

This commit is contained in:
Hendrik Leppkes
2008-11-19 16:10:37 +01:00
parent b5b8dc9479
commit dccc0b43bc
+17 -8
View File
@@ -90,6 +90,8 @@ function Bartender4.Button:Create(id, parent)
self:SetAttribute("showgrid", self:GetAttribute("showgrid") + 1) self:SetAttribute("showgrid", self:GetAttribute("showgrid") + 1)
self:SetAttribute("isSpecial", true) self:SetAttribute("isSpecial", true)
end end
elseif action > 120 and action <= 126 then
self:SetAttribute("type", "click")
else else
self:SetAttribute("type", "action") self:SetAttribute("type", "action")
if self:GetAttribute("isSpecial") then if self:GetAttribute("isSpecial") then
@@ -99,26 +101,29 @@ function Bartender4.Button:Create(id, parent)
end end
self:SetAttribute("action", action) self:SetAttribute("action", action)
local unit = nil
-- fix unit on state change -- fix unit on state change
if self:GetAttribute("assisttype-"..message) == 1 then if action <= 120 then
self:SetAttribute("unit", G_assist_help) if self:GetAttribute("assisttype-"..message) == 1 then
elseif self:GetAttribute("assisttype-"..message) == 2 then unit = G_assist_help
self:SetAttribute("unit", G_assist_harm) elseif self:GetAttribute("assisttype-"..message) == 2 then
else unit = G_assist_harm
self:SetAttribute("unit", nil) end
end end
self:SetAttribute("unit", unit)
G_state = message G_state = message
G_action = action
]]) ]])
button:SetAttribute('_childupdate-assist-help', [[ button:SetAttribute('_childupdate-assist-help', [[
if self:GetAttribute("assisttype-"..G_state) == 1 then if self:GetAttribute("assisttype-"..G_state) == 1 and G_action <= 120 then
self:SetAttribute("unit", message) self:SetAttribute("unit", message)
end end
G_assist_help = message G_assist_help = message
]]) ]])
button:SetAttribute('_childupdate-assist-harm', [[ button:SetAttribute('_childupdate-assist-harm', [[
if self:GetAttribute("assisttype-"..G_state) == 2 then if self:GetAttribute("assisttype-"..G_state) == 2 and G_action <= 120 then
self:SetAttribute("unit", message) self:SetAttribute("unit", message)
end end
G_assist_harm = message G_assist_harm = message
@@ -264,6 +269,10 @@ function Button:RefreshStateAction(state)
local action = self.stateactions[state] local action = self.stateactions[state]
self:SetAttribute("action-"..state, action) self:SetAttribute("action-"..state, action)
if action > 120 and action <= 126 then
self:SetAttribute("clickbutton", _G["VehicleMenuBarActionButton"..tostring(action-120)])
end
self:SetAttribute("assisttype-"..state, nil) self:SetAttribute("assisttype-"..state, nil)
self:SetAttribute("unit", nil) self:SetAttribute("unit", nil)
if self.parent.config.autoassist then if self.parent.config.autoassist then