This commit is contained in:
aozhiwei 2021-06-22 12:17:34 +00:00
parent 2aa7678755
commit 4a7cad1850
3 changed files with 15 additions and 25 deletions

View File

@ -406,9 +406,9 @@ bool Obstacle::IsPermanent()
bool Obstacle::Throughable() bool Obstacle::Throughable()
{ {
#if 0 return meta->i->bullet_hit() == kBulletHitPass &&
return meta->i->attack_type() == 2; meta->i->collision_hit() == kCollisionHitPass &&
#endif meta->i->explosion_hit() == kExplosionHitPass;
} }
int Obstacle::GetTeamId(Room* room) int Obstacle::GetTeamId(Room* room)
@ -545,6 +545,11 @@ void Obstacle::OnExplosionHit(Explosion* e)
if (e->GetDmg() < 0.001f) { if (e->GetDmg() < 0.001f) {
return; return;
} }
if (meta->receive_special_damage_type != 0 &&
((e->GetSpecialDamageType() & meta->receive_special_damage_type) == 0)) {
return;
}
float dmg = e->GetDmg(); float dmg = e->GetDmg();
float def = 0; float def = 0;
float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K); float finaly_dmg = dmg * (1 - def/MetaMgr::Instance()->K);
@ -555,9 +560,13 @@ void Obstacle::OnExplosionHit(Explosion* e)
if (IsDead(e->GetRoom())) { if (IsDead(e->GetRoom())) {
if (meta->i->damage_dia() > 0.01f && if (meta->i->damage_dia() > 0.01f &&
meta->i->damage() > 0.01f) { meta->i->damage() > 0.01f) {
#if 0 Explosion explosion;
Explosion(this); explosion.IndifferenceAttack(
#endif e->GetRoom(),
GetPos(),
meta->i->damage_dia(),
meta->i->damage(),
meta->i->explosion_effect());
} }
if (meta->i->drop() != 0) { if (meta->i->drop() != 0) {
e->GetRoom()->ScatterDrop(GetPos(), meta->i->drop()); e->GetRoom()->ScatterDrop(GetPos(), meta->i->drop());

View File

@ -108,7 +108,6 @@ void RoomObstacle::ActiveTimerFunc()
return; return;
} }
if (!grid_list_) { if (!grid_list_) {
temp_through_ = true;
grid_list_ = new std::set<GridCell*>(); grid_list_ = new std::set<GridCell*>();
room->grid_service->GetAllCellsByXy(room, GetPos().x, GetPos().y, *grid_list_); room->grid_service->GetAllCellsByXy(room, GetPos().x, GetPos().y, *grid_list_);
} }
@ -118,19 +117,15 @@ void RoomObstacle::ActiveTimerFunc()
*grid_list_, *grid_list_,
[this, &has_hum] (Human* hum, bool& stop) [this, &has_hum] (Human* hum, bool& stop)
{ {
bool old_temp_through = temp_through_;
temp_through_ = false;
if (master.Get()->team_id == hum->team_id) { if (master.Get()->team_id == hum->team_id) {
if (TestCollision(room, hum)) { if (TestCollision(room, hum)) {
has_hum = true; has_hum = true;
stop = true; stop = true;
} }
} }
temp_through_ = old_temp_through;
} }
); );
if (!has_hum) { if (!has_hum) {
temp_through_ = false;
room->xtimer.DeleteTimer(room->xtimer.GetRunningTimer()); room->xtimer.DeleteTimer(room->xtimer.GetRunningTimer());
} }
} }
@ -373,18 +368,6 @@ void RoomObstacle::Die(Room* room)
} }
} }
bool RoomObstacle::CanThroughable(Creature* c)
{
if (meta->i->thing_type() == kObstacleOilBucket) {
return true;
}
if (master.Get()) {
return master.Get()->team_id == c->team_id && temp_through_;
} else {
return temp_through_;
}
}
void RoomObstacle::ActiveSpring() void RoomObstacle::ActiveSpring()
{ {

View File

@ -18,7 +18,6 @@ class RoomObstacle : public Obstacle
virtual void Initialize() override; virtual void Initialize() override;
virtual void RecalcSelfCollider() override; virtual void RecalcSelfCollider() override;
virtual bool IsTerminatorAirDropBox(Room* room) override { return is_terminator_airdrop_box; } virtual bool IsTerminatorAirDropBox(Room* room) override { return is_terminator_airdrop_box; }
virtual bool CanThroughable(Creature* c) override;
virtual bool DoInteraction(Human* sender) override; virtual bool DoInteraction(Human* sender) override;
void ActiveTimerFunc(); void ActiveTimerFunc();
void UpdateTimerFunc(); void UpdateTimerFunc();
@ -41,7 +40,6 @@ private:
void SummonAirDropBox(int box_id); void SummonAirDropBox(int box_id);
protected: protected:
bool temp_through_ = false;
std::set<GridCell*>* grid_list_ = nullptr; std::set<GridCell*>* grid_list_ = nullptr;
int explosion_times_ = 0; int explosion_times_ = 0;
bool detached_ = false; bool detached_ = false;