liftachseEvent = {};
liftachseEvent_mt = Class(liftachseEvent, Event);

InitEventClass(liftachseEvent, "liftachseEvent");

function liftachseEvent:emptyNew()
    local self = Event:new(liftachseEvent_mt);
    self.className="liftachseEvent";
    return self;
end;

function liftachseEvent:new(object, data)
    local self = liftachseEvent:emptyNew()
    self.object = object;
    self.data = data;
    return self;
end;

function liftachseEvent:readStream(streamId, connection)
    local id = streamReadInt32(streamId);
    self.object = networkGetObject(id);
    self.data = streamReadBool(streamId);
    self.object.Liftachsedown = self.data;
    if not connection:getIsServer() then
        g_server:broadcastEvent(liftachseEvent:new(self.object, self.data), nil, connection, self.object);
    end;
end;

function liftachseEvent:writeStream(streamId, connection)
    streamWriteInt32(streamId, networkGetObjectId(self.object));
    streamWriteBool(streamId, self.data);
end;

function liftachseEvent.sendEvent(vehicle, data)
    if g_server ~= nil then
        g_server:broadcastEvent(liftachseEvent:new(vehicle, data), nil, nil, vehicle);
    else
        g_client:getServerConnection():sendEvent(liftachseEvent:new(vehicle, data));
    end;
end;

