print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local pricefrubes = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local frubesHudFile = "Paletten/hud_fill_frubes.dds"
	local frubesHudFileSmall = "Paletten/hud_fill_frubes_small.dds"
	
    local frubesFilType = g_fillTypeManager:addFillType("FRUBES", g_i18n:getText("frubes"), true, pricefrubes * 2.2, 0.00045, math.rad(10), frubesHudFile, frubesHudFileSmall,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 hasfrubes=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hasfrubes=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "FRUBES" then
		hasfrubes=true
	end;
		
end;

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