-- AdvancedSilageTypes - MixerWagon Effects Extension
-- Adds a dedicated mixer wagon motion path effect definition for GRASS_FERMENTED.

local modDirectory = g_currentModDirectory
local modName = g_currentModName

local MixerWagonEffectsExtension = {}
MixerWagonEffectsExtension.effectsXml = "xml/mixerWagonEffects.xml"
MixerWagonEffectsExtension.effectsXmlPath = modDirectory .. MixerWagonEffectsExtension.effectsXml
MixerWagonEffectsExtension.loaded = false

function MixerWagonEffectsExtension:loadMapData(superFunc, xmlFile, missionInfo, baseDirectory)
    local result = superFunc(self, xmlFile, missionInfo, baseDirectory)

    if not MixerWagonEffectsExtension.loaded and fileExists(MixerWagonEffectsExtension.effectsXmlPath) then
        if self.loadMotionPathEffectsXML ~= nil then
            self:loadMotionPathEffectsXML(MixerWagonEffectsExtension.effectsXml, modDirectory, modName)
            MixerWagonEffectsExtension.loaded = true
        end
    end

    return result
end

MotionPathEffectManager.loadMapData = Utils.overwrittenFunction(MotionPathEffectManager.loadMapData, MixerWagonEffectsExtension.loadMapData)
