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
- AIConveyorBelt
- AIDrivable
- AIFieldWorker
- AIImplement
- AIJobVehicle
- AIVehicle
- AIVehicleObstacle
- AnimatedVehicle
- ArticulatedAxis
- Attachable
- AttacherJointControl
- AttacherJoints
- AutoLoader
- BaleGrab
- BaleLoader
- Baler
- BaleWrapper
- BaseMaterial
- BigBag
- BunkerSiloCompacter
- BunkerSiloInteractor
- CCTDrivable
- Combine
- ConnectionHoses
- ConveyorBelt
- Cover
- CrabSteering
- Crawlers
- CropSensor
- Cultivator
- Cutter
- Cylindered
- CylinderedFoldable
- Dashboard
- Dischargeable
- Drivable
- DynamicallyLoadedParts
- DynamicMountAttacher
- Enterable
- ExtendedAIVehicle
- ExtendedCombine
- ExtendedMotorized
- ExtendedMower
- ExtendedSowingMachine
- ExtendedSprayer
- ExtendedWearable
- FertilizingCultivator
- FertilizingSowingMachine
- FillTriggerVehicle
- FillUnit
- FillVolume
- Foldable
- FoliageBending
- ForageWagon
- FrontloaderAttacher
- FruitPreparer
- GroundAdjustedNodes
- GroundReference
- HeadlandAnimation
- Honk
- HookLiftContainer
- HookLiftTrailer
- IKChains
- InlineWrapper
- JigglingParts
- Leveler
- LicensePlates
- Lights
- LivestockTrailer
- Locomotive
- LogGrab
- ManureBarrel
- ManureSensor
- MixerWagon
- Motorized
- Mountable
- Mower
- Mulcher
- MultipleItemPurchase
- Pallet
- Pickup
- Pipe
- PlaceableAI
- PlaceableAnimatedObjects
- PlaceableBeehive
- PlaceableBeehivePalletSpa...
- PlaceableBunkerSilo
- PlaceableBuyingStation
- PlaceableCartridgePlayer
- PlaceableChargingStation
- PlaceableClearAreas
- PlaceableColorable
- PlaceableDeletedNodes
- PlaceableDoghouse
- PlaceableDynamicallyLoade...
- PlaceableFarmhouse
- PlaceableFence
- PlaceableFoliageAreas
- PlaceableGreenhouse
- PlaceableHighPressureWash...
- PlaceableHotspots
- PlaceableHusbandry
- PlaceableHusbandryAnimals
- PlaceableHusbandryFeeding...
- PlaceableHusbandryFence
- PlaceableHusbandryFood
- PlaceableHusbandryLiquidM...
- PlaceableHusbandryMilk
- PlaceableHusbandryPallets
- PlaceableHusbandryStraw
- PlaceableHusbandryWater
- PlaceableIncomePerHour
- PlaceableIndoorAreas
- PlaceableInfoTrigger
- PlaceableLeveling
- PlaceableLights
- PlaceableManureHeap
- PlaceablePlacement
- PlaceableProductionPoint
- PlaceableSellingStation
- PlaceableSilo
- PlaceableSiloExtension
- PlaceableSolarPanels
- PlaceableTipOcclusionArea...
- PlaceableTrainSystem
- PlaceableTriggerMarkers
- PlaceableVine
- PlaceableWardrobe
- PlaceableWeatherStation
- PlaceableWeighingStation
- PlaceableWindTurbine
- PlaceableWorkshop
- Plow
- PlowPacker
- PowerConsumer
- PowerTakeOffs
- PrecisionFarmingStatistic
- PushHandTool
- RandomlyMovingParts
- ReceivingHopper
- ReverseDriving
- Rideable
- RidgeMarker
- Roller
- Ropes
- RTKStation
- SaltSpreader
- SemiTrailerFront
- Shovel
- SlopeCompensation
- SmartAttach
- SoilSampler
- SowingMachine
- SpeedRotatingParts
- SplineVehicle
- Sprayer
- StonePicker
- StrawBlower
- StumpCutter
- SupportVehicle
- Suspensions
- Tedder
- TensionBeltObject
- TensionBelts
- TestAreas
- TipOccluder
- Trailer
- TreePlanter
- TreeSaplingPallet
- TreeSaw
- TurnOnVehicle
- VariableWorkWidth
- VehicleSettings
- VineCutter
- VineDetector
- VinePrepruner
- Washable
- WaterTrailer
- Wearable
- Weeder
- WeedSpotSpray
- Wheels
- WindBending
- Windrower
- Wipers
- WoodCrusher
- WoodHarvester
- WorkArea
- WorkMode
- WorkParticles
- 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
PlaceableHusbandryPallets
DescriptionSpecialization for placeablesFunctions
- getAllPalletsCallback
- getConditionInfos
- getPalletCallback
- loadFromXMLFile
- onDelete
- onFinalizePlacement
- onHusbandryAnimalsCreated
- onHusbandryAnimalsUpdate
- onLoad
- onPalletTriggerCallback
- onReadStream
- onReadUpdateStream
- onWriteStream
- onWriteUpdateStream
- prerequisitesPresent
- registerEventListeners
- registerFunctions
- registerOverwrittenFunctions
- registerSavegameXMLPaths
- registerXMLPaths
- saveToXMLFile
- showPalletBlockedWarning
- showSpawnerBlockedWarning
- updateInfo
- updateOutput
- updatePalletInfo
- updatePallets
getAllPalletsCallback
DescriptionDefinitiongetAllPalletsCallback()Code
279 | function PlaceableHusbandryPallets:getAllPalletsCallback(pallets) |
280 | local spec = self.spec_husbandryPallets |
281 | local fillLevel = 0 |
282 | local capacity = 0 |
283 | local maxCapacity = 0 |
284 | spec.isPalletInfoUpdateRunning = false |
285 | |
286 | for _, pallet in pairs(pallets) do |
287 | local palletCapacity = pallet:getFillUnitCapacity(spec.fillUnitIndex) |
288 | capacity = capacity + palletCapacity |
289 | maxCapacity = math.max(maxCapacity, palletCapacity) |
290 | fillLevel = fillLevel + pallet:getFillUnitFillLevel(spec.fillUnitIndex) |
291 | end |
292 | |
293 | if #pallets < spec.maxNumPallets then |
294 | capacity = maxCapacity * spec.maxNumPallets |
295 | end |
296 | |
297 | spec.fillLevel = fillLevel |
298 | spec.capacity = capacity |
299 | |
300 | if math.abs(fillLevel - spec.fillLevelSent) > 1 or math.abs(capacity - spec.capacitySent) > 1 then |
301 | spec.fillLevelSent = fillLevel |
302 | spec.capacitySent = capacity |
303 | self:raiseDirtyFlags(spec.dirtyFlag) |
304 | end |
305 | end |
getConditionInfos
DescriptionDefinitiongetConditionInfos()Code
396 | function PlaceableHusbandryPallets:getConditionInfos(superFunc) |
397 | local infos = superFunc(self) |
398 | |
399 | local spec = self.spec_husbandryPallets |
400 | local info = {} |
401 | local fillType = g_fillTypeManager:getFillTypeByIndex(spec.fillTypeIndex) |
402 | info.title = fillType.title |
403 | info.value = spec.fillLevel |
404 | |
405 | local ratio = 0 |
406 | if spec.capacity > 0 then |
407 | ratio = spec.fillLevel / spec.capacity |
408 | end |
409 | |
410 | info.ratio = MathUtil.clamp(ratio, 0, 1) |
411 | info.invertedBar = true |
412 | info.customUnitText = spec.fillTypeUnit |
413 | |
414 | table.insert(infos, info) |
415 | |
416 | return infos |
417 | end |
getPalletCallback
DescriptionDefinitiongetPalletCallback()Code
321 | function PlaceableHusbandryPallets:getPalletCallback(pallet, result, fillTypeIndex) |
322 | local spec = self.spec_husbandryPallets |
323 | spec.spawnPending = false |
324 | spec.currentPallet = pallet |
325 | |
326 | if pallet ~= nil then |
327 | if spec.palletLimitReached then |
328 | spec.palletLimitReached = false |
329 | self:raiseDirtyFlags(spec.dirtyFlag) |
330 | end |
331 | |
332 | if result == PalletSpawner.RESULT_SUCCESS then |
333 | pallet:emptyAllFillUnits(true) |
334 | end |
335 | |
336 | spec.pallets[pallet] = true |
337 | local delta = pallet:addFillUnitFillLevel(self:getOwnerFarmId(), spec.fillUnitIndex, spec.pendingLiters, fillTypeIndex, ToolType.UNDEFINED) |
338 | |
339 | spec.pendingLiters = math.max(spec.pendingLiters - delta, 0) |
340 | |
341 | if spec.pendingLiters > 5 then |
342 | self:updatePallets() |
343 | end |
344 | elseif result == PalletSpawner.RESULT_NO_SPACE then |
345 | self:showSpawnerBlockedWarning() |
346 | elseif result == PalletSpawner.PALLET_LIMITED_REACHED then |
347 | if not spec.palletLimitReached then |
348 | spec.palletLimitReached = true |
349 | self:raiseDirtyFlags(spec.dirtyFlag) |
350 | end |
351 | end |
352 | |
353 | self:updatePalletInfo() |
354 | end |
loadFromXMLFile
DescriptionDefinitionloadFromXMLFile()Code
199 | function PlaceableHusbandryPallets:loadFromXMLFile(xmlFile, key) |
200 | local spec = self.spec_husbandryPallets |
201 | self.pendingLiters = xmlFile:getValue(key.."#pendingLiters", spec.pendingLiters) |
202 | |
203 | self:updatePalletInfo() |
204 | end |
onDelete
DescriptionDefinitiononDelete()Code
129 | function PlaceableHusbandryPallets:onDelete() |
130 | local spec = self.spec_husbandryPallets |
131 | if self.isServer and spec.palletTriggers ~= nil then |
132 | for _, trigger in ipairs(spec.palletTriggers) do |
133 | if trigger.added then |
134 | removeTrigger(trigger.node) |
135 | end |
136 | end |
137 | end |
138 | end |
onFinalizePlacement
DescriptionDefinitiononFinalizePlacement()Code
142 | function PlaceableHusbandryPallets:onFinalizePlacement() |
143 | local spec = self.spec_husbandryPallets |
144 | |
145 | if self.isServer then |
146 | for _, trigger in ipairs(spec.palletTriggers) do |
147 | addTrigger(trigger.node, "onPalletTriggerCallback", self) |
148 | trigger.added = true |
149 | end |
150 | end |
151 | end |
onHusbandryAnimalsCreated
DescriptionDefinitiononHusbandryAnimalsCreated()Code
215 | function PlaceableHusbandryPallets:onHusbandryAnimalsCreated(husbandry) |
216 | if husbandry ~= nil then |
217 | local animalTypeIndex = self:getAnimalTypeIndex() |
218 | local animalType = g_currentMission.animalSystem:getTypeByIndex(animalTypeIndex) |
219 | if animalType ~= nil then |
220 | local spec = self.spec_husbandryPallets |
221 | local l10nText = "ui_statisticView_" .. tostring(animalType.name):lower() |
222 | spec.animalTypeName = g_i18n:getText(l10nText, self.customEnvironment) |
223 | end |
224 | end |
225 | end |
onHusbandryAnimalsUpdate
DescriptionDefinitiononHusbandryAnimalsUpdate()Code
229 | function PlaceableHusbandryPallets:onHusbandryAnimalsUpdate(clusters) |
230 | local spec = self.spec_husbandryPallets |
231 | |
232 | spec.litersPerHour = 0 |
233 | for _, cluster in ipairs(clusters) do |
234 | local subType = g_currentMission.animalSystem:getSubTypeByIndex(cluster.subTypeIndex) |
235 | if subType ~= nil then |
236 | local pallets = subType.output.pallets |
237 | if pallets ~= nil then |
238 | local age = cluster:getAge() |
239 | local litersPerAnimal = pallets:get(age) |
240 | local litersPerDay = litersPerAnimal * cluster:getNumAnimals() |
241 | |
242 | spec.litersPerHour = spec.litersPerHour + (litersPerDay / 24) |
243 | end |
244 | end |
245 | end |
246 | end |
onLoad
DescriptionDefinitiononLoad()Code
80 | function PlaceableHusbandryPallets:onLoad(savegame) |
81 | local spec = self.spec_husbandryPallets |
82 | |
83 | spec.palletSpawner = PalletSpawner.new(self.baseDirectory) |
84 | spec.palletSpawner:load(self.components, self.xmlFile, "placeable.husbandry.pallets", self.customEnvironment, self.i3dMappings) |
85 | |
86 | local fillTypeName = self.xmlFile:getValue("placeable.husbandry.pallets#fillType") |
87 | local fillTypeIndex = g_fillTypeManager:getFillTypeIndexByName(fillTypeName) |
88 | if fillTypeIndex == nil then |
89 | Logging.xmlError(self.xmlFile, "Pallet filltype '%s' not defined", fillTypeName) |
90 | self:setLoadingState(Placeable.LOADING_STATE_ERROR) |
91 | return |
92 | end |
93 | spec.fillTypeIndex = fillTypeIndex |
94 | spec.fillUnitIndex = 1 |
95 | spec.fillTypeUnit = g_i18n:convertText(self.xmlFile:getValue("placeable.husbandry.pallets#unitText") or "$l10n_unit_literShort", self.customEnvironment) |
96 | |
97 | spec.maxNumPallets = self.xmlFile:getValue("placeable.husbandry.pallets#maxNumPallets", 1) |
98 | |
99 | if self.isServer then |
100 | spec.palletTriggers = {} |
101 | self.xmlFile:iterate("placeable.husbandry.pallets.palletTrigger", function(_, key) |
102 | local node = self.xmlFile:getValue(key .. "#node", nil, self.components, self.i3dMappings) |
103 | if node ~= nil then |
104 | table.insert(spec.palletTriggers, {node=node, added=false}) |
105 | end |
106 | end) |
107 | end |
108 | |
109 | spec.isPalletInfoUpdateRunning = false |
110 | spec.animalTypeName = nil |
111 | spec.currentPallet = nil |
112 | spec.pendingLiters = 0 |
113 | spec.fillLevel = 0 |
114 | spec.fillLevelSent = 0 |
115 | spec.capacity = 0 |
116 | spec.capacitySent = 0 |
117 | spec.litersPerHour = 0 |
118 | spec.fillType = nil |
119 | spec.pallets = {} |
120 | spec.spawnPending = false |
121 | spec.palletLimitReached = false |
122 | spec.infoHudTooManyPallets = {title=g_i18n:getText("infohud_tooManyPallets"), accentuate=true} |
123 | |
124 | spec.dirtyFlag = self:getNextDirtyFlag() |
125 | end |
onPalletTriggerCallback
DescriptionDefinitiononPalletTriggerCallback()Code
250 | function PlaceableHusbandryPallets:onPalletTriggerCallback(triggerId, otherId, onEnter, onLeave, onStay) |
251 | if onLeave then |
252 | local spec = self.spec_husbandryPallets |
253 | local object = g_currentMission:getNodeObject(otherId) |
254 | if object ~= nil then |
255 | if object == spec.currentPallet then |
256 | spec.currentPallet = nil |
257 | end |
258 | |
259 | spec.pallets[object] = nil |
260 | self:updatePalletInfo() |
261 | end |
262 | end |
263 | end |
onReadStream
DescriptionDefinitiononReadStream()Code
155 | function PlaceableHusbandryPallets:onReadStream(streamId, connection) |
156 | local spec = self.spec_husbandryPallets |
157 | spec.fillLevel = streamReadFloat32(streamId) |
158 | spec.capacity = streamReadFloat32(streamId) |
159 | spec.palletLimitReached = streamReadBool(streamId) |
160 | end |
onReadUpdateStream
DescriptionDefinitiononReadUpdateStream()Code
173 | function PlaceableHusbandryPallets:onReadUpdateStream(streamId, timestamp, connection) |
174 | if connection:getIsServer() then |
175 | if streamReadBool(streamId) then |
176 | local spec = self.spec_husbandryPallets |
177 | spec.fillLevel = streamReadFloat32(streamId) |
178 | spec.capacity = streamReadFloat32(streamId) |
179 | spec.palletLimitReached = streamReadBool(streamId) |
180 | end |
181 | end |
182 | end |
onWriteStream
DescriptionDefinitiononWriteStream()Code
164 | function PlaceableHusbandryPallets:onWriteStream(streamId, connection) |
165 | local spec = self.spec_husbandryPallets |
166 | streamWriteFloat32(streamId, spec.fillLevelSent) |
167 | streamWriteFloat32(streamId, spec.capacitySent) |
168 | streamWriteBool(streamId, spec.palletLimitReached) |
169 | end |
onWriteUpdateStream
DescriptionDefinitiononWriteUpdateStream()Code
186 | function PlaceableHusbandryPallets:onWriteUpdateStream(streamId, connection, dirtyMask) |
187 | if not connection:getIsServer() then |
188 | local spec = self.spec_husbandryPallets |
189 | if streamWriteBool(streamId, bitAND(dirtyMask, spec.dirtyFlag) ~= 0) then |
190 | streamWriteFloat32(streamId, spec.fillLevelSent) |
191 | streamWriteFloat32(streamId, spec.capacitySent) |
192 | streamWriteBool(streamId, spec.palletLimitReached) |
193 | end |
194 | end |
195 | 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 |
18 | function PlaceableHusbandryPallets.prerequisitesPresent(specializations) |
19 | return true |
20 | end |
registerEventListeners
DescriptionDefinitionregisterEventListeners()Code
44 | function PlaceableHusbandryPallets.registerEventListeners(placeableType) |
45 | SpecializationUtil.registerEventListener(placeableType, "onLoad", PlaceableHusbandryPallets) |
46 | SpecializationUtil.registerEventListener(placeableType, "onDelete", PlaceableHusbandryPallets) |
47 | SpecializationUtil.registerEventListener(placeableType, "onFinalizePlacement", PlaceableHusbandryPallets) |
48 | SpecializationUtil.registerEventListener(placeableType, "onReadStream", PlaceableHusbandryPallets) |
49 | SpecializationUtil.registerEventListener(placeableType, "onWriteStream", PlaceableHusbandryPallets) |
50 | SpecializationUtil.registerEventListener(placeableType, "onReadUpdateStream", PlaceableHusbandryPallets) |
51 | SpecializationUtil.registerEventListener(placeableType, "onWriteUpdateStream", PlaceableHusbandryPallets) |
52 | SpecializationUtil.registerEventListener(placeableType, "onHusbandryAnimalsUpdate", PlaceableHusbandryPallets) |
53 | SpecializationUtil.registerEventListener(placeableType, "onHusbandryAnimalsCreated", PlaceableHusbandryPallets) |
54 | end |
registerFunctions
DescriptionDefinitionregisterFunctions()Code
24 | function PlaceableHusbandryPallets.registerFunctions(placeableType) |
25 | SpecializationUtil.registerFunction(placeableType, "onPalletTriggerCallback", PlaceableHusbandryPallets.onPalletTriggerCallback) |
26 | SpecializationUtil.registerFunction(placeableType, "getAllPalletsCallback", PlaceableHusbandryPallets.getAllPalletsCallback) |
27 | SpecializationUtil.registerFunction(placeableType, "updatePallets", PlaceableHusbandryPallets.updatePallets) |
28 | SpecializationUtil.registerFunction(placeableType, "getPalletCallback", PlaceableHusbandryPallets.getPalletCallback) |
29 | SpecializationUtil.registerFunction(placeableType, "showSpawnerBlockedWarning", PlaceableHusbandryPallets.showSpawnerBlockedWarning) |
30 | SpecializationUtil.registerFunction(placeableType, "showPalletBlockedWarning", PlaceableHusbandryPallets.showPalletBlockedWarning) |
31 | SpecializationUtil.registerFunction(placeableType, "updatePalletInfo", PlaceableHusbandryPallets.updatePalletInfo) |
32 | end |
registerOverwrittenFunctions
DescriptionDefinitionregisterOverwrittenFunctions()Code
36 | function PlaceableHusbandryPallets.registerOverwrittenFunctions(placeableType) |
37 | SpecializationUtil.registerOverwrittenFunction(placeableType, "getConditionInfos", PlaceableHusbandryPallets.getConditionInfos) |
38 | SpecializationUtil.registerOverwrittenFunction(placeableType, "updateOutput", PlaceableHusbandryPallets.updateOutput) |
39 | SpecializationUtil.registerOverwrittenFunction(placeableType, "updateInfo", PlaceableHusbandryPallets.updateInfo) |
40 | end |
registerSavegameXMLPaths
DescriptionDefinitionregisterSavegameXMLPaths()Code
71 | function PlaceableHusbandryPallets.registerSavegameXMLPaths(schema, basePath) |
72 | schema:setXMLSpecializationType("Husbandry") |
73 | schema:register(XMLValueType.FLOAT, basePath .. "#pendingLiters", "Pending liters") |
74 | schema:register(XMLValueType.FLOAT, basePath .. "#fillLevel", "Fill Level") |
75 | schema:setXMLSpecializationType() |
76 | end |
registerXMLPaths
DescriptionDefinitionregisterXMLPaths()Code
58 | function PlaceableHusbandryPallets.registerXMLPaths(schema, basePath) |
59 | schema:setXMLSpecializationType("Husbandry") |
60 | basePath = basePath .. ".husbandry.pallets" |
61 | schema:register(XMLValueType.NODE_INDEX, basePath .. ".palletTrigger(?)#node", "A pallet trigger") |
62 | schema:register(XMLValueType.STRING, basePath .. "#fillType", "Pallet fill type") |
63 | schema:register(XMLValueType.STRING, basePath .. "#unitText", "Pallet fill type unit") |
64 | schema:register(XMLValueType.INT, basePath .. "#maxNumPallets", "Maximum number of pallets") |
65 | PalletSpawner.registerXMLPaths(schema, basePath) |
66 | schema:setXMLSpecializationType() |
67 | end |
saveToXMLFile
DescriptionDefinitionsaveToXMLFile()Code
208 | function PlaceableHusbandryPallets:saveToXMLFile(xmlFile, key, usedModNames) |
209 | local spec = self.spec_husbandryPallets |
210 | xmlFile:setValue(key.."#pendingLiters", spec.pendingLiters) |
211 | end |
showPalletBlockedWarning
DescriptionDefinitionshowPalletBlockedWarning()Code
373 | function PlaceableHusbandryPallets:showPalletBlockedWarning() |
374 | local spec = self.spec_husbandryPallets |
375 | if self.isClient and g_currentMission:getFarmId() == self:getOwnerFarmId() then |
376 | local fillType = g_fillTypeManager:getFillTypeByIndex(spec.fillTypeIndex) |
377 | if fillType ~= nil and spec.animalTypeName ~= nil then |
378 | local text = string.format(g_i18n:getText("ingameNotification_palletSpawnerBlocked"), fillType.title, spec.animalTypeName) |
379 | g_currentMission:addIngameNotification(FSBaseMission.INGAME_NOTIFICATION_CRITICAL, text) |
380 | end |
381 | end |
382 | end |
showSpawnerBlockedWarning
DescriptionDefinitionshowSpawnerBlockedWarning()Code
358 | function PlaceableHusbandryPallets:showSpawnerBlockedWarning() |
359 | local spec = self.spec_husbandryPallets |
360 | if not spec.showedWarning then |
361 | if self.isServer then |
362 | g_currentMission:broadcastEventToFarm(AnimalHusbandryNoMorePalletSpaceEvent.new(self), self:getOwnerFarmId(), false) |
363 | end |
364 | |
365 | self:showPalletBlockedWarning() |
366 | |
367 | spec.showedWarning = true |
368 | end |
369 | end |
updateInfo
DescriptionDefinitionupdateInfo()Code
386 | function PlaceableHusbandryPallets:updateInfo(superFunc, infoTable) |
387 | superFunc(self, infoTable) |
388 | local spec = self.spec_husbandryPallets |
389 | if spec.palletLimitReached then |
390 | table.insert(infoTable, spec.infoHudTooManyPallets) |
391 | end |
392 | end |
updateOutput
DescriptionDefinitionupdateOutput()Code
421 | function PlaceableHusbandryPallets:updateOutput(superFunc, foodFactor, productionFactor, globalProductionFactor) |
422 | superFunc(self, foodFactor, productionFactor, globalProductionFactor) |
423 | |
424 | local spec = self.spec_husbandryPallets |
425 | spec.showedWarning = false |
426 | |
427 | if self.isServer and spec.litersPerHour > 0 then |
428 | spec.pendingLiters = spec.pendingLiters + productionFactor * globalProductionFactor * spec.litersPerHour * g_currentMission.environment.timeAdjustment |
429 | self:updatePallets() |
430 | end |
431 | end |
updatePalletInfo
DescriptionDefinitionupdatePalletInfo()Code
267 | function PlaceableHusbandryPallets:updatePalletInfo() |
268 | if self.isServer then |
269 | local spec = self.spec_husbandryPallets |
270 | if not spec.isPalletInfoUpdateRunning then |
271 | spec.isPalletInfoUpdateRunning = true |
272 | spec.palletSpawner:getAllPallets(spec.fillTypeIndex, self.getAllPalletsCallback, self) |
273 | end |
274 | end |
275 | end |
updatePallets
DescriptionDefinitionupdatePallets()Code
309 | function PlaceableHusbandryPallets:updatePallets() |
310 | if self.isServer then |
311 | local spec = self.spec_husbandryPallets |
312 | if not spec.spawnPending and spec.pendingLiters > 5 then |
313 | spec.spawnPending = true |
314 | spec.palletSpawner:getOrSpawnPallet(self:getOwnerFarmId(), spec.fillTypeIndex, self.getPalletCallback, self) |
315 | end |
316 | end |
317 | end |