Skip to content

Commit

Permalink
server: add streaminglimit getter & seter
Browse files Browse the repository at this point in the history
  • Loading branch information
C0kkie committed Aug 29, 2023
1 parent bcfb2b5 commit ff4d964
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 1 deletion.
112 changes: 112 additions & 0 deletions server/src/bindings/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,102 @@ static void SetVoiceExternal(const v8::FunctionCallbackInfo<v8::Value>& info)
alt::ICore::Instance().SetVoiceExternal(host, port);
}

static void GetStreamingDistance(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_RETURN_UINT(alt::ICore::Instance().GetStreamingDistance());
}

static void SetStreamingDistance(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_CHECK_ARGS_LEN(1);

V8_ARG_TO_UINT(1, distance);

alt::ICore::Instance().SetStreamingDistance(distance);
}

static void GetStreamingTickRate(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_RETURN_UINT(alt::ICore::Instance().GetStreamingTickRate());
}

static void SetStreamingTickRate(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_CHECK_ARGS_LEN(1);

V8_ARG_TO_UINT(1, tickrate);

alt::ICore::Instance().SetStreamingTickRate(tickrate);
}

static void GetStreamerThreadCount(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_RETURN_UINT(alt::ICore::Instance().GetStreamerThreadCount());
}

static void SetStreamerThreadCount(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_CHECK_ARGS_LEN(1);

V8_ARG_TO_UINT(1, count);

alt::ICore::Instance().SetStreamerThreadCount(count);
}

static void GetMaxStreamingPeds(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_RETURN_UINT(alt::ICore::Instance().GetMaxStreamingPeds());
}

static void SetMaxStreamingPeds(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_CHECK_ARGS_LEN(1);

V8_ARG_TO_UINT(1, limit);

alt::ICore::Instance().SetMaxStreamingPeds(limit);
}

static void GetMaxStreamingObjects(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_RETURN_UINT(alt::ICore::Instance().GetMaxStreamingObjects());
}

static void SetMaxStreamingObjects(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_CHECK_ARGS_LEN(1);

V8_ARG_TO_UINT(1, limit);

alt::ICore::Instance().SetMaxStreamingObjects(limit);
}

static void GetMaxStreamingVehicles(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_RETURN_UINT(alt::ICore::Instance().GetMaxStreamingVehicles());
}

static void SetMaxStreamingVehicles(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_CHECK_ARGS_LEN(1);

V8_ARG_TO_UINT(1, limit);

alt::ICore::Instance().SetMaxStreamingVehicles(limit);
}

extern V8Class v8Player, v8Vehicle, v8Blip, v8AreaBlip, v8RadiusBlip, v8PointBlip, v8Checkpoint, v8VoiceChannel, v8Colshape, v8ColshapeCylinder, v8ColshapeSphere, v8ColshapeCircle,
v8ColshapeCuboid, v8ColshapeRectangle, v8ColshapePolygon, v8Ped, v8Object, v8VirtualEntity, v8VirtualEntityGroup, v8Marker, v8ConnectionInfo;

Expand Down Expand Up @@ -645,5 +741,21 @@ extern V8Module
V8Helpers::RegisterFunc(exports, "setVoiceExternalPublic", &SetVoiceExternalPublic);
V8Helpers::RegisterFunc(exports, "setVoiceExternal", &SetVoiceExternal);

V8Helpers::RegisterFunc(exports, "getMaxStreamingPeds", &GetMaxStreamingPeds);
V8Helpers::RegisterFunc(exports, "getMaxStreamingObjects", &GetMaxStreamingObjects);
V8Helpers::RegisterFunc(exports, "getMaxStreamingVehicles", &GetMaxStreamingVehicles);
V8Helpers::RegisterFunc(exports, "setMaxStreamingPeds", &SetMaxStreamingPeds);
V8Helpers::RegisterFunc(exports, "setMaxStreamingObjects", &SetMaxStreamingObjects);
V8Helpers::RegisterFunc(exports, "setMaxStreamingVehicles", &SetMaxStreamingVehicles);

V8Helpers::RegisterFunc(exports, "getStreamerThreadCount", &GetStreamerThreadCount);
V8Helpers::RegisterFunc(exports, "setStreamerThreadCount", &SetStreamerThreadCount);

V8Helpers::RegisterFunc(exports, "getStreamingTickRate", &GetStreamingTickRate);
V8Helpers::RegisterFunc(exports, "setStreamingTickRate", &SetStreamingTickRate);

V8Helpers::RegisterFunc(exports, "getStreamingDistance", &GetStreamingDistance);
V8Helpers::RegisterFunc(exports, "setStreamingDistance", &SetStreamingDistance);

V8_OBJECT_SET_STRING(exports, "rootDir", alt::ICore::Instance().GetRootDirectory());
});
2 changes: 1 addition & 1 deletion shared/deps/cpp-sdk

0 comments on commit ff4d964

Please sign in to comment.