print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local pricemayonnaise = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local mayonnaiseHudFile = "Paletten/hud_fill_mayonnaise.dds"
	local mayonnaiseHudFileSmall = "Paletten/hud_fill_mayonnaise_small.dds"
	
    local mayonnaiseFilType = g_fillTypeManager:addFillType("MAYONNAISE", g_i18n:getText("mayonnaise"), true, pricemayonnaise * 2.7, 0.00045, math.rad(10), mayonnaiseHudFile, mayonnaiseHudFileSmall,modDirectory, nil, { 1, 1, 1 }, nil, false)
	
	g_currentMission.hud.fillLevelsDisplay:refreshFillTypes(g_fillTypeManager)
	end;
end;

function load(id, xmlFile, key,customEnvironment)
	local hasmaize =false
	local hasmayonnaise=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hasmayonnaise=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "MAYONNAISE" then
		hasmayonnaise=true
	end;
		
end;

		if hasmaize and not hasmayonnaise then
		local filltypen = g_fillTypeManager:getFillTypeIndexByName("MAYONNAISE")
		local price = g_fillTypeManager:getFillTypeByName("MAYONNAISE").pricePerLiter
			object:addAcceptedFillType(filltypen,price,true,false)
			object.priceMultipliers[ g_fillTypeManager:getFillTypeIndexByName("MAYONNAISE")]=object.priceMultipliers[ g_fillTypeManager:getFillTypeIndexByName("MAIZE")]
			object:initPricingDynamics()
		end;
		
	end;
end;

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