1
This commit is contained in:
parent
d5bd6e9966
commit
fb01de9b2e
@ -461,3 +461,58 @@ bool Obstacle::Throughable()
|
||||
return meta->i->attack_type() == 2;
|
||||
}
|
||||
|
||||
int Obstacle::GetTeamId(Room* room)
|
||||
{
|
||||
if (IsPermanent()) {
|
||||
ObstacleData* p = room->GetPermanentObstacleData(GetEntityUniId());
|
||||
if (!a8::HasBitFlag(p->flags, kHealth)) {
|
||||
p->health = health_;
|
||||
a8::SetBitFlag(p->flags, kHealth);
|
||||
}
|
||||
return p->team_id;
|
||||
} else {
|
||||
return team_id_;
|
||||
}
|
||||
}
|
||||
|
||||
void Obstacle::GetTeamId(Room* room, int team_id)
|
||||
{
|
||||
if (IsPermanent()) {
|
||||
ObstacleData* p = room->GetPermanentObstacleData(GetEntityUniId());
|
||||
if (!a8::HasBitFlag(p->flags, kHealth)) {
|
||||
p->health = health_;
|
||||
a8::SetBitFlag(p->flags, kHealth);
|
||||
}
|
||||
p->team_id = team_id;
|
||||
} else {
|
||||
team_id_ = team_id;
|
||||
}
|
||||
}
|
||||
|
||||
int Obstacle::GetMasterId(Room* room)
|
||||
{
|
||||
if (IsPermanent()) {
|
||||
ObstacleData* p = room->GetPermanentObstacleData(GetEntityUniId());
|
||||
if (!a8::HasBitFlag(p->flags, kHealth)) {
|
||||
p->health = health_;
|
||||
a8::SetBitFlag(p->flags, kHealth);
|
||||
}
|
||||
return p->master_id;
|
||||
} else {
|
||||
return master_id_;
|
||||
}
|
||||
}
|
||||
|
||||
void Obstacle::SetMasterId(Room* room, int master_id)
|
||||
{
|
||||
if (IsPermanent()) {
|
||||
ObstacleData* p = room->GetPermanentObstacleData(GetEntityUniId());
|
||||
if (!a8::HasBitFlag(p->flags, kHealth)) {
|
||||
p->health = health_;
|
||||
a8::SetBitFlag(p->flags, kHealth);
|
||||
}
|
||||
p->master_id = master_id;
|
||||
} else {
|
||||
master_id_ = master_id;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,10 @@ class Obstacle : public Entity
|
||||
float GetHealth(Room* room);
|
||||
void SetHealth(Room* room, float value);
|
||||
void Die(Room* room);
|
||||
int GetTeamId(Room* room);
|
||||
void GetTeamId(Room* room, int team_id);
|
||||
int GetMasterId(Room* room);
|
||||
void SetMasterId(Room* room, int master_id);
|
||||
bool IsPermanent();
|
||||
bool Attackable();
|
||||
bool Throughable();
|
||||
@ -76,5 +80,8 @@ protected:
|
||||
bool dead_ = false;
|
||||
long long dead_frameno_ = 0;
|
||||
|
||||
int team_id_ = 0;
|
||||
int master_id_ = 0;
|
||||
|
||||
friend class EntityFactory;
|
||||
};
|
||||
|
@ -97,10 +97,6 @@ bool RoomObstacle::CanThroughable(Human* hum)
|
||||
|
||||
void RoomObstacle::ActiveTimerFunc()
|
||||
{
|
||||
if (meta->i->thing_type() == kObstacleSelfExplosion) {
|
||||
room->xtimer.DeleteTimer(room->xtimer.GetRunningTimer());
|
||||
return;
|
||||
}
|
||||
if (!master.Get()) {
|
||||
room->xtimer.DeleteTimer(room->xtimer.GetRunningTimer());
|
||||
return;
|
||||
|
@ -137,6 +137,8 @@ struct ObstacleData
|
||||
float health = 0.0f;
|
||||
bool dead = false;
|
||||
long long dead_frameno = 0;
|
||||
int team_id = 0;
|
||||
int master_id = 0;
|
||||
|
||||
int door_open_times = 0;
|
||||
DoorState_e door_state = DoorStateClose;
|
||||
|
Loading…
x
Reference in New Issue
Block a user