activateAutoCoupling
Definition
-- @/lua/vehicle/beamstate.lua:245
local function activateAutoCoupling(_nodetag)
if not hasActiveCoupler then
return
end
local nodeTags
local forwardToCouplingsExtension = true
if type(_nodetag) == "string" then
nodeTags = {[_nodetag] = true}
forwardToCouplingsExtension = false
elseif type(_nodetag) == "table" then
nodeTags = {}
for _, tag in ipairs(_nodetag) do
nodeTags[tag] = true
end
forwardToCouplingsExtension = false
end
autoCouplingActive = true
autoCouplingTimeoutTimer = 0
autoCouplingTimer = 0
local visibleTags
if not nodeTags then
visibleTags = {}
for _, c in pairs(couplerCache) do
if not c.couplerWeld and not c.couplerLock and c.couplerTag then
visibleTags[c.couplerTag] = true
end
end
else
visibleTags = nodeTags
end
autoCouplingVisibleTags = visibleTags
broadcastCouplerVisibility(visibleTags)
if forwardToCouplingsExtension then
extensions.couplings.onBeamstateActivateAutoCoupling()
end
end
Callers
@/lua/ge/extensions/flowgraph/nodes/vehicle/alignForCoupling.lua
v2:resetBrokenFlexMesh()
v1:queueLuaCommand('beamstate.activateAutoCoupling()')
self.waitForCouple = true
@/lua/ge/extensions/core/trailerRespawn.lua
if core_vehicles.couplerTagsOptions[couplerTag] == "autoCouple" then
veh:queueLuaCommand(string.format('beamstate.activateAutoCoupling("%s")', couplerTag))
end
@/lua/ge/extensions/core/vehicles.lua
if M.couplerTagsOptions[vehCouplerTag] == "autoCouple" then
veh:queueLuaCommand(string.format('beamstate.activateAutoCoupling("%s")', vehCouplerTag))
end
@/lua/ge/spawn.lua
if core_vehicles.couplerTagsOptions[couplerTag] == "autoCouple" then
veh:queueLuaCommand(string.format('beamstate.activateAutoCoupling("%s")', couplerTag))
end
@/lua/ge/extensions/flowgraph/nodes/vehicle/beamstate/couple.lua
elseif self.data.mode == 'activate' then
veh:queueLuaCommand("beamstate.activateAutoCoupling()")
elseif self.data.mode == 'disable' then
@/lua/vehicle/beamstate.lua
else
activateAutoCoupling(_nodetag)
end