print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local pricebeer = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local coffeeHudFile = "Paletten/hud_fill_coffee.dds"
	local coffeeHudFileSmall = "Paletten/hud_fill_coffee_smal.dds"
	
    local coffeeFilType = g_fillTypeManager:addFillType("COFFEE", g_i18n:getText("coffee"), true, pricebeer * 2.5, 0.00045, math.rad(10), coffeeHudFile, coffeeHudFileSmall,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 hascoffee=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hascoffee=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "COFFEE" then
		hascoffee=true
	end;
		
end;

		if hasmaize and not hascoffee then
		local filltypen = g_fillTypeManager:getFillTypeIndexByName("COFFEE")
		local price = g_fillTypeManager:getFillTypeByName("COFFEE").pricePerLiter
			object:addAcceptedFillType(filltypen,price,true,false)
			object.priceMultipliers[ g_fillTypeManager:getFillTypeIndexByName("COFFEE")]=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)