diff --git a/client/src/bindings/Interior.cpp b/client/src/bindings/Interior.cpp index 08c1f8b1..051b9fc4 100644 --- a/client/src/bindings/Interior.cpp +++ b/client/src/bindings/Interior.cpp @@ -138,6 +138,13 @@ static void GetPortalByIndex(const v8::FunctionCallbackInfo& info) V8_RETURN(v8InteriorPortal.New(isolate->GetEnteredOrMicrotaskContext(), args)); } +static void IdGetter(v8::Local, const v8::PropertyCallbackInfo& info) +{ + V8_GET_ISOLATE_CONTEXT(); + V8_GET_THIS_INTERNAL_FIELD_UINT32(1, interiorId); + V8_RETURN_UINT(interiorId); +} + extern V8Class v8Interior("Interior", Constructor, [](v8::Local tpl) @@ -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); }); diff --git a/client/src/bindings/InteriorPortal.cpp b/client/src/bindings/InteriorPortal.cpp index 0bb929b5..a461f209 100644 --- a/client/src/bindings/InteriorPortal.cpp +++ b/client/src/bindings/InteriorPortal.cpp @@ -5,14 +5,14 @@ static void Constructor(const v8::FunctionCallbackInfo& 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 interior = alt::ICore::Instance().GetInterior(interiorId); - V8_CHECK(interior, "interior doesn't exist") + V8_CHECK(interior, "interior doesn't exist"); std::shared_ptr portal = interior->GetPortalByIndex(portalIndex); V8_CHECK(portal, "interior portal doesn't exist"); @@ -141,6 +141,13 @@ static void GetCornerPos(const v8::FunctionCallbackInfo& info) } +static void EntityCountGetter(v8::Local, const v8::PropertyCallbackInfo& info) +{ + GET_THIS_INTERIOR_PORTAL(portal); + + V8_RETURN_UINT(portal->GetEntityCount()); +} + static void SetCornerPos(const v8::FunctionCallbackInfo& info) { GET_THIS_INTERIOR_PORTAL(portal); @@ -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); diff --git a/client/src/bindings/InteriorRoom.cpp b/client/src/bindings/InteriorRoom.cpp index ef19a595..c5bd1644 100644 --- a/client/src/bindings/InteriorRoom.cpp +++ b/client/src/bindings/InteriorRoom.cpp @@ -19,7 +19,6 @@ static void Constructor(const v8::FunctionCallbackInfo& info) if(isIndex) { room = interior->GetRoomByIndex(value); - V8_CHECK(room, "interior room doesn't exist"); } else { diff --git a/shared/deps/cpp-sdk b/shared/deps/cpp-sdk index e2966f42..f18e52bb 160000 --- a/shared/deps/cpp-sdk +++ b/shared/deps/cpp-sdk @@ -1 +1 @@ -Subproject commit e2966f42c4509f6a6836c18b9766c26ef23a87af +Subproject commit f18e52bbb7fd9cc57efa66f6c40449b41cdc13a0