-- Advanced  Tools for Mission Editor
local thisModule
local moduleName = "Module4"

local function onTimer(events)
    for _id, _ in events:pairs() do
        if events:isCoreEvent(_id) == true then
            if events:getCoreEventType(_id) == "SIGNAL_UNIT_IN_ZONE" then
                local datas = events:getCoreEventDatas(_id)
                datas.unit:display("Vous entrez dans la zone", 5)
            elseif events:getCoreEventType(_id) == "SIGNAL_UNIT_OUT_OF_ZONE" then
                local datas = events:getCoreEventDatas(_id)
                datas.unit:display("Vous sortez de la zone", 5)
            end
        end
    end
end

local function onCreateGroup(_group)
    if _group:getName() == "My Vehicle" then
        _group:setSignal(2500, "SIGNAL_SMOKE GREEN")
    end
end



-- MAIN
do
    local newHandlers = {
        onCreatePlayerHandler = nil,
        onDeletePlayerHandler = nil,
        onUpdatePlayerHandler = nil,
        onTakeoffPlayerHandler = nil,
        onLandingPlayerHandler = nil,
        onStartEnginePlayerHandler = nil,
        onStopEnginePlayerHandler = nil,
        
        onCreateAIUnitHandler = nil,
        onDeleteAIUnitHandler = nil,
        onDisableAIUnitHandler = nil,
        onTakeoffAIUnitHandler = nil,
        onLandingAIUnitHandler = nil,
        onStartEngineAIUnitHandler = nil,
        onStopEngineAIUnitHandler = nil,
        
        onCreateGroupHandler = onCreateGroup,
        onDeleteGroupHandler = nil,
        onDisableGroupHandler = nil,
        
        onCreateStaticObjectHandler = nil,
        onDeleteStaticObjectHandler = nil,
    
        onTimerHandler = onTimer,
        onModuleStartHandler = nil,
    }
        
    thisModule = ATME.C_Module(moduleName, newHandlers, true)
end
