Skip to content

Commit 1892c7d

Browse files
committed
增加API, onEnteredAoI。详细见手册
1 parent 7ab0cd9 commit 1892c7d

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

kbe/src/server/cellapp/entity.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,15 @@ void Entity::onLeaveTrapID(ENTITY_ID entityID, float range_xz, float range_y, ui
10811081
const_cast<char*>("kffIi"), entityID, range_xz, range_y, controllerID, userarg);
10821082
}
10831083

1084+
//-------------------------------------------------------------------------------------
1085+
void Entity::onEnteredAoI(Entity* entity)
1086+
{
1087+
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
1088+
1089+
SCRIPT_OBJECT_CALL_ARGS1(this, const_cast<char*>("onEnteredAoI"),
1090+
const_cast<char*>("O"), entity);
1091+
}
1092+
10841093
//-------------------------------------------------------------------------------------
10851094
int Entity::pySetPosition(PyObject *value)
10861095
{

kbe/src/server/cellapp/entity.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,11 @@ class Entity : public script::ScriptObject
451451
float range_xz, float range_y,
452452
uint32 controllerID, int32 userarg);
453453

454+
/**
455+
一个entity进入了AOI区域
456+
*/
457+
void onEnteredAoI(Entity* entity);
458+
454459
/**
455460
停止任何移动行为
456461
*/

kbe/src/server/cellapp/witness.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ void Witness::setAoiRadius(float radius, float hyst)
282282
//-------------------------------------------------------------------------------------
283283
void Witness::onEnterAOI(Entity* pEntity)
284284
{
285+
pEntity_->onEnteredAoI(pEntity);
286+
285287
EntityRef::AOI_ENTITIES::iterator iter = std::find_if(aoiEntities_.begin(), aoiEntities_.end(),
286288
findif_vector_entityref_exist_by_entity_handler(pEntity));
287289

0 commit comments

Comments
 (0)