print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local pricebeer = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local lemonHudFile = "Paletten/hud_fill_lemon.dds"
	local lemonHudFileSmall = "Paletten/hud_fill_lemon_smal.dds"
	
    local lemonFilType = g_fillTypeManager:addFillType("LEMON", g_i18n:getText("lemon"), true, pricebeer * 1.0, 0.00045, math.rad(10), lemonHudFile, lemonHudFileSmall,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 haslemon=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	haslemon=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "LEMON" then
		haslemon=true
	end;
		
end;

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