print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local priceBIOMILK = g_fillTypeManager:getFillTypeByName("WOODCHIPS").pricePerLiter
	
	if node ~= 0 then
	
	local BIOMILKHudFile = "textures/hud_fill_BIOMILK.dds"
	local BIOMILKHudFileSmall = "textures/hud_fill_BIOMILK_sml.dds"
    
	
	local BIOMILKFilType = g_fillTypeManager:addFillType("BIOMILK", g_i18n:getText("biomilk"), true, priceBIOMILK * 10.0, 0.00045, math.rad(40), BIOMILKHudFile, BIOMILKHudFileSmall,modDirectory, nil, { 1, 1, 1 }, nil, false)
    
	g_currentMission.hud.fillLevelsDisplay:refreshFillTypes(g_fillTypeManager)
	end;
end;

function load(id, xmlFile, key,customEnvironment)
	local haswoodChips =false
	local hasBIOMILK=false	
	local hasresin=false
	
	
	local object=id
	if object == nil then
	else
	haswoodChips =false
	hasBIOMILK=false
	hasresin=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "WOODCHIPS" then
		haswoodChips=true
	end;
		if fillname == "BIOMILK" then
		hasBIOMILK=true
	end;
	   
end;

		if haswoodChips and not hasBIOMILK then
		local filltypen = g_fillTypeManager:getFillTypeIndexByName("BIOMILK")
		local price = g_fillTypeManager:getFillTypeByName("BIOMILK").pricePerLiter
			object:addAcceptedFillType(filltypen,price,true,false)
			object.priceMultipliers[ g_fillTypeManager:getFillTypeIndexByName("BIOMILK")]=object.priceMultipliers[ g_fillTypeManager:getFillTypeIndexByName("WOODCHIPS")]
			object:initPricingDynamics()
		end;
		
	end;
end;

FSBaseMission.loadMapFinished = Utils.prependedFunction(FSBaseMission.loadMapFinished, onLoadMapFinished)
SellingStation.load = Utils.appendedFunction(SellingStation.load, load)