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

View File

@ -108,7 +108,6 @@ void RoomObstacle::ActiveTimerFunc()
return;
}
if (!grid_list_) {
temp_through_ = true;
grid_list_ = new std::set<GridCell*>();
room->grid_service->GetAllCellsByXy(room, GetPos().x, GetPos().y, *grid_list_);
}
@ -118,19 +117,15 @@ void RoomObstacle::ActiveTimerFunc()
*grid_list_,
[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 (TestCollision(room, hum)) {
has_hum = true;
stop = true;
}
}
temp_through_ = old_temp_through;
}
);
if (!has_hum) {
temp_through_ = false;
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()
{

View File

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