This commit is contained in:
aozhiwei 2021-04-08 20:18:00 +08:00
parent fb01de9b2e
commit bad4c837ef
4 changed files with 4 additions and 32 deletions

View File

@ -1392,6 +1392,8 @@ RoomObstacle* Creature::SummonObstacle(int id, const a8::Vec2& pos)
RoomObstacle* obstacle = room->CreateObstacle(id, pos.x, pos.y);
if (obstacle) {
obstacle->master.Attach(this);
obstacle->SetTeamId(room, team_id);
obstacle->SetMasterId(room, GetEntityUniId());
obstacle->Active();
} else {
abort();

View File

@ -475,7 +475,7 @@ int Obstacle::GetTeamId(Room* room)
}
}
void Obstacle::GetTeamId(Room* room, int team_id)
void Obstacle::SetTeamId(Room* room, int team_id)
{
if (IsPermanent()) {
ObstacleData* p = room->GetPermanentObstacleData(GetEntityUniId());

View File

@ -55,7 +55,7 @@ class Obstacle : public Entity
void SetHealth(Room* room, float value);
void Die(Room* room);
int GetTeamId(Room* room);
void GetTeamId(Room* room, int team_id);
void SetTeamId(Room* room, int team_id);
int GetMasterId(Room* room);
void SetMasterId(Room* room, int master_id);
bool IsPermanent();

View File

@ -131,10 +131,6 @@ void RoomObstacle::ActiveTimerFunc()
void RoomObstacle::UpdateTimerFunc()
{
if (meta->i->thing_type() == kObstacleSelfExplosion) {
room->xtimer.DeleteTimer(room->xtimer.GetRunningTimer());
return;
}
if (grid_list_ && master.Get() && !IsDead(room)) {
std::set<Human*> human_list;
room->grid_service->TouchAllLayerHumanList
@ -368,19 +364,6 @@ void RoomObstacle::ActiveSelfExplosion()
void RoomObstacle::ActiveMine()
{
room->xtimer.AddRepeatTimerAndAttach
(
SERVER_FRAME_RATE,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->ActiveTimerFunc();
},
&xtimer_attacher.timer_list_
);
room->xtimer.AddRepeatTimerAndAttach
(
SERVER_FRAME_RATE,
@ -397,19 +380,6 @@ void RoomObstacle::ActiveMine()
void RoomObstacle::ActiveTrap()
{
room->xtimer.AddRepeatTimerAndAttach
(
SERVER_FRAME_RATE,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->ActiveTimerFunc();
},
&xtimer_attacher.timer_list_
);
room->xtimer.AddRepeatTimerAndAttach
(
SERVER_FRAME_RATE,