This commit is contained in:
aozhiwei 2024-07-31 15:13:59 +08:00
parent e4bd8249c2
commit 16c743f12d
3 changed files with 12 additions and 0 deletions

View File

@ -313,3 +313,11 @@ bool BoxDrop::GetNextBoxPos(glm::vec3& pos)
}
return false;
}
void BoxDrop::DropByUuid(int obj_uniid, const glm::vec3& center)
{
int box_num = GetAndDecObjBoxNum(obj_uniid);
if (box_num > 0) {
Drop(box_num, center);
}
}

View File

@ -16,6 +16,7 @@ class BoxDrop : public std::enable_shared_from_this<BoxDrop>
void OnObstacleDeadDrop(Obstacle* ob);
void RequestReturnBoxNum();
bool GetNextBoxPos(glm::vec3& pos);
void DropByUuid(int obj_uniid, const glm::vec3& center);
private:

View File

@ -318,6 +318,9 @@ bool Obstacle::DoInteraction(Human* sender)
if (a8::TIMER_EXEC_EVENT == event) {
#if 1
sender->DropItems(center, drops);
if (!empty(drops)) {
sender->room->GetBoxDrop()->DropByUuid(obj_uniid, center);
}
#else
Entity* entity = sender->room->GetEntityByUniId(obj_uniid);
if (entity && entity->IsEntityType(ET_Obstacle)) {