How to Include Specializations in Your Farming Simulator Mod
You need some way to let GIANTS Engine and Farming Simulator know about your new and awesome mod. Of course, the way to do that is through the modDesc.xml file with something known as a specialization.
In Farming Simulator, a specialization is a specific functionality or feature that you’ve included in your tractor or other modified machinery. Default specializations include steerable, sprayer, or baler. For a more comprehensive list of default specializations, have a look at the Farming Simulator script documentation. Almost 90 different specializations are defined there.
A vehicle can actually have multiple specializations, such as having an attachable sprayer and being steerable. And, of course, you can also define your own specializations with a Lua script.
Adding specializations to your modDesc.xml is pretty simple. You only point to the external specialization scripts that you need. By convention, most modders add mark-up for specializations just before the storeItems tag.
To include one of the default specializations that ship with Farming Simulator, you need to first add a section in your modDesc.xml called vehicleTypes. Within the vehicleTypes section, you specify a type and its specialization. For example, say your mod has a steerable specialization. The code you add would look something like the following
<vehicleTypes> <type name="myMod" className="Vehicle" filename=$dataS/scripts/vehicles/Vehicle.lua"> <specialization name="steerable" /> </type> </vehicleTypes>
In this mark-up, the type tag takes up the most space. The following is a description of its attributes:
name: The name of your mod, or more specifically, the vehicle or machine in your mod.
className: This reflects the vehicle class that your mod belongs to. All of the default vehicles, for example, are in the Vehicle class. Writing your own class in Lua is possible but usually not necessary.
filename: This may look a touch odd to you. The fact that it starts with a dollar sign ($) means that this variable is internal to Farming Simulator. In the example, it points to the main Lua script that defines vehicles. Don’t go looking for that script on your hard drive, though. It’s archived within a file.
A specialization tag with a single attribute, name, is within the open and close type tags. This is the name of the default specialization you wish to include with your mod.
If you want to include multiple default specializations on your mod, you only need to include more specialization tags within the type section. However, you don’t need more than one type section unless your mod includes multiple machines or vehicles.