Skip to content

Commit

Permalink
feat(client): alt.HandlingData.reloadVehiclePhysics
Browse files Browse the repository at this point in the history
  • Loading branch information
vadzz-dev committed May 28, 2024
1 parent f236cf9 commit 539f6c2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/src/bindings/HandlingData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ static void Constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
auto handling = alt::ICore::Instance().GetHandlingData(modelHash);
V8_CHECK(handling, "model doesn't exist");


V8Helpers::SetObjectClass(info.GetIsolate(), info.This(), V8Class::ObjectClass::HANDLING_DATA);
info.This()->SetInternalField(1, info[0]);
}
Expand All @@ -31,6 +30,16 @@ static void GetForHandlingName(const v8::FunctionCallbackInfo<v8::Value>& info)
V8_RETURN(v8HandlingData.New(isolate->GetEnteredOrMicrotaskContext(), args));
}

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

V8_CHECK_ARGS_LEN(1);
V8_ARG_TO_UINT(1, modelHash);

V8_RETURN_BOOLEAN(alt::ICore::Instance().ReloadVehiclePhysics(modelHash));
}

static void HandlingNameHashGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
Expand Down Expand Up @@ -1737,6 +1746,7 @@ extern V8Class v8HandlingData("HandlingData", Constructor, [](v8::Local<v8::Func
tpl->InstanceTemplate()->SetInternalFieldCount(static_cast<int>(V8Class::InternalFields::COUNT));

V8Helpers::SetStaticMethod(isolate, tpl, "getForHandlingName", &GetForHandlingName);
V8Helpers::SetStaticMethod(isolate, tpl, "reloadVehiclePhysics", &ReloadVehiclePhysics);

V8Helpers::SetAccessor(isolate, tpl, "handlingNameHash", &HandlingNameHashGetter);
V8Helpers::SetAccessor(isolate, tpl, "mass", &MassGetter, &MassSetter);
Expand Down

0 comments on commit 539f6c2

Please sign in to comment.