manualIgnition455cEvent = {};
manualIgnition455cEvent_mt = Class(manualIgnition455cEvent, Event);

InitEventClass(manualIgnition455cEvent, "manualIgnition455cEvent");

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

function manualIgnition455cEvent:new(object, isRunning)
    local self = manualIgnition455cEvent:emptyNew()
    self.object = object;
	self.isRunning = isRunning;
    return self;
end;

function manualIgnition455cEvent:readStream(streamId, connection)
    local id = streamReadInt32(streamId);
	self.isRunning = streamReadBool(streamId);
    self.object = networkGetObject(id);
    self:run(connection);
end;

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

function manualIgnition455cEvent:run(connection)
	self.object:invokeIgnition(self.isRunning);
    if not connection:getIsServer() then
        g_server:broadcastEvent(manualIgnition455cEvent:new(self.object, self.isRunning), nil, connection, self.object);
    end;	
end;

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

