mp.jobs
Hand out freight jobs.
assign
mp.jobs.assign(player: PlayerRef, job: JobSpec): voidStarts a freight market job for the player, as if they had taken it in the game's freight market with their own truck: the company's trailer waits at the source, the route leads there (and on to the destination once the trailer is coupled), the player drives there and delivers. Source, destination and cargo are checked against mp.world when the map data is there: an unknown one throws a RangeError. A running job is cancelled first. The source company needs at least one job offer in the game (it is rewritten to this cargo and destination). income: payment on delivery in euro (the difference to the game's payment is booked on delivery); without it the game's own payment applies.
Types: JobSpec
JobBuilder
Builds a freight market job and assigns it to a player (mp.jobs.assign).
const job = new JobBuilder()
job.cargo = "apples"
job.source = { company: "tradeaux", city: "dusseldorf" }
job.destination = { company: "dfh", city: "hamburg" }
job.income = 12000
job.assign(player)| Member | Description |
|---|---|
constructor(init?: Partial<OpenRoadMP.JobSpec>) | Optionally with the values right away. |
cargo: string | Cargo id, e.g. "apples" |
source: OpenRoadMP.JobPlaceRef | null | Where the trailer waits |
destination: OpenRoadMP.JobPlaceRef | null | Where it goes |
income: number | null | Payment in euro on delivery; null = the game's own payment |
assign(player: OpenRoadMP.PlayerRef): void | Starts the job for the player (mp.jobs.assign). Throws if cargo, source or destination is missing. |