This commit is contained in:
aozhiwei 2024-04-01 20:43:03 +08:00
parent 7ed5aa8fa7
commit d3e74e59dd
3 changed files with 11 additions and 2 deletions

View File

@ -399,6 +399,15 @@ void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
[room = room, items] (int event, const a8::Args* args) [room = room, items] (int event, const a8::Args* args)
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {
for (int obj_uniid : items) {
Entity* e = room->GetEntityByUniId(obj_uniid);
if (e && e->IsLoot()) {
Loot* l = e->AsLoot();
if (!l->pickuped && !l->removing) {
room->RemoveObjectLater(l);
}
}
}
} }
}, },
&room->xtimer_attacher_); &room->xtimer_attacher_);

View File

@ -1405,7 +1405,7 @@ int HeroAgent::SearchPickupObj()
bool HeroAgent::PickupObjIsValid() bool HeroAgent::PickupObjIsValid()
{ {
if (curr_pickup_obj_.Get() && owner_->IsHuman()) { if (curr_pickup_obj_.Get() && !curr_pickup_obj_.Get()->removing && owner_->IsHuman()) {
if (curr_pickup_obj_.Get()->IsLoot()) { if (curr_pickup_obj_.Get()->IsLoot()) {
Loot* loot = curr_pickup_obj_.Get()->AsLoot(); Loot* loot = curr_pickup_obj_.Get()->AsLoot();
return !loot->pickuped; return !loot->pickuped;

View File

@ -700,7 +700,7 @@ void Player::ProcInteraction()
#ifdef MYDEBUG1 #ifdef MYDEBUG1
a8::XPrintf("LootInteraction %d\n", {obj_id}); a8::XPrintf("LootInteraction %d\n", {obj_id});
#endif #endif
if (entity) { if (entity && !entity->removing) {
if (entity->GetPos().Distance2D2(GetPos()) > 600) { if (entity->GetPos().Distance2D2(GetPos()) > 600) {
#ifdef MYDEBUG1 #ifdef MYDEBUG1
a8::XPrintf("LootInteraction error3 %d\n", {entity->GetUniId()}); a8::XPrintf("LootInteraction error3 %d\n", {entity->GetUniId()});