-- author: DD ModPassion
-- date: 14.04.2021
-- copyright (C): DD ModPassion, All Rights Reserved
-- version: farming simulator 19
AddFillTypes = {} local modName = g_currentModName local modDir = g_currentModDirectory function AddFillTypes:init() FillTypeManager.loadMapData = Utils.appendedFunction(FillTypeManager.loadMapData, AddFillTypes.loadMapData) FSBaseMission.loadMap = Utils.prependedFunction(FSBaseMission.loadMap, AddFillTypes.loadMap) end function AddFillTypes.loadMapData() local xmlFile = loadXMLFile("modDesc", modDir.."modDesc.xml") local i = 0 while true do local baseKey = string.format("modDesc.fillTypes.fillType(%d)", i) if not hasXMLProperty(xmlFile, baseKey) then break end local name = getXMLString(xmlFile, baseKey.."#name") local title = g_i18n:getText(getXMLString(xmlFile, baseKey.."#title")) local showOnPriceTable = getXMLBool(xmlFile, baseKey.."#showOnPriceTable") local pricePerLiter = getXMLFloat(xmlFile, baseKey.."#pricePerLiter") local massPerLiter = getXMLFloat(xmlFile, baseKey..".physics#massPerLiter")/1000 local maxPhysicalSurfaceAngle = getXMLFloat(xmlFile, baseKey..".physics#maxPhysicalSurfaceAngle") local hudFilename = getXMLString(xmlFile, baseKey..".image#hud") local hudSmallFilename = getXMLString(xmlFile, baseKey..".image#hudSmall") local fillPlaneColors = { 1, 1, 1} local palletFilename = getXMLString(xmlFile, baseKey..".pallet#filename") g_fillTypeManager:addFillType(name, title, showOnPriceTable, pricePerLiter, massPerLiter, maxPhysicalSurfaceAngle, hudFilename, hudSmallFilename, modDir, modName, fillPlaneColors, palletFilename, false) i = i + 1 end delete(xmlFile) end function AddFillTypes.loadMap(mission, node) g_currentMission.hud.fillLevelsDisplay:refreshFillTypes(g_fillTypeManager) end AddFillTypes:init()