stuetzenEvent = {};
stuetzenEvent_mt = Class(stuetzenEvent, Event);

InitEventClass(stuetzenEvent, "stuetzenEvent");

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

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

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

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

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

