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
ExtendedMotorized
DescriptionSpecialization to track fuel usage when vehicle is on a fieldFunctions
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 ExtendedMotorized.prerequisitesPresent(specializations) |
20 | return SpecializationUtil.hasSpecialization(Motorized, specializations) and SpecializationUtil.hasSpecialization(PrecisionFarmingStatistic, specializations) |
21 | end |
updateConsumers
DescriptionDefinitionupdateConsumers()Code
46 | function ExtendedMotorized:updateConsumers(superFunc, dt, accInput) |
47 | superFunc(self, dt, accInput) |
48 | |
49 | local farmlandStatistics, isOnField, farmlandId = self:getPFStatisticInfo() |
50 | if farmlandStatistics ~= nil and farmlandId ~= nil and isOnField then |
51 | local spec = self.spec_motorized |
52 | for _,consumer in pairs(spec.consumers) do |
53 | if consumer.permanentConsumption and consumer.usage > 0 then |
54 | local fillUnit = self:getFillUnitByIndex(consumer.fillUnitIndex) |
55 | if fillUnit ~= nil and fillUnit.lastValidFillType == FillType.DIESEL then |
56 | farmlandStatistics:updateStatistic(farmlandId, "usedFuel", spec.lastFuelUsage / 60 / 60 / 1000 * dt) |
57 | end |
58 | end |
59 | end |
60 | end |
61 | |
62 | end |