Skip to content

Commit

Permalink
Merge branch 'dev' into rc
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Nov 19, 2024
2 parents b2456ac + bac7246 commit 0b8ba83
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
8 changes: 8 additions & 0 deletions client/src/bindings/Interior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ static void GetPortalByIndex(const v8::FunctionCallbackInfo<v8::Value>& info)
V8_RETURN(v8InteriorPortal.New(isolate->GetEnteredOrMicrotaskContext(), args));
}

static void IdGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_INTERNAL_FIELD_UINT32(1, interiorId);
V8_RETURN_UINT(interiorId);
}

extern V8Class v8Interior("Interior",
Constructor,
[](v8::Local<v8::FunctionTemplate> tpl)
Expand All @@ -155,6 +162,7 @@ extern V8Class v8Interior("Interior",
V8Helpers::SetAccessor(isolate, tpl, "pos", &PositionGetter);
V8Helpers::SetAccessor(isolate, tpl, "rot", &RotationGetter);
V8Helpers::SetAccessor(isolate, tpl, "entitiesExtents", &EntitiesExtentsGetter);
V8Helpers::SetAccessor(isolate, tpl, "id", &IdGetter);

V8Helpers::SetStaticMethod(isolate, tpl, "getForInteriorID", &GetForInteriorID);
});
18 changes: 13 additions & 5 deletions client/src/bindings/InteriorPortal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
static void Constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_CHECK_CONSTRUCTOR()
V8_CHECK_CONSTRUCTOR();

V8_CHECK_ARGS_LEN(3)
V8_ARG_TO_UINT(1, interiorId)
V8_ARG_TO_UINT(2, portalIndex)
V8_CHECK_ARGS_LEN(2);
V8_ARG_TO_UINT(1, interiorId);
V8_ARG_TO_UINT(2, portalIndex);

std::shared_ptr<alt::IInterior> interior = alt::ICore::Instance().GetInterior(interiorId);
V8_CHECK(interior, "interior doesn't exist")
V8_CHECK(interior, "interior doesn't exist");

std::shared_ptr<alt::IInteriorPortal> portal = interior->GetPortalByIndex(portalIndex);
V8_CHECK(portal, "interior portal doesn't exist");
Expand Down Expand Up @@ -141,6 +141,13 @@ static void GetCornerPos(const v8::FunctionCallbackInfo<v8::Value>& info)
}


static void EntityCountGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
GET_THIS_INTERIOR_PORTAL(portal);

V8_RETURN_UINT(portal->GetEntityCount());
}

static void SetCornerPos(const v8::FunctionCallbackInfo<v8::Value>& info)
{
GET_THIS_INTERIOR_PORTAL(portal);
Expand All @@ -165,6 +172,7 @@ extern V8Class v8InteriorPortal("InteriorPortal",
V8Helpers::SetAccessor(isolate, tpl, "roomFrom", &RoomFromGetter, &RoomFromSetter);
V8Helpers::SetAccessor(isolate, tpl, "roomTo", &RoomToGetter, &RoomToSetter);
V8Helpers::SetAccessor(isolate, tpl, "flag", &FlagGetter, &FlagSetter);
V8Helpers::SetAccessor(isolate, tpl, "entityCount", &EntityCountGetter);

V8Helpers::SetMethod(isolate, tpl, "getCornerPos", &GetCornerPos);
V8Helpers::SetMethod(isolate, tpl, "getEntityArchetype", &GetEntityArchetype);
Expand Down
1 change: 0 additions & 1 deletion client/src/bindings/InteriorRoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ static void Constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
if(isIndex)
{
room = interior->GetRoomByIndex(value);
V8_CHECK(room, "interior room doesn't exist");
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion shared/deps/cpp-sdk

0 comments on commit 0b8ba83

Please sign in to comment.