diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index a7e4a5ed..12a35a7e 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -2704,6 +2704,9 @@ Hero* Creature::InternalSummonHero(Buff* buff, MetaData::Player* hero_meta, a8:: born_pos.x, born_pos.y ); + if (obstacle) { + obstacle->DestoryAt(std::get<1>(tuple)); + } delay_time += std::get<1>(tuple); } SummonHeroInfo* summon_info = new SummonHeroInfo; diff --git a/server/gameserver/roomobstacle.cc b/server/gameserver/roomobstacle.cc index 17a3dcfb..c577a3eb 100644 --- a/server/gameserver/roomobstacle.cc +++ b/server/gameserver/roomobstacle.cc @@ -743,3 +743,23 @@ void RoomObstacle::InstallPreExplostionSummonTimer() } } } + +void RoomObstacle::DestoryAt(int time) +{ + room->xtimer.AddDeadLineTimerAndAttach + ( + time / FRAME_RATE_MS, + a8::XParams() + .SetSender(this), + [] (const a8::XParams& param) + { + RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData(); + obstacle->DetachFromMaster(); +#ifdef DEBUG + obstacle->room->BroadcastDebugMsg + (a8::Format("obstacle destory %d", {obstacle->meta->i->thing_id()})); +#endif + }, + &xtimer_attacher.timer_list_ + ); +} diff --git a/server/gameserver/roomobstacle.h b/server/gameserver/roomobstacle.h index 3553d553..786c890e 100644 --- a/server/gameserver/roomobstacle.h +++ b/server/gameserver/roomobstacle.h @@ -40,6 +40,7 @@ class RoomObstacle : public Obstacle RoomObstacleWeakPtr& GetWeakPtrRef(); void Destory(); void PushCollisionObjects(); + void DestoryAt(int time); private: void SpecExplosion();