
Tutorial to integrate the FS 2011 DLC 3 into mods
Last changes to this article:
October 7, 2011
Changelog:
- Release (October 7, 2011)
This guide describes how mods can use some of the new functionality in the DLC 3 for Farming Simulator 2011.
Please post questions and feedback in this thread in the official LS support forum.
Create a water trailer
- Add the specializations 'Fillable' and 'pdlc_dlcPack3.waterTrailer' the vehicle type of your trailer
<vehicleTypes> <type name="waterTrailer" className="Vehicle" filename="$dataS/scripts/vehicles/Vehicle.lua"> <specialization name="attachable" /> <specialization name="fillable" /> <specialization name="pdlc_dlcPack3.waterTrailer" /> </type> </vehicleTypes> - Add 'water' to the fill types of the trailer. Sample vehicle xml:
<fillTypes fillTypes="water"/> - The filling speed can be controled with the xml node fillLitersPerSecond. Default 500
<fillLitersPerSecond>500</fillLitersPerSecond> - To apply new logic to the time when the water filling is toggeled, you can overwrite the function setIsWaterTankFilling. Further, the current filling state is stored as a boolean in the variable self.isWaterTankFilling.
function YourSpecialization:load(xmlFile) self.setIsWaterTankFilling = Utils.overwrittenFunction( self.setIsWaterTankFilling, YourSpecialization.setIsWaterTankFilling); end; function YourSpecialization:setIsWaterTankFilling(superFunc, isFilling, noEventSend) -- Do your logic here print("Cur filling: "..tostring(self.isWaterTankFilling)); print("New filling: "..tostring(isFilling)); -- also execute the original code superFunc(self, isFilling, noEventSend); end; - You don't necessarily need to use the DLC3 WaterTrailer specialization. Every vehicle with the specialization 'Fillable', with the fill type 'water' will be recognized by the greenhouses.
Direct planting
Direct planting allows a sowing machine to sow a field without cultivating or ploughing it first. Note that the AI helpers are only working correctly if the machine also has ridge markers added.
To use direct planting, you need to use the specialization 'sowingMachine' of the original game, and add the node useDirectPlanting with the value 'true' to the vehicle xml.
<useDirectPlanting>true</useDirectPlanting>
Ridge Marker
To use ridge markers, you need add the specialization 'pdlc_dlcPack3.ridgeMarker'. Then you need to add the appropriate nodes to the vehicle xml as shown in the example below.
<ridgeMarker animationLeftName="leftArm" animationRightName="rightArm" />
<ridgeMarkerLeftArea startIndex="0>11|3|1" widthIndex="0>11|3|2" heightIndex="0>11|3|3"/>
<ridgeMarkerRightArea startIndex="0>11|1|1" widthIndex="0>11|1|2" heightIndex="0>11|1|3"/>
<ridgeMarkerLeftTestArea startIndex="0>11|3|4" widthIndex="0>11|3|5" heightIndex="0>11|3|6"/>
<ridgeMarkerRightTestArea startIndex="0>11|1|4" widthIndex="0>11|1|5" heightIndex="0>11|1|6"/>
Vehicle type in modDesc.xml:
<type name="mySowingMachine" className="Vehicle" filename="$dataS/scripts/vehicles/Vehicle.lua">
<specialization name="attachable" />
<specialization name="fillable" />
<specialization name="sowingMachine" />
<specialization name="animatedVehicle" />
<specialization name="cylindered" />
<specialization name="foldable" />
<specialization name="pdlc_dlcPack3.ridgeMarker" />
</type>
- ridgeMarker.animationLeftName/animationRightName:
Name of the vehicle xml animations used to animate the left and right ridge markers. The time '0' of the animations represent the inactive state where whereas time '100%' represents the active state. - ridgeMarkerLeftArea/ridgeMarkerRightArea:
Parallelogram defining the area of the left/right ridge marker, where the ground is changed. - ridgeMarkerLeftTestArea/ridgeMarkerRightTestArea:
Parallelogram defining the area of the left/right ridge marker used to detect which ground changement should be done (change to cultivated if on ploughed, and vice versa). This area should be slightly in front of the changing area and should not be overlapping.