Sprache Deutsch Language English

Menu:



Letzte Änderung:
12. Februar 2016


Script Dokumentation LS 2015 - FruitUtil (Patch 1.3)

Script Dokumentation Übersicht
  1. Funktionen
    1. FruitUtil.registerFruitType(..)
    2. FruitUtil.registerFruitTypeWindrow(..)
    3. FruitUtil.registerFruitTypePreparing(..)

FruitUtil.registerFruitType

Description
Adds 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
stringnameThe name of the fruit type. This also definies the name of the foliage layer in the map i3d
stringnameI18NLocalized name of the fruit type used to display in the GUI
boolneedsSeedingDo we need to seed after we have cut the fruit?
boolallowsSeedingIs it possible to seed this fruit type?
booluseSeedingWidthIf true, the seeding is using the wide mode, as used for the sugar beet
floatdirectionSnapAngleIf not 0, this defines the angle snap size. E.g. for 90 degrees differences, use 0.5*math.pi
intminHarvestingGrowthStateThe minimum growth state the fruit needs to have to be cut.
intmaxHarvestingGrowthStateThe maximum growth state the fruit needs to have to be cut.
intcutStateThe state that represents the fruit after it is cut.
boolallowsPartialGrowthStateIf true, the value of the fruit is scaled by fruit type. E.g. used for grass.
floatpricePerLiterDefault price per liter of fruit when sold.
floatliterPerQmNumber of liters you get per qm.
floatseedUsagePerQmNumber of liters of seed per qm you need when seeding.
boolpartOfEconomyIf true, the price of the fruit will change based on the amount of fruit sold in the past.
stringhudOverlayFilenameFilename 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.
float4fruitMapColorAn 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

Description
Adds 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
intfruitTypeThe fruit type to change.
stringwindrowNameName of the windrow type. This also defines the name of the foliage layer in the map i3d
stringwindrowNameI18NLocalized name of the windrow type used to display in the GUI
floatwindrowPricePerLiterDefault price per liter of windrow type when sold.
floatwindrowLiterPerSqmNumber of liters you get per qm.
boolwindrowPartOfEconomyIf true, the price of the windrow type will change based on the amount sold in the past.
stringwindrowHudOverlayFilenameFilename 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

Description
Adds 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
intfruitTypeThe fruit type to change.
stringpreparingOutputNameName of the preparing output type. This also defines the name of the foliage layer in the map i3d
intminPreparingGrowthStateThe minimum growth state the fruit needs to have to be prepared.
intmaxPreparingGrowthStateThe maximum growth state the fruit needs to have to be prepared.
intpreparedGrowthStateThe state that represents the fruit after it is prepared.

Example
FruitUtil.registerFruitTypePreparing(FruitUtil.FRUITTYPE_POTATO,
  "potato_haulm", 5, 5, 9);




Script Dokumentation Übersicht