1
This commit is contained in:
parent
b89a7ac80e
commit
0ab3a0a8a4
@ -3080,19 +3080,16 @@ Obstacle* Creature::SummonObstacle(Buff* buff,
|
||||
const glm::vec3& dir
|
||||
)
|
||||
{
|
||||
#if 0
|
||||
Obstacle* hero = nullptr;
|
||||
const mt::Hero* hero_meta = mt::Hero::GetById(buff->meta->_int_buff_param2);
|
||||
if (hero_meta) {
|
||||
hero = InternalSummonHero(buff,
|
||||
hero_meta,
|
||||
Obstacle* ob = nullptr;
|
||||
const mt::MapThing* thing_meta = mt::MapThing::GetById(buff->meta->_int_buff_param2);
|
||||
if (thing_meta) {
|
||||
ob = InternalSummonObstacle(buff,
|
||||
thing_meta,
|
||||
GetAttackDir(),
|
||||
pos
|
||||
);
|
||||
hero->hero_level = GetBattleContext()->GetHeroLevel();
|
||||
}
|
||||
return hero;
|
||||
#endif
|
||||
return ob;
|
||||
}
|
||||
|
||||
void Creature::RemoveSurplusObstacle(int id, int num)
|
||||
@ -3114,3 +3111,49 @@ void Creature::RemoveSurplusObstacle(int id, int num)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Obstacle* Creature::InternalSummonObstacle(Buff* buff, const mt::MapThing* thing_meta,
|
||||
glm::vec3 dir, const glm::vec3 born_pos)
|
||||
{
|
||||
float *p_rotate = nullptr;
|
||||
float rotate = 0.0f;
|
||||
RoomObstacle* ob = room->CreateObstacle(thing_meta->thing_id(),
|
||||
born_pos.x,
|
||||
born_pos.y,
|
||||
born_pos.z);
|
||||
if (ob) {
|
||||
ob->buff_meta = buff->meta;
|
||||
ob->skill_meta = buff->skill_meta;
|
||||
ob->master.Attach(this);
|
||||
ob->SetTeamId(room, team_id);
|
||||
ob->SetMasterId(room, GetUniId());
|
||||
ob->Active();
|
||||
if (p_rotate) {
|
||||
ob->SetRotate(*p_rotate);
|
||||
}
|
||||
{
|
||||
auto itr = slave_things2_.find(thing_meta->thing_id());
|
||||
if (itr != slave_things2_.end()) {
|
||||
list_add_tail(&ob->entry, &itr->second);
|
||||
} else {
|
||||
slave_things2_[thing_meta->thing_id()] = list_head();
|
||||
itr = slave_things2_.find(thing_meta->thing_id());
|
||||
INIT_LIST_HEAD(&itr->second);
|
||||
list_add_tail(&ob->entry, &itr->second);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
SendDebugMsg(a8::Format("召唤物件 buff_id:%d thing_id:%d pos:%f,%f,%f target_pos:%f,%f,%f",
|
||||
{buff->meta->buff_id(),
|
||||
thing_meta->thing_id(),
|
||||
GetPos().GetX(),
|
||||
GetPos().GetY(),
|
||||
GetPos().GetZ(),
|
||||
born_pos.x,
|
||||
born_pos.y,
|
||||
born_pos.z
|
||||
}));
|
||||
#endif
|
||||
}
|
||||
return ob;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
RoomObstacle::RoomObstacle():Obstacle()
|
||||
{
|
||||
weak_ptr_chunk_.Set(this);
|
||||
INIT_LIST_HEAD(&entry);
|
||||
}
|
||||
|
||||
RoomObstacle::~RoomObstacle()
|
||||
@ -402,6 +403,9 @@ void RoomObstacle::DetachFromMaster()
|
||||
room->RemoveObjectLater(this);
|
||||
}
|
||||
}
|
||||
if (!list_empty(&entry)) {
|
||||
list_del_init(&entry);
|
||||
}
|
||||
}
|
||||
|
||||
void RoomObstacle::Die(Room* room)
|
||||
|
@ -20,6 +20,7 @@ class RoomObstacle : public Obstacle
|
||||
long long born_frameno = 0;
|
||||
a8::XTimerWp life_time_timer;
|
||||
std::shared_ptr<a8::Args> init_args;
|
||||
list_head entry;
|
||||
|
||||
virtual ~RoomObstacle() override;
|
||||
virtual void Initialize() override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user