API ReferenceGE Extensionscareermodulesdelivery
Delivery Parcel Manager
M.dependencies = {"freeroam_facilities"}
Dependencies
M.dependencies = {"freeroam_facilities"}Central cargo data store - adds, moves, and queries all cargo items. Manages transient moves (staging before commit), location comparison, reward calculation, and modifier tracking.
Module Info
| Field | Value |
|---|---|
| Path | extensions/career/modules/delivery/parcelManager.lua |
| Global | career_modules_delivery_parcelManager |
| Dependencies | freeroam_facilities |
Public API
| Function | Signature | Description |
|---|---|---|
addCargo | (cargo, silent) | Adds a cargo item. Triggers onCargoGenerated unless silent |
changeCargoLocation | (cargoId, newLocation) | Moves cargo. Adjusts material storages, sets loadedAtTimeStamp, marks delivered |
addTransientMoveCargo | (cargoId, targetLocation) | Stages a cargo move (not yet committed) |
getTransientMoveCargo | () | Returns all cargo with pending transient moves |
clearTransientMoveForCargo | (cargoId) | Removes transient move for one cargo |
clearAllTransientMoves | () | Clears all transient moves |
applyTransientMoves | (currentLocation) | Commits transient moves at a location. Returns movedCargo, remainingCargo |
getTransientMovesForTargetLocationWithCargo | (targetLocation) | Returns cargo with transient moves targeting a location |
clearTransientFlags | () | Deprecated stub |
undoTransientCargo | () | Placeholder for undo functionality |
sameLocation | (a, b) | Compares two location tables for equality |
sameLocationCargo | (cargo, otherLoc) | Checks if cargo.location matches otherLoc |
getAllCargoCustomFilter | (filter, ...) | Returns cargo matching a custom filter function |
getAllCargoForLocation | (loc) | Returns all cargo at a specific location |
getAllCargoForLocationUnexpired | (loc) | Returns unexpired cargo at a location |
getAllCargoForLocationUnexpiredUndelivered | (loc, timeExpire, timeGenerated) | Returns unexpired, undelivered cargo at a location |
getAllCargoForFacilityUnexpiredUndelivered | (facId, timeExpire, timeGenerated) | Returns unexpired, undelivered cargo for a facility |
getAllCargoForDestinationFacilityStillAtOriginUnexpired | (facId) | Returns cargo destined for a facility still at origin |
getAllCargoAtFacilityUnexpired | (facId) | Returns all unexpired cargo at a facility |
getAllCargoInVehicles | (includeTransient) | Returns all cargo in vehicle containers |
getLocationLabelShort | (loc) | Short display label for a location |
getLocationLabelLong | (loc) | Long display label with parking spot name |
getCargoById | (cargoId) | Returns a cargo item by ID |
getRewardsWithBreakdown | (cargo) | Calculates original, breakdown, and adjusted rewards (timed mods, loaners, precision parking, branch multiplier) |
addParcelRewardsSummary | (cargo) | Groups cargo and attaches reward breakdowns for UI |
cleanUpCargo | () | Removes expired and deleted cargo items |
| addParcelRewards | - | Dead reference (undefined local); likely deprecated in favor of addParcelRewardsSummary |
| onCareerActivated | () | Initializes delivery module references |
Hooks
| Hook | Description |
|---|---|
onUpdate | Updates timed modifiers, sends tasklist changes, cleans up cargo |
onTrailerAttached | Updates loaner organization tracking on cargo when trailers are attached |
Location Types
| Type | Fields | Description |
|---|---|---|
facilityParkingspot | facId, psPath | At a facility parking spot |
vehicle | vehId, containerId | In a vehicle cargo container |
multi | destinations[] | Multiple possible destinations |
delete / deleted | - | Marked for removal |
playerAvatar | - | On the player |
Usage Example
-- Get all cargo in player vehicles
local cargo = career_modules_delivery_parcelManager.getAllCargoInVehicles(true)
-- Move cargo to a vehicle container
career_modules_delivery_parcelManager.addTransientMoveCargo(42, {type="vehicle", vehId=100, containerId=0})
career_modules_delivery_parcelManager.applyTransientMoves()
-- Calculate delivery rewards
local orig, breakdown, adjusted = career_modules_delivery_parcelManager.getRewardsWithBreakdown(cargo)See Also
career_modules_delivery_generator- Cargo generationcareer_modules_delivery_general- Delivery modecareer_modules_delivery_parcelMods- Modifier systemcareer_modules_delivery_precisionParking- Parking bonus
Additional Exports
Functions
| Function | Description |
|---|---|
M.onCareerActivated() | No description available |
Values/Properties
| Export | Description |
|---|---|
M.addCargo | Value: addCargo |
M.addParcelRewards | Value: addParcelRewards |
M.addParcelRewardsSummary | Value: addParcelRewardsSummary |
M.addTransientMoveCargo | Value: addTransientMoveCargo |
M.applyTransientMoves | Value: applyTransientMoves |
M.changeCargoLocation | Value: changeCargoLocation |
M.cleanUpCargo | Value: cleanUpCargo |
M.clearAllTransientMoves | Value: clearAllTransientMoves |
M.clearTransientFlags | Value: clearTransientFlags |
M.clearTransientMoveForCargo | Value: clearTransientMoveForCargo |
M.getAllCargoAtFacilityUnexpired | Value: getAllCargoAtFacilityUnexpired |
M.getAllCargoCustomFilter | Value: getAllCargoCustomFilter |
M.getAllCargoForDestinationFacilityStillAtOriginUnexpired | Value: getAllCargoForDestinationFacilityStillAtOriginUnexpired |
M.getAllCargoForFacilityUnexpiredUndelivered | Value: getAllCargoForFacilityUnexpiredUndelivered |
M.getAllCargoForLocation | Value: getAllCargoForLocation |
M.getAllCargoForLocationUnexpired | Value: getAllCargoForLocationUnexpired |
M.getAllCargoForLocationUnexpiredUndelivered | Value: getAllCargoForLocationUnexpiredUndelivered |
M.getAllCargoInVehicles | Value: getAllCargoInVehicles |
M.getCargoById | Value: getCargoById |
M.getLocationLabelLong | Value: getLocationLabelLong |
M.getLocationLabelShort | Value: getLocationLabelShort |
M.getRewardsWithBreakdown | Value: getRewardsWithBreakdown |
M.getTransientMoveCargo | Value: getTransientMoveCargo |
M.getTransientMovesForTargetLocationWithCargo | Value: getTransientMovesForTargetLocationWithCargo |
M.onBranchTierReached | Value: onBranchTierReached |
M.onTrailerAttached | Value: onTrailerAttached |
M.onUpdate | Value: onUpdate |
M.sameLocation | Value: sameLocation |
M.sameLocationCargo | Value: sameLocationCargo |
M.undoTransientCargo | Value: undoTransientCargo |
Delivery Pages (Logbook)
Provides logbook entries for the delivery system - facility overview, delivery history, and cargo modifier progress pages.
Delivery Parcel Modifiers
Defines cargo modifiers (timed, precious, large, fluid, etc.), generates them per-parcel, tracks modifier statistics, and checks unlock status.