1
This commit is contained in:
parent
b89a7ac80e
commit
0ab3a0a8a4
@ -3080,19 +3080,16 @@ Obstacle* Creature::SummonObstacle(Buff* buff,
|
|||||||
const glm::vec3& dir
|
const glm::vec3& dir
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if 0
|
Obstacle* ob = nullptr;
|
||||||
Obstacle* hero = nullptr;
|
const mt::MapThing* thing_meta = mt::MapThing::GetById(buff->meta->_int_buff_param2);
|
||||||
const mt::Hero* hero_meta = mt::Hero::GetById(buff->meta->_int_buff_param2);
|
if (thing_meta) {
|
||||||
if (hero_meta) {
|
ob = InternalSummonObstacle(buff,
|
||||||
hero = InternalSummonHero(buff,
|
thing_meta,
|
||||||
hero_meta,
|
GetAttackDir(),
|
||||||
GetAttackDir(),
|
pos
|
||||||
pos
|
);
|
||||||
);
|
|
||||||
hero->hero_level = GetBattleContext()->GetHeroLevel();
|
|
||||||
}
|
}
|
||||||
return hero;
|
return ob;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::RemoveSurplusObstacle(int id, int num)
|
void Creature::RemoveSurplusObstacle(int id, int num)
|
||||||
@ -3114,3 +3111,49 @@ void Creature::RemoveSurplusObstacle(int id, int num)
|
|||||||
}
|
}
|
||||||
#endif
|
#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()
|
RoomObstacle::RoomObstacle():Obstacle()
|
||||||
{
|
{
|
||||||
weak_ptr_chunk_.Set(this);
|
weak_ptr_chunk_.Set(this);
|
||||||
|
INIT_LIST_HEAD(&entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomObstacle::~RoomObstacle()
|
RoomObstacle::~RoomObstacle()
|
||||||
@ -402,6 +403,9 @@ void RoomObstacle::DetachFromMaster()
|
|||||||
room->RemoveObjectLater(this);
|
room->RemoveObjectLater(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!list_empty(&entry)) {
|
||||||
|
list_del_init(&entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomObstacle::Die(Room* room)
|
void RoomObstacle::Die(Room* room)
|
||||||
|
@ -20,6 +20,7 @@ class RoomObstacle : public Obstacle
|
|||||||
long long born_frameno = 0;
|
long long born_frameno = 0;
|
||||||
a8::XTimerWp life_time_timer;
|
a8::XTimerWp life_time_timer;
|
||||||
std::shared_ptr<a8::Args> init_args;
|
std::shared_ptr<a8::Args> init_args;
|
||||||
|
list_head entry;
|
||||||
|
|
||||||
virtual ~RoomObstacle() override;
|
virtual ~RoomObstacle() override;
|
||||||
virtual void Initialize() override;
|
virtual void Initialize() override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user