Script Dokumentation LS 2015 - FruitUtil (Patch 1.3)
- Funktionen
FruitUtil.registerFruitType
DescriptionAdds a new fruit type to the game. You first have to add new foliage layers to the map i3d which represent your foliage. There is a naming convention for the several layers. It automatically creates fill type as well. The created fill type can be access with FruitUtil.FRUITTYPE_<NameUpperCase>.
If the name is "wheat", the fruit type will be FruitUtil.FILLTYPE_WHEAT and the automatically created fill type will be Fillable.FILLTYPE_WHEAT.
You can convert between the fill type and the fruit type with:local fillType = FruitUtil.fruitTypeToFillType[fruitType] local fruitType = FruitUtil.fillTypeToFruitType[fillType]
Definition
function FruitUtil.registerFruitType(string name, string nameI18N, bool needsSeeding, bool allowsSeeding, bool useSeedingWidth, float directionSnapAngle, int minHarvestingGrowthState, int maxHarvestingGrowthState, int cutState, bool allowsPartialGrowthState, float pricePerLiter, float literPerSqm, float seedUsagePerSqm, bool partOfEconomy, string hudOverlayFilename, float4 fruitMapColor)
Arguments
string name The name of the fruit type. This also definies the name of the foliage layer in the map i3d string nameI18N Localized name of the fruit type used to display in the GUI bool needsSeeding Do we need to seed after we have cut the fruit? bool allowsSeeding Is it possible to seed this fruit type? bool useSeedingWidth If true, the seeding is using the wide mode, as used for the sugar beet float directionSnapAngle If not 0, this defines the angle snap size. E.g. for 90 degrees differences, use 0.5*math.pi int minHarvestingGrowthState The minimum growth state the fruit needs to have to be cut. int maxHarvestingGrowthState The maximum growth state the fruit needs to have to be cut. int cutState The state that represents the fruit after it is cut. bool allowsPartialGrowthState If true, the value of the fruit is scaled by fruit type. E.g. used for grass. float pricePerLiter Default price per liter of fruit when sold. float literPerQm Number of liters you get per qm. float seedUsagePerQm Number of liters of seed per qm you need when seeding. bool partOfEconomy If true, the price of the fruit will change based on the amount of fruit sold in the past. string hudOverlayFilename Filename of the overlay texture, displayed on the hud (trailer fill type, seed selection). Note: This must be absolute, or relative to the game.exe. Use Utils.getFilename if you want to use this for a file located in your mod. float4 fruitMapColor An array with 4 float to represent the r,g,b,a color of the fruit displayed in the overview map.
Examples
FruitUtil.registerFruitType("wheat", g_i18n:getText("wheat"), true, true, false, 0, 4, 6, 8, false, 0.29, 1.2, 0.1, true, "hud_fruit_wheat.png", {1, 1, 0, 1}); FruitUtil.registerFruitType("potato", g_i18n:getText("potato"), true, true, true, 0.5*math.pi, 9, 9, 8, false, 0.2, 4.0, 0.5, true, "hud_fruit_potato.png", {0.5, 0.25, 0.23, 1});
FruitUtil.registerFruitTypeWindrow
DescriptionAdds a windrow layer to the given fruit type.
Definition
function FruitUtil.registerFruitTypeWindrow(int fruitType, string windrowName, string windrowNameI18N, float windrowPricePerLiter, string windrowLiterPerSqm, bool windrowPartOfEconomy, string windrowHudOverlayFilename)
Arguments
int fruitType The fruit type to change. string windrowName Name of the windrow type. This also defines the name of the foliage layer in the map i3d string windrowNameI18N Localized name of the windrow type used to display in the GUI float windrowPricePerLiter Default price per liter of windrow type when sold. float windrowLiterPerSqm Number of liters you get per qm. bool windrowPartOfEconomy If true, the price of the windrow type will change based on the amount sold in the past. string windrowHudOverlayFilename Filename of the overlay texture, displayed on the hud (trailer fill type, seed selection). Note: This must be absolute, or relative to the game.exe. Use Utils.getFilename if you want to use this for a file located in your mod.
Example
FruitUtil.registerFruitTypeWindrow(FruitUtil.FRUITTYPE_WHEAT, "wheat_windrow", g_i18n:getText("straw"), 0.04, 3, false, "hud_fill_straw.png");
FruitUtil.registerFruitTypePreparing
DescriptionAdds a layer that is displayed after preparing a field for cutting (e.g. topping potatoes).
Definition
function FruitUtil.registerFruitTypePreparing(int fruitType, string preparingOutputName, int minPreparingGrowthState, int maxPreparingGrowthState, int preparedGrowthState)
Arguments
int fruitType The fruit type to change. string preparingOutputName Name of the preparing output type. This also defines the name of the foliage layer in the map i3d int minPreparingGrowthState The minimum growth state the fruit needs to have to be prepared. int maxPreparingGrowthState The maximum growth state the fruit needs to have to be prepared. int preparedGrowthState The state that represents the fruit after it is prepared.
Example
FruitUtil.registerFruitTypePreparing(FruitUtil.FRUITTYPE_POTATO, "potato_haulm", 5, 5, 9);