This commit is contained in:
aozhiwei 2021-09-10 06:51:30 +00:00
parent ab4f8e6ad3
commit 0cda57c482
4 changed files with 24 additions and 0 deletions

View File

@ -1937,6 +1937,7 @@ void Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& pos)
}
RoomObstacle* obstacle = room->CreateObstacle(id, pos.x, pos.y);
if (obstacle) {
obstacle->buff_meta = buff->meta;
obstacle->master.Attach(this);
obstacle->SetTeamId(room, team_id);
obstacle->SetMasterId(room, GetUniId());
@ -1947,7 +1948,9 @@ void Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& pos)
SendDebugMsg(a8::Format("召唤物件 buff_id:%d thing_id:%d", {buff->meta->i->buff_id(), id}));
#endif
} else {
#ifdef DEBUG
abort();
#endif
}
}

View File

@ -299,6 +299,20 @@ void RoomObstacle::Active()
}
break;
}
if (meta->i->life_time() > 0) {
room->xtimer.AddDeadLineTimerAndAttach
(
meta->i->life_time() / FRAME_RATE_MS,
a8::XParams()
.SetSender(this),
[] (const a8::XParams& param)
{
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
obstacle->DetachFromMaster();
},
&xtimer_attacher.timer_list_
);
}
}
void RoomObstacle::ActiveSelfExplosion()

View File

@ -5,6 +5,11 @@
#include "obstacle.h"
#include "weakptr.h"
namespace MetaData
{
struct Buff;
}
class Ability;
class RoomObstacle : public Obstacle
{
@ -16,6 +21,7 @@ class RoomObstacle : public Obstacle
int real_object_uniid = 0;
std::shared_ptr<Ability> context_ability;
bool sweep_lock = false;
MetaData::Buff* buff_meta = nullptr;
virtual ~RoomObstacle() override;
virtual void Initialize() override;

View File

@ -73,6 +73,7 @@ message MapThing
optional int32 explosion_hit = 30;
optional string sweep_tags = 31;
optional int32 prebattle_hide = 32;
optional int32 life_time = 33;
}
message SafeArea