Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALTV-627 - make Wheel-Api for server #348

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions server/src/bindings/Vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,120 @@ static void SetBadge(const v8::FunctionCallbackInfo<v8::Value>& info)
_this->SetBadge(textureDictionary, texture, positions);
}

static void GetWheelCamber(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(1);
V8_ARG_TO_INT(1, wheel);
V8_RETURN_NUMBER(vehicle->GetWheelCamber(wheel));
}

static void SetWheelCamber(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(2);
V8_ARG_TO_INT(1, wheel);
V8_ARG_TO_NUMBER(2, value);
vehicle->SetWheelCamber(wheel, value);
}

static void GetWheelTrackWidth(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(1);
V8_ARG_TO_INT(1, wheel);
V8_RETURN_NUMBER(vehicle->GetWheelTrackWidth(wheel));
}

static void SetWheelTrackWidth(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(2);
V8_ARG_TO_INT(1, wheel);
V8_ARG_TO_NUMBER(2, value);
vehicle->SetWheelTrackWidth(wheel, value);
}

static void GetWheelHeight(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(1);
V8_ARG_TO_INT(1, wheel);
V8_RETURN_NUMBER(vehicle->GetWheelHeight(wheel));
}

static void SetWheelHeight(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(2);
V8_ARG_TO_INT(1, wheel);
V8_ARG_TO_NUMBER(2, value);
vehicle->SetWheelHeight(wheel, value);
}

static void GetWheelTyreRadius(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(1);
V8_ARG_TO_INT(1, wheel);
V8_RETURN_NUMBER(vehicle->GetWheelTyreRadius(wheel));
}

static void SetWheelTyreRadius(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(2);
V8_ARG_TO_INT(1, wheel);
V8_ARG_TO_NUMBER(2, value);
vehicle->SetWheelTyreRadius(wheel, value);
}

static void GetWheelRimRadius(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(1);
V8_ARG_TO_INT(1, wheel);
V8_RETURN_NUMBER(vehicle->GetWheelRimRadius(wheel));
}

static void SetWheelRimRadius(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(2);
V8_ARG_TO_INT(1, wheel);
V8_ARG_TO_NUMBER(2, value);
vehicle->SetWheelRimRadius(wheel, value);
}

static void GetWheelTyreWidth(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(1);
V8_ARG_TO_INT(1, wheel);
V8_RETURN_NUMBER(vehicle->GetWheelTyreWidth(wheel));
}

static void SetWheelTyreWidth(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(2);
V8_ARG_TO_INT(1, wheel);
V8_ARG_TO_NUMBER(2, value);
vehicle->SetWheelTyreWidth(wheel, value);
}

extern V8Class v8Entity;
extern V8Class v8Vehicle("Vehicle",
v8Entity,
Expand Down Expand Up @@ -495,4 +609,17 @@ extern V8Class v8Vehicle("Vehicle",
V8Helpers::SetAccessor<IVehicle, bool, &IVehicle::GetHybridExtraActive, &IVehicle::SetHybridExtraActive>(isolate, tpl, "hybridExtraActive");
V8Helpers::SetAccessor<IVehicle, uint8_t, &IVehicle::GetHybridExtraState, &IVehicle::SetHybridExtraState>(isolate, tpl, "hybridExtraState");
V8Helpers::SetMethod(isolate, tpl, "setBadge", &SetBadge);

V8Helpers::SetMethod(isolate, tpl, "getWheelCamber", GetWheelCamber);
V8Helpers::SetMethod(isolate, tpl, "setWheelCamber", SetWheelCamber);
V8Helpers::SetMethod(isolate, tpl, "getWheelTrackWidth", GetWheelTrackWidth);
V8Helpers::SetMethod(isolate, tpl, "setWheelTrackWidth", SetWheelTrackWidth);
V8Helpers::SetMethod(isolate, tpl, "getWheelHeight", GetWheelHeight);
V8Helpers::SetMethod(isolate, tpl, "setWheelHeight", SetWheelHeight);
V8Helpers::SetMethod(isolate, tpl, "getWheelTyreRadius", GetWheelTyreRadius);
V8Helpers::SetMethod(isolate, tpl, "setWheelTyreRadius", SetWheelTyreRadius);
V8Helpers::SetMethod(isolate, tpl, "getWheelRimRadius", GetWheelRimRadius);
V8Helpers::SetMethod(isolate, tpl, "setWheelRimRadius", SetWheelRimRadius);
V8Helpers::SetMethod(isolate, tpl, "getWheelTyreWidth", GetWheelTyreWidth);
V8Helpers::SetMethod(isolate, tpl, "setWheelTyreWidth", SetWheelTyreWidth);
});
2 changes: 1 addition & 1 deletion shared/deps/cpp-sdk
Submodule cpp-sdk updated 1 files
+14 −13 objects/IVehicle.h