print();

local modDirectory = g_currentModDirectory

function onLoadMapFinished(mission, node)
	local pricebeer = g_fillTypeManager:getFillTypeByName("MAIZE").pricePerLiter
	
	
	if node ~= 0 then
	
	local plantHudFile = "Paletten/hud_fill_plant.dds"
	local plantHudFileSmall = "Paletten/hud_fill_plant_smal.dds"
	
    local plantFilType = g_fillTypeManager:addFillType("PLANT", g_i18n:getText("plant"), true, pricebeer * 0.7, 0.00045, math.rad(10), plantHudFile, plantHudFileSmall,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 hasplant=false	
	
	
	local object=id
	if object == nil then
	else
	hasmaize =false
	hasplant=false
	
	
	for i,filltype in pairs(object.acceptedFillTypes) do
	local fillname=g_fillTypeManager.indexToName[i]
		if fillname == "MAIZE" then
		hasmaize=true
	end;
		if fillname == "PLANT" then
		hasplant=true
	end;
		
end;

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