From 4a7cad1850a65a2557a5a34fe2c5fa72829491c2 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 22 Jun 2021 12:17:34 +0000 Subject: [PATCH] 1 --- server/gameserver/obstacle.cc | 21 +++++++++++++++------ server/gameserver/roomobstacle.cc | 17 ----------------- server/gameserver/roomobstacle.h | 2 -- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/server/gameserver/obstacle.cc b/server/gameserver/obstacle.cc index 8884b57..eaa275d 100644 --- a/server/gameserver/obstacle.cc +++ b/server/gameserver/obstacle.cc @@ -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()); diff --git a/server/gameserver/roomobstacle.cc b/server/gameserver/roomobstacle.cc index d51530b..74453bd 100644 --- a/server/gameserver/roomobstacle.cc +++ b/server/gameserver/roomobstacle.cc @@ -108,7 +108,6 @@ void RoomObstacle::ActiveTimerFunc() return; } if (!grid_list_) { - temp_through_ = true; grid_list_ = new std::set(); 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() { diff --git a/server/gameserver/roomobstacle.h b/server/gameserver/roomobstacle.h index 44e4919..ae4b877 100644 --- a/server/gameserver/roomobstacle.h +++ b/server/gameserver/roomobstacle.h @@ -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* grid_list_ = nullptr; int explosion_times_ = 0; bool detached_ = false;