toggleCouplers
Definition
-- @/lua/vehicle/beamstate.lua:344
-- this is called on keypress (L)
local function toggleCouplers(_nodetag, forceLocked, forceWelded, forceAutoCoupling)
if not _nodetag or (_nodetag and forceAutoCoupling) then
local externalAutoCouplingActive = extensions.couplings.isAutoCouplingActive()
if autoCouplingActive or externalAutoCouplingActive then
obj:stopLatching()
disableAutoCoupling()
else
local externalIsCouplerAttached = extensions.couplings.isCouplerAttached()
if (isCouplerAttached() or externalIsCouplerAttached) and not _nodetag then
detachCouplers()
else
activateAutoCoupling(_nodetag)
end
end
else
local isAttached = false
for cid, coupler in pairs(couplerCache) do
if coupler.couplerTag == _nodetag then
isAttached = isAttached or attachedCouplers[cid] ~= nil
end
end
if isAttached then
detachCouplers(_nodetag, forceLocked, forceWelded)
else
attachCouplers(_nodetag)
end
end
end
Callers
@/lua/ge/extensions/flowgraph/nodes/vehicle/beamstate/couple.lua
if self.data.mode == 'toggle' then
veh:queueLuaCommand("beamstate.toggleCouplers()")
elseif self.data.mode == 'activate' then
@/lua/vehicle/extensions/tech/techCore.lua
M.handleToggleCouplers = function(request)
beamstate.toggleCouplers(request.tag, request.forceLocked, request.forceWelded, request.forceAutoCoupling)
end
@/ui/ui-vue/mockdata/inputBindings.js
"title": "ui.inputActions.gameplay.couplersToggle.title",
"onDown": "beamstate.toggleCouplers()",
"order": 30,
@/lua/vehicle/beamstate.lua
onSelect = function()
beamstate.toggleCouplers()
return {"reload"}