RotationEvent = {};
RotationEvent_mt = Class(RotationEvent, Event);

InitEventClass(RotationEvent, "RotationEvent");

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

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

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

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

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