Definition
-- @/lua/ge/extensions/core/recoveryPrompt.lua:538
local function addButton(id, label, atFadeFunction, order, message, active, enabled, fadeActive, icon)
if not id then log("E","","Tried creating button without ID!" ) return end
if buttonOptions[id] and not buttonOptions[id].customButton then log("E","Tried to add a button, but it already exists and it's not a custom button, so it's not allowed! " .. dumps(id)) return end
-- fill some defaults for the button if it doesnt have them
if active == nil then active = true end
if fadeActive == nil then fadeActive = true end
local btn = {
label = label or "No Label!",
atFadeFunction = atFadeFunction or function() log("E","","No Function set for " .. dumps(id) ) end,
order = order or highestOrderPlusOne(),
message = message,
active = active,
enabled = enabled,
customButton = true,
fadeActive = fadeActive,
icon = icon,
uniqueID = id,
}
if buttonOptions[id] then
log("E","","Button for Id already exists and will be overwritten: " .. dumps(id) .. ": " .. dumps(buttonOptions[btn.id]))
end
buttonOptions[id] = btn
-- check if there's any collision for the orders
local orders = {}
for _, o in pairs(buttonOptions) do
if orders[o.order] then log("E","Order Collision for buttons: " .. orders[o.order] .. "/"..o.id) end
orders[o.order] = o.id
end
end
Callers
@/lua/ge/extensions/flowgraph/nodes/gameplay/recoveryPrompt/setRecoveryPromptButton.lua
core_recoveryPrompt.addButton(self.pinIn.buttonId.value, self.pinIn.label.value, nop, self.pinIn.order.value, nil, true, true, self.pinIn.fadeActive.value, self.pinIn.icon.value)
end
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/campaignTiles.lua
buttonInfo = {
buttonInstance.addButton(function()
-- Track recent usage
@/lua/ge/extensions/flowgraph/nodes/ui/buttons/simpleButton.lua
-- create new button.
self.pinOut.buttonId.value = self.mgr.modules.button:addButton({
label = self.pinIn.label.value,
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenWhole.lua
if mission then
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
if not self.mgr.startedAsScenario then
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
else
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
if canContinueHere then
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
defaultBtns = {
self.mgr.modules.ui:addButton(
function()
if self.pinIn[btn..'_active'].value and self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
@/lua/ge/extensions/ui/vehicleSelector/detailsInteraction.lua
for _, button in ipairs(M.customDetailsButtons) do
table.insert(buttonInfo, ui_vehicleSelector_vehicleOperations.addButton(function(additionalData)
if not additionalData then
@/lua/ge/extensions/ui/vehicleSelector/vehicleOperations.lua
if configDetails.Source == "Custom" then
table.insert(buttons, buttonInstance.addButton(nop, {
label = "Edit Metadata",
table.insert(buttons, buttonInstance.addButton(function(...)
guihooks.trigger("ChangeState","play")
table.insert(buttons, buttonInstance.addButton(function(...)
guihooks.trigger("ChangeState","play")
-- Set as default button
table.insert(buttons, buttonInstance.addButton(function()
extensions.core_vehicle_partmgmt.savedefault()
-- Load default button
table.insert(buttons, buttonInstance.addButton(function()
callbackAfterFade = function()
table.insert(buttons, buttonInstance.addButton(function()
guihooks.trigger("ChangeState","vehicle-config/save")
-- Clone current button
table.insert(buttons, buttonInstance.addButton(function()
guihooks.trigger("ChangeState","play")
-- Select Random
table.insert(buttons, buttonInstance.addButton(function()
extensions.hook("onVehicleSelectorSelectRandom")
-- Reset all button
table.insert(buttons, buttonInstance.addButton(function()
resetGameplay(-1)
-- Remove all button
table.insert(buttons, buttonInstance.addButton(function()
core_vehicles.removeAll();
-- Remove current button
table.insert(buttons, buttonInstance.addButton(function()
core_vehicles.removeCurrent();
-- Remove others button
table.insert(buttons, buttonInstance.addButton(function()
core_vehicles.removeAllExceptCurrent();
-- Expose button instance methods for external use
M.addButton = function(...) return buttonInstance.addButton(...) end
M.clearButtonFunctions = function(...) return buttonInstance.clearButtonFunctions(...) end
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/missionTiles.lua
table.insert(data.buttonInfo,
buttonInstance.addButton(function()
-- Track recent usage
@/lua/ge/extensions/ui/gridSelectorUtils/buttonModule.lua
-- Add a button with callback function
local function addButton(callback, meta)
local buttonId = getFreeButtonId()
@/lua/ge/extensions/flowgraph/nodes/ui/buttons/simpleMultipleButtons.lua
for i = 1, self.count do
self.pinOut['buttonId_' ..i].value = self.mgr.modules.button:addButton({
label = self.pinIn['label_' ..i].value,
@/lua/ge/extensions/flowgraph/modules/buttonModule.lua
-- adds a new Button.
function C:addButton(data)
local id = self:getFreeId()
@/lua/ge/extensions/ui/appSelector/general.lua
-- Add "Add to layout" button
local addToLayoutButton = buttonInstance.addButton(function(additionalData)
guihooks.trigger('appContainer:spawn', { appName = app.appName })
@/lua/ge/extensions/flowgraph/nodes/ui/buttons/createButton.lua
function C:workOnce()
self.pinOut.buttonId.value = self.mgr.modules.button:addButton({
label = self.pinIn.label.value,
@/lua/ge/extensions/flowgraph/modules/uiModule.lua
if self.uiLayout.mode == 'startScreen' then
table.insert(self.uiLayout.buttons, self:addButton(function()
self.mgr.graphs[self.uiLayout._node.graphId].nodes[self.uiLayout._node.nodeId]:startFromUi()
if mission and mission:hasRules() then
table.insert(self.uiLayout.buttons, self:addButton(function()
mission:showRulesAsPopups()
function C:addButton(fun, meta)
if not self.isBuilding then
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/scenarioTiles.lua
buttonInfo = {
buttonInstance.addButton(function()
-- Track recent usage
@/lua/ge/extensions/freeroam/freeroamConfigurator.lua
buttonModule.addButton(M.startFreeroam, {
label = "Start Freeroam",
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenBegin.lua
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
if self.pinIn.contStartActive.value then
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
else
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
if self.pinIn.contHereActive.value then
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
defaultBtns = {
self.mgr.modules.ui:addButton(
function()
if self.pinIn[btn..'_active'].value and self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
if mission then
table.insert(defaultBtns, self.mgr.modules.ui:addButton(
function()
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/levelTiles.lua
table.insert(data.buttonInfo,
buttonInstance.addButton(function()
-- Track recent usage
table.insert(data.buttonInfo,
buttonInstance.addButton(function()
-- open freeroam configurator with current level and spawn point
for _, button in ipairs(customButtons) do
table.insert(data.buttonInfo, buttonInstance.addButton(function()
button.callback(itemDetails.levelName, itemDetails.spawnPointObjectName, itemDetails.key)