print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local pricegarbage = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local garbageHudFile = "Paletten/hud_fill_garbage.dds"
	local garbageHudFileSmall = "Paletten/hud_fill_garbage_small.dds"
	
    local garbageFilType = g_fillTypeManager:addFillType("GARBAGE", g_i18n:getText("garbage"), true, pricegarbage * 0.5, 0.00045, math.rad(10), garbageHudFile, garbageHudFileSmall,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 hasgarbage=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hasgarbage=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "GARBAGE" then
		hasgarbage=true
	end;
		
end;

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