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

fix object missing getByID getter + fix object and ped removeEntity e… #309

Merged
merged 37 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cb3ca7d
Merge branch 'dev' into release
C0kkie Jan 22, 2023
a434ff6
client:revert bytecode changes for release
C0kkie Jan 23, 2023
e881b93
Revert "client:revert bytecode changes for release"
LeonMrBonnie Jan 23, 2023
4159c55
Merge branch 'dev' of github.com:altmp/altv-js-module into release
LeonMrBonnie Jan 23, 2023
8697004
Node v18 (#245)
LeonMrBonnie Feb 15, 2023
90f9113
server: Temp activate node specifier resolution
LeonMrBonnie Feb 28, 2023
aa06f67
server: Add missing require
LeonMrBonnie Feb 28, 2023
e36b71d
server: Fix
LeonMrBonnie Feb 28, 2023
a8a2ed3
Revert "server: Fix"
LeonMrBonnie Feb 28, 2023
e90cb95
server: Fix resource import
LeonMrBonnie Feb 20, 2023
fbf3382
Change CDN path
C0kkie Mar 1, 2023
5818b2e
server: disable warnings
C0kkie Mar 14, 2023
7dac89e
Merge branch 'dev' into rc
C0kkie Mar 17, 2023
2ef3b79
shared: allow returning modified damage value from weapon damage event
LeonMrBonnie Mar 20, 2023
ec0f182
remove debug log
martonp96 Mar 29, 2023
d2443d4
remove debug log
martonp96 Mar 29, 2023
49cd842
client: fix optional native string args
LeonMrBonnie Mar 29, 2023
6326165
Merge rc into release
C0kkie Mar 31, 2023
193cc14
Merge branch 'dev' into rc
C0kkie Jul 23, 2023
9f6316e
fix sdk
C0kkie Jul 23, 2023
c59a017
Merge branch 'dev' into rc
C0kkie Aug 5, 2023
bd52e16
fix sdk
C0kkie Aug 5, 2023
8ebe3cf
Merge branch 'dev' into rc
emcifuntik Aug 21, 2023
a6e306e
Merge tag 'dev/15.0-dev610' into rc
emcifuntik Sep 10, 2023
3300acd
Merge branch 'dev' into rc
emcifuntik Sep 13, 2023
4abe0a4
Merge branch 'dev' into rc
emcifuntik Sep 16, 2023
2d3c5a4
Merge remote-tracking branch 'origin/dev' into rc
emcifuntik Sep 27, 2023
a9f32d4
Merge branch 'dev' into rc
C0kkie Oct 4, 2023
abccf72
fix
C0kkie Oct 4, 2023
fab6971
Merge branch 'dev' into rc
C0kkie Oct 13, 2023
776fa46
sdk
C0kkie Oct 13, 2023
2b826f7
Merge tag 'dev/15.0-dev789' into rc
emcifuntik Oct 20, 2023
60b2937
Merge branch 'rc' into release
C0kkie Oct 20, 2023
6f2b255
sdk
C0kkie Oct 20, 2023
4c29436
Merge branch 'dev' into release
C0kkie Oct 22, 2023
235a7bb
update sdk
C0kkie Oct 22, 2023
8b65c25
fix object missing getByID getter + fix object and ped removeEntity e…
lackos888 Nov 27, 2023
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
20 changes: 20 additions & 0 deletions server/src/bindings/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@ static void CountGetter(v8::Local<v8::String> name, const v8::PropertyCallbackIn
V8_RETURN_UINT(alt::ICore::Instance().GetBaseObjects(alt::IBaseObject::Type::OBJECT).size());
}

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

V8_ARG_TO_INT(1, id);

alt::IBaseObject* entity = alt::ICore::Instance().GetBaseObjectByID(alt::IBaseObject::Type::OBJECT, id);

if(entity)
{
V8_RETURN_BASE_OBJECT(entity);
}
else
{
V8_RETURN_NULL();
}
}

// clang-format off
extern V8Class v8Entity;
extern V8Class v8Object("Object", v8Entity, Constructor, [](v8::Local<v8::FunctionTemplate> tpl)
Expand All @@ -74,6 +93,7 @@ extern V8Class v8Object("Object", v8Entity, Constructor, [](v8::Local<v8::Functi

V8Helpers::SetStaticAccessor(isolate, tpl, "all", &AllGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "count", &CountGetter);
V8Helpers::SetStaticMethod(isolate, tpl, "getByID", &StaticGetByID);

V8Helpers::SetMethod<alt::IObject, &alt::IObject::ActivatePhysics>(isolate, tpl, "activatePhysics");
V8Helpers::SetMethod<alt::IObject, &alt::IObject::PlaceOnGroundProperly>(isolate, tpl, "placeOnGroundProperly");
Expand Down
2 changes: 1 addition & 1 deletion shared/V8ResourceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void V8ResourceImpl::OnRemoveBaseObject(alt::IBaseObject* handle)
if(!ent) return;

auto entityType = handle->GetType();
if(entityType == alt::IBaseObject::Type::PLAYER || entityType == alt::IBaseObject::Type::LOCAL_PLAYER || entityType == alt::IBaseObject::Type::VEHICLE)
if(entityType == alt::IBaseObject::Type::PLAYER || entityType == alt::IBaseObject::Type::LOCAL_PLAYER || entityType == alt::IBaseObject::Type::VEHICLE || entityType == alt::IBaseObject::Type::PED || entityType == alt::IBaseObject::Type::OBJECT)
{
std::vector<V8Helpers::EventCallback*> handlers = GetLocalHandlers("removeEntity");
std::vector<v8::Local<v8::Value>> args{ ent->GetJSVal(isolate) };
Expand Down
Loading