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
- 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
PrecisionFarmingStatistic
DescriptionSpecialization to save is on field state and current farmland id on a central spotFunctions
getPFStatisticInfo
DescriptionDefinitiongetPFStatisticInfo()Code
93 | function PrecisionFarmingStatistic:getPFStatisticInfo() |
94 | local spec = self.spec_precisionFarmingStatistic |
95 | return spec.farmlandStatistics, spec.isOnField, spec.farmlandId, spec.isOnFieldSmoothed, spec.mission |
96 | end |
getPFYieldMap
DescriptionDefinitiongetPFYieldMap()Code
100 | function PrecisionFarmingStatistic:getPFYieldMap() |
101 | local spec = self.spec_precisionFarmingStatistic |
102 | return spec.yieldMap |
103 | end |
onUpdateTick
DescriptionDefinitiononUpdateTick()Code
60 | function PrecisionFarmingStatistic:onUpdateTick(dt, isActive, isActiveForInput, isSelected) |
61 | local spec = self.spec_precisionFarmingStatistic |
62 | |
63 | spec.lastUpdateDistance = spec.lastUpdateDistance + self.lastMovedDistance |
64 | if spec.lastUpdateDistance > spec.updateDistance or spec.farmlandId == 0 then |
65 | spec.lastUpdateDistance = 0 |
66 | local x, _, z = getWorldTranslation(self.rootNode) |
67 | spec.farmlandId = g_farmlandManager:getFarmlandIdAtWorldPosition(x, z) |
68 | spec.mission = g_missionManager:getMissionAtWorldPosition(x, z) |
69 | |
70 | local isOnField = self:getIsOnField() |
71 | if isOnField ~= spec.isOnField then |
72 | if isOnField then |
73 | spec.isOnFieldSmoothed = true |
74 | else |
75 | spec.isOnFieldLastPos[1] = x |
76 | spec.isOnFieldLastPos[2] = z |
77 | end |
78 | end |
79 | |
80 | if spec.isOnFieldSmoothed ~= isOnField then |
81 | local distance = MathUtil.vector2Length(x - spec.isOnFieldLastPos[1], z - spec.isOnFieldLastPos[2]) |
82 | if distance > 20 then |
83 | spec.isOnFieldSmoothed = isOnField |
84 | end |
85 | end |
86 | |
87 | spec.isOnField = isOnField |
88 | end |
89 | end |
prerequisitesPresent
DescriptionChecks if all prerequisite specializations are loadedDefinition
prerequisitesPresent(table specializations)Arguments
table | specializations | specializations |
boolean | hasPrerequisite | true if all prerequisite specializations are loaded |
19 | function PrecisionFarmingStatistic.prerequisitesPresent(specializations) |
20 | return true |
21 | end |