Skip to content

Cargo Tutorial

WhistleWiz edited this page Nov 30, 2024 · 15 revisions

To create cargo, you can create a json file manually, or use the Unity Editor package (required to pack models). You can find this package in the releases page.

Using the Unity package

Import the package into a project and it will automatically be setup for cargo creation. You do not need to use an empty project, and it is recommended to use the same project where Custom Car Loader (CCL) is installed, if you used it before. Future functionality of CCL will be available in custom cargo too, which requires both mod packages in the same project.

After importing, open the Project Settings, then the Player tab. In the Other Settings dropdown, change the color space to Linear. Afterward, go to the XR Settings dropdown and set Virtual Reality Enabled to true, and Stereo Rendering Mode to Single Pass.

This will ensure your models will display correctly for both desktop and VR players, and fix odd colour space issues.

Creating cargo

Create a folder with the name of your cargo. Inside it, you can right click the Project view, and on the menu choose Create > DVCustomCargo > Custom Cargo. Name the asset as you wish.

A fully set up cargo example

example

Note

You can hover a field with your mouse to show a tooltip with what it does.

Warning

It is mandatory for the Identifier field to be unique. The mod will refuse to load any cargo that has the same ID as an existing one.

Stations

Source and destination stations use the IDs, not the full names. You can also use IDs of stations from custom maps. The cargo will ONLY be loaded if there's at least one source and one destination station available in the current map. [Future content] You can also define the source and destination stations of the cargo in Mapify maps directly, without specifing them here.

Vanilla station IDs
  • CME
  • CMS
  • CP
  • CS
  • CW
  • FF
  • FM
  • FRC
  • FRS
  • GF
  • HB
    • HMB
  • IME
  • IMW
  • MB
  • MF
    • MFMB
  • OR
  • OWC
  • OWN
  • SM
  • SW

From here, you can further specify and yard or a loading track, by writing the full identifier:

  • OWN - any machine in Oil Well North.
  • FM-A - any machine in the A yard of Farm.
  • HB-D7L - the machine for track D7L at Harbour.

Warning

Do not use the same station in both the source and output, or you may get freight hauls within the same station.

Cargo groups

Cargo groups are groups of cargo that can be loaded together. The editor will enforce a group for a cargo to have itself.

You do not need multiple groups for multiple combinations, a group with cargos A, B and C will create jobs in multiple ways: (A), (B), (C), (A B), (A C), (B C), and (A B C).

Tip

You can use the identifiers of other custom cargo mods or vanilla cargo in the groups. If those cargos aren't available (for example, you don't have one of the mods), the group will ignore the missing cargo.

Translations

Custom cargo supports translations in 2 ways:

  • Direct translation strings entered in the editor
  • Online CSV file

Important

CSV files use this template. Translations using these will update automatically as the file is updated.

Assigning models

When loading custom cargo onto vanilla wagons, it's possible to use custom models. You can create a model set asset manually using Create > DVCustomCargo > Model Collection or use the button at the bottom of the cargo inspector to automatically create and assing it. Pick a car type before clicking the button, of course. Colliders for the cargo work the same way as colliders in CCL, you can check the wiki article on that mod for more information (bogie collider is not required, of course).

When cargo is loaded, a random model will be picked from the list.

Tip

You can use some vanilla cargo prefabs if you don't want to create a new model. For that, assign an empty prefab to the model set, with a UseCargoPrefab script attached to the root. More info can be found on this page.

Tip

You can add the DummyCarModelDrawer component to any object to help line up your models. It can also check for collisions with colliders in your cargo. Results may not be accurate with mesh colliders.

Important

When including your own models, don't forget to set up the project for VR.

What about models for CCL wagons?

CCL support for custom cargo is coming in its next update. It can be setup like any other cargo directly on the car, models here are only for vanilla wagons.

Icons

You can assign an icon for the cargo in 2 ways: assign in directly to your cargo asset, or include a file named icon.png in the same folder as your cargo asset. This will automatically be assigned to the cargo and is the icon that shows up in the job papers when it is loaded onto a wagon.

Note

If there are no models for a car type, no icon will show up when that car type is loaded.

This is a template icon. Make sure you keep the image's size, or it will be stretched. Avoid exceeding the horizontal bounds to keep cargo within car limits, but vertically you can go outside the boundaries.

icon

Examples

Box loaded on top of a flatbed

example

Pink container

icon

Similarly, you can include a file named resource_icon.png, which is the industry icon for the cargo. The template is below.

resource_icon

Exporting

Once you have finished your cargo, just click the Export button. It will automatically zip your cargo into a mod that can be drag-and-dropped into UMM, or manually extracted to the mods folder.

Caution

The mod will be validated before exporting. If it fails, the button will change colour and the reason will be printed in the console. You can click Export again and force the mod to be exported, but it might yield unexpected results ingame so please fix any warnings.

Can I make a pack with multiple cargos?

Yes! Use Create > DVCustomCargo > Custom Cargo Pack, fill in the fields and add the cargos you have created to it. You do not need to worry about filling the mod info part of the cargo itself in this case, as it will use the info of the pack instead.

Each cargo is validated before export, and the same rules from above apply.

A cargo pack example

example