Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- cancelStreamI3DFile
- clearEntireSharedI3DFileCache
- getAllSharedI3DFileRequestIds
- getAllStreamI3DFileRequestIds
- getNumOfSharedI3DFiles
- getSharedI3DFileProgressInfo
- getSharedI3DFileRefCount
- getStreamI3DFileProgressInfo
- loadI3DFile
- loadSharedI3DFile
- pinSharedI3DFileInCache
- releaseSharedI3DFile
- setStreamI3DFileDelay
- setStreamSharedI3DFileDelay
- streamI3DFile
- streamSharedI3DFile
- unpinSharedI3DFileInCache
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
FieldUtil
DescriptionUtil for field jobsFunctions
getFruitArea
DescriptionReturns amount of fruit to work is in given areaDefinition
getFruitArea(float startWorldX, float startWorldZ, float widthWorldX, float widthWorldZ, float heightWorldX, float heightWorldZ, table terrainDetailRequiredValueRanges, table terrainDetailProhibitValueRanges, integer requiredfruittype, integer requiredMinGrowthState, integer requiredMaxGrowthState, integer prohibitedFruitType, integer prohibitedMinGrowthState, integer prohibitedMaxGrowthState, boolean useWindrowed)Arguments
float | startWorldX | start world x |
float | startWorldZ | start world z |
float | widthWorldX | width world x |
float | widthWorldZ | width world z |
float | heightWorldX | height world x |
float | heightWorldZ | height world z |
table | terrainDetailRequiredValueRanges | terrain detail required value ranges |
table | terrainDetailProhibitValueRanges | terrain detail prohibit value ranges |
integer | requiredfruittype | required fruit type |
integer | requiredMinGrowthState | required min growth state |
integer | requiredMaxGrowthState | required max growth state |
integer | prohibitedFruitType | prohibited fruit type |
integer | prohibitedMinGrowthState | prohibited min growth state |
integer | prohibitedMaxGrowthState | prohibited max growth state |
boolean | useWindrowed | use windrow |
float | area | area found |
float | totalArea | total area checked |
379 | function FieldUtil.getFruitArea(startWorldX, startWorldZ, widthWorldX, widthWorldZ, heightWorldX, heightWorldZ, terrainDetailRequiredValueRanges, terrainDetailProhibitValueRanges, requiredFruitType, requiredMinGrowthState, requiredMaxGrowthState, prohibitedFruitType, prohibitedMinGrowthState, prohibitedMaxGrowthState, useWindrowed) |
380 | local query = g_currentMission.fieldCropsQuery |
381 | |
382 | local groundTypeMapId, groundTypeFirstChannel, groundTypeNumChannels = g_currentMission.fieldGroundSystem:getDensityMapData(FieldDensityMap.GROUND_TYPE) |
383 | |
384 | if requiredFruitType ~= FruitType.UNKNOWN then |
385 | local fruitTypeDesc = g_fruitTypeManager:getFruitTypeByIndex(requiredFruitType) |
386 | if fruitTypeDesc ~= nil and fruitTypeDesc.terrainDataPlaneId ~= nil then |
387 | if useWindrowed then |
388 | return 0, 1 |
389 | end |
390 | |
391 | query:addRequiredCropType(fruitTypeDesc.terrainDataPlaneId, requiredMinGrowthState, requiredMaxGrowthState, fruitTypeDesc.startStateChannel, fruitTypeDesc.numStateChannels, 0, 0)--groundTypeMapId, groundTypeFirstChannel, groundTypeNumChannels) -- needs engine fix so we can use different mapId |
392 | end |
393 | end |
394 | |
395 | if prohibitedFruitType ~= FruitType.UNKNOWN then |
396 | local fruitTypeDesc = g_fruitTypeManager:getFruitTypeByIndex(prohibitedFruitType) |
397 | if fruitTypeDesc ~= nil and fruitTypeDesc.terrainDataPlaneId ~= nil then |
398 | query:addProhibitedCropType(fruitTypeDesc.terrainDataPlaneId, prohibitedMinGrowthState, prohibitedMaxGrowthState, fruitTypeDesc.startStateChannel, fruitTypeDesc.numStateChannels, groundTypeFirstChannel, groundTypeNumChannels) |
399 | end |
400 | end |
401 | |
402 | for _,valueRange in pairs(terrainDetailRequiredValueRanges) do |
403 | query:addRequiredGroundValue(valueRange[1], valueRange[2], valueRange[3], valueRange[4]) |
404 | end |
405 | for _,valueRange in pairs(terrainDetailProhibitValueRanges) do |
406 | query:addProhibitedGroundValue(valueRange[1], valueRange[2], valueRange[3], valueRange[4]) |
407 | end |
408 | |
409 | local x,z, widthX,widthZ, heightX,heightZ = MathUtil.getXZWidthAndHeight(startWorldX, startWorldZ, widthWorldX, widthWorldZ, heightWorldX, heightWorldZ) |
410 | return query:getParallelogram(x,z, widthX,widthZ, heightX,heightZ, true) |
411 | end |