From 539f6c21f915dd859a7e6a575cfe066c843163f0 Mon Sep 17 00:00:00 2001 From: vadzz Date: Tue, 28 May 2024 12:27:52 +0300 Subject: [PATCH] feat(client): alt.HandlingData.reloadVehiclePhysics --- client/src/bindings/HandlingData.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/src/bindings/HandlingData.cpp b/client/src/bindings/HandlingData.cpp index 71e264a2..e8e4529a 100644 --- a/client/src/bindings/HandlingData.cpp +++ b/client/src/bindings/HandlingData.cpp @@ -13,7 +13,6 @@ static void Constructor(const v8::FunctionCallbackInfo& 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]); } @@ -31,6 +30,16 @@ static void GetForHandlingName(const v8::FunctionCallbackInfo& info) V8_RETURN(v8HandlingData.New(isolate->GetEnteredOrMicrotaskContext(), args)); } +static void ReloadVehiclePhysics(const v8::FunctionCallbackInfo& 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, const v8::PropertyCallbackInfo& info) { V8_GET_ISOLATE_CONTEXT(); @@ -1737,6 +1746,7 @@ extern V8Class v8HandlingData("HandlingData", Constructor, [](v8::LocalInstanceTemplate()->SetInternalFieldCount(static_cast(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);