loadMotionPathEffects = {}

local modDirectory = g_currentModDirectory

function loadMotionPathEffects.loadMapData(self, superFunc, val1, val2, val3)

    local returnValue = superFunc(self, val1, val2, val3)

    if fileExists(modDirectory.."scripts/motionPathEffects.xml") then
        local xml = loadXMLFile("motionPathEffects", modDirectory.."scripts/motionPathEffects.xml")

        local i = 0
        while true do
            local motionPathEffect = getXMLString(xml, "motionPathEffects.motionPathEffect("..i..")#filename")
            if motionPathEffect ~= nil and motionPathEffect ~= "" then
                g_motionPathEffectManager:loadMotionPathEffectsXML(motionPathEffect, modDirectory, "NewStraw_22")
            else
                break
            end
            i = i + 1
        end
	    
	    delete(xml)
    else
        print("Warning: Can't load '"..tostring(modDirectory.."scripts/motionPathEffects.xml").."' no custom MotionPathEffects will be loaded!")
    end

    return returnValue 
end
MotionPathEffectManager.loadMapData = Utils.overwrittenFunction(MotionPathEffectManager.loadMapData, loadMotionPathEffects.loadMapData)

