API Reference GE Extensions flowgraph modules Vehicle Module Flowgraph module that tracks all vehicles used by a flowgraph-spawned or foreign. Manages vehicle readiness, coupler attachments, bus systems, fuel storage, walk blacklist backup, and cleanup on flowg
Flowgraph module that tracks all vehicles used by a flowgraph-spawned or foreign. Manages vehicle readiness, coupler attachments, bus systems, fuel storage, walk blacklist backup, and cleanup on flowgraph stop.
Property Value Description moduleOrder-150Very early initialization (before most modules) dependenciesgameplay_walk, core_vehicleBridgeRequired extensions hooksonCouplerAttached, onCouplerDetached, onBusUpdate, onVehicleResettedVehicle event hooks
Method Description C:init()Initializes vehicles, sortedIds, couplings, unReadyIds; calls clear() C:clear()Clears vehicles, sortedIds, couplings tables C:executionStarted()Saves walk blacklist and trailer respawn state C:executionStopped()Deletes non-kept vehicles; restores fuel for kept vehicles; restores walk blacklist and trailer respawn state
Method Description C:addVehicle(veh, moreData)Registers a vehicle for tracking; sets canSave=false; initializes coupler data C:addForeignVehicle(veh, moreData)Adds externally spawned vehicle with dontDelete=true C:getVehicle(id)Returns tracked vehicle data or empty table C:getSpawnedVehicles()Returns deep copy of sorted vehicle ID list C:getVehicleIdByInternalName(name)Finds vehicle ID by exact internal name match C:getVehiclesIdByInternalNameMatch(name)Finds vehicle IDs by partial internal name match C:setKeepVehicle(id, keep)Marks vehicle to survive flowgraph stop; sets prefab to unpack before deletion
Method Description C:onUpdate()Polls unready vehicles; calls readyUpVehicle when ready C:readyUpVehicle(id)Enables map tracking, requests coupler offsets for all tag types via core_vehicleBridge
Method Description C:addCouplerOffset(id, off, tag)Stores coupler offset positions by tag; sorts by tag priority C:onCouplerAttached(objId1, objId2, nodeId, obj2nodeId)Records coupling between two vehicles C:onCouplerDetached(objId1, objId2, nodeId, obj2nodeId)Removes coupling record C:isCoupled(id)Returns truthy if vehicle has any coupling C:isCoupledTo(id, other)Returns truthy if two specific vehicles are coupled
Method Description C:storeFuelAmount(id)Snapshots current energy storage for later restoration
Method Description C:isBus(id)Returns true if vehicle body style is "Bus" C:requestBusData(id)Requests bus trigger tick data from vehicle C:updateBusDisplayData(id, data)Sends route change data to bus controller C:registerBusChangeNotification(id)Registers for kneel/door state change notifications C:isBusKneel(id)Returns true if bus is kneeling C:isBusDoorOpen(id)Returns true if bus door is open C:requestBusStop(id, data)Sends stop request to bus controller
Method Description C:onVehicleResetted(id)Forwards reset event to activity's onVehicleReset if available
local vehMod = mgr. modules . vehicle
-- Track a spawned vehicle
vehMod : addVehicle (spawnedVeh)
-- Track player's existing vehicle (won't delete on stop)
vehMod : addForeignVehicle (playerVeh)
-- Check coupler state
if vehMod : isCoupled (trailerId) then
if vehMod : isCoupledTo (trailerId, truckId) then
-- Truck-trailer connected
end
end
-- Store and restore fuel
vehMod : storeFuelAmount (vehId)
-- fuel auto-restored on executionStopped for kept vehicles
-- Bus operations
if vehMod : isBus (vehId) then
vehMod : registerBusChangeNotification (vehId)
vehMod : updateBusDisplayData (vehId, routeData)
end
Coupler tag priority: tow_hitch(1), fifthwheel(2), gooseneck_hitch(3), fifthwheel_v2(4), pintle(5)
Vehicle readiness polled each frame in onUpdate() until veh:isReady() returns true
Walk blacklist saved/restored to prevent flowgraph from permanently modifying player walk restrictions
Trailer respawn state saved/restored via core_trailerRespawn
Energy storage restoration uses core_vehicleBridge.executeAction(veh, 'setEnergyStorageEnergy', ...)
Editor integration: calls editor.onRemoveSceneTreeObjects before deletion if editor loaded