LUADOC - Farming Simulator 22

SellingStation

Parent
UnloadingStation
Functions

getSpecValueFillTypes

Description
Definition
getSpecValueFillTypes()
Code
708function SellingStation.getSpecValueFillTypes(storeItem, realItem)
709 if storeItem.specs.sellingStationFillTypes == nil then
710 return nil
711 end
712
713 return g_fillTypeManager:getFillTypesByNames(table.concatKeys(storeItem.specs.sellingStationFillTypes, " "))
714end

loadFromXMLFile

Description
Loading from attributes and nodes
Definition
loadFromXMLFile(integer xmlFile, string key)
Arguments
integerxmlFileid of xml object
stringkeykey
Return Values
booleansuccesssuccess
Code
304function SellingStation:loadFromXMLFile(xmlFile, key)
305 local i=0
306 while true do
307 local statsKey = string.format(key..".stats(%d)", i)
308 if not xmlFile:hasProperty(statsKey) then
309 break
310 end
311 local fillTypeStr = xmlFile:getValue(statsKey.."#fillType")
312 local fillType = g_fillTypeManager:getFillTypeIndexByName(fillTypeStr)
313 if fillType ~= nil and self.acceptedFillTypes[fillType] then
314 self.totalReceived[fillType] = xmlFile:getValue(statsKey.."#received", 0)
315 self.totalPaid[fillType] = xmlFile:getValue(statsKey.."#paid", 0)
316 self.pricingDynamics[fillType]:loadFromXMLFile(xmlFile, statsKey)
317 end
318 i = i + 1
319 end
320
321 return true
322end

loadSpecValueFillTypes

Description
Definition
loadSpecValueFillTypes()
Code
683function SellingStation.loadSpecValueFillTypes(xmlFile, customEnvironment, baseDir)
684 local fillTypeNames
685 local fillTypesNamesString = xmlFile:getValue("placeable.sellingStation#fillTypes")
686
687 if fillTypesNamesString ~= nil and fillTypesNamesString:trim() ~= "" then
688 fillTypeNames = {}
689 for _, fillTypeName in pairs(string.split(fillTypesNamesString, " ")) do
690 fillTypeNames[fillTypeName] = true
691 end
692 end
693 xmlFile:iterate("placeable.sellingStation.unloadTrigger", function(_, unloadTriggerKey)
694 local fillTypeNamesString = xmlFile:getValue(unloadTriggerKey .. "#fillTypes")
695 if fillTypeNamesString ~= nil and fillTypeNamesString:trim() ~= "" then
696 fillTypeNames = fillTypeNames or {}
697 for _, fillTypeName in pairs(string.split(fillTypeNamesString, " ")) do
698 fillTypeNames[fillTypeName] = true
699 end
700 end
701 end)
702
703 return fillTypeNames
704end

registerSavegameXMLPaths

Description
Definition
registerSavegameXMLPaths()
Code
673function SellingStation.registerSavegameXMLPaths(schema, basePath)
674 schema:register(XMLValueType.STRING, basePath .. ".stats(?)#fillType", "Fill type")
675 schema:register(XMLValueType.FLOAT, basePath .. ".stats(?)#received", "Recieved fill level", 0)
676 schema:register(XMLValueType.FLOAT, basePath .. ".stats(?)#paid", "Payed fill level", 0)
677
678 PricingDynamics.registerSavegameXMLPaths(schema, basePath .. ".stats(?)")
679end

registerXMLPaths

Description
Definition
registerXMLPaths()
Code
653function SellingStation.registerXMLPaths(schema, basePath)
654 schema:register(XMLValueType.BOOL, basePath .. "#appearsOnStats", "Appears on Stats", false)
655 schema:register(XMLValueType.BOOL, basePath .. "#suppressWarnings", "Suppress warnings", false)
656 schema:register(XMLValueType.BOOL, basePath .. "#allowMissions", "Allow missions", true)
657 schema:register(XMLValueType.BOOL, basePath .. "#hasDynamic", "Has dynamic prices", true)
658 schema:register(XMLValueType.INT, basePath .. "#litersForFullPriceDrop", "Liters for full price drop")
659 schema:register(XMLValueType.FLOAT, basePath .. "#fullPriceRecoverHours", "Full price recover ingame hours")
660 schema:register(XMLValueType.STRING, basePath .. "#fillTypeCategories", "Supported filltypes if no unloadtriggers defined")
661 schema:register(XMLValueType.STRING, basePath .. "#fillTypes", "Supported filltypes if no unloadtriggers defined")
662
663 schema:register(XMLValueType.STRING, basePath .. ".fillType(?)#name", "Fill type name")
664 schema:register(XMLValueType.FLOAT, basePath .. ".fillType(?)#priceScale", "Price scale", 1)
665 schema:register(XMLValueType.BOOL, basePath .. ".fillType(?)#supportsGreatDemand", "Supports great demand", false)
666 schema:register(XMLValueType.BOOL, basePath .. ".fillType(?)#disablePriceDrop", "Disable price drop", false)
667
668 UnloadingStation.registerXMLPaths(schema, basePath)
669end