1
This commit is contained in:
parent
fb01de9b2e
commit
bad4c837ef
@ -1392,6 +1392,8 @@ RoomObstacle* Creature::SummonObstacle(int id, const a8::Vec2& pos)
|
|||||||
RoomObstacle* obstacle = room->CreateObstacle(id, pos.x, pos.y);
|
RoomObstacle* obstacle = room->CreateObstacle(id, pos.x, pos.y);
|
||||||
if (obstacle) {
|
if (obstacle) {
|
||||||
obstacle->master.Attach(this);
|
obstacle->master.Attach(this);
|
||||||
|
obstacle->SetTeamId(room, team_id);
|
||||||
|
obstacle->SetMasterId(room, GetEntityUniId());
|
||||||
obstacle->Active();
|
obstacle->Active();
|
||||||
} else {
|
} else {
|
||||||
abort();
|
abort();
|
||||||
|
@ -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()) {
|
if (IsPermanent()) {
|
||||||
ObstacleData* p = room->GetPermanentObstacleData(GetEntityUniId());
|
ObstacleData* p = room->GetPermanentObstacleData(GetEntityUniId());
|
||||||
|
@ -55,7 +55,7 @@ class Obstacle : public Entity
|
|||||||
void SetHealth(Room* room, float value);
|
void SetHealth(Room* room, float value);
|
||||||
void Die(Room* room);
|
void Die(Room* room);
|
||||||
int GetTeamId(Room* room);
|
int GetTeamId(Room* room);
|
||||||
void GetTeamId(Room* room, int team_id);
|
void SetTeamId(Room* room, int team_id);
|
||||||
int GetMasterId(Room* room);
|
int GetMasterId(Room* room);
|
||||||
void SetMasterId(Room* room, int master_id);
|
void SetMasterId(Room* room, int master_id);
|
||||||
bool IsPermanent();
|
bool IsPermanent();
|
||||||
|
@ -131,10 +131,6 @@ void RoomObstacle::ActiveTimerFunc()
|
|||||||
|
|
||||||
void RoomObstacle::UpdateTimerFunc()
|
void RoomObstacle::UpdateTimerFunc()
|
||||||
{
|
{
|
||||||
if (meta->i->thing_type() == kObstacleSelfExplosion) {
|
|
||||||
room->xtimer.DeleteTimer(room->xtimer.GetRunningTimer());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (grid_list_ && master.Get() && !IsDead(room)) {
|
if (grid_list_ && master.Get() && !IsDead(room)) {
|
||||||
std::set<Human*> human_list;
|
std::set<Human*> human_list;
|
||||||
room->grid_service->TouchAllLayerHumanList
|
room->grid_service->TouchAllLayerHumanList
|
||||||
@ -368,19 +364,6 @@ void RoomObstacle::ActiveSelfExplosion()
|
|||||||
|
|
||||||
void RoomObstacle::ActiveMine()
|
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
|
room->xtimer.AddRepeatTimerAndAttach
|
||||||
(
|
(
|
||||||
SERVER_FRAME_RATE,
|
SERVER_FRAME_RATE,
|
||||||
@ -397,19 +380,6 @@ void RoomObstacle::ActiveMine()
|
|||||||
|
|
||||||
void RoomObstacle::ActiveTrap()
|
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
|
room->xtimer.AddRepeatTimerAndAttach
|
||||||
(
|
(
|
||||||
SERVER_FRAME_RATE,
|
SERVER_FRAME_RATE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user