From 8ce7854986ac26ed5a68fe199fbb9060fe7c7423 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 8 Mar 2021 10:36:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0grass=20water=20ice=E5=87=BA?= =?UTF-8?q?=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/human.cc | 64 +++++++++++++++++++++++++++++++++++++- server/gameserver/human.h | 6 ++++ 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index f8aed6f..86e5f87 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -4291,12 +4291,74 @@ void Human::CheckSpecObject() std::set colliders; room->map_service->GetSpecColliders(spec_flags, room, GetPos().x, GetPos().y, colliders); + bool in_grass = false; + bool in_water = false; + bool in_ice = false; for (const ColliderComponent* collider : colliders) { switch (collider->owner->GetEntityType()) { - case ET_Loot: + case ET_Obstacle: + case ET_Building: break; default: break; } } + + if (in_grass) { + if (!HasBuffEffect(kBET_InGrass)) { + OnEnterGrass(); + } + } else { + if (HasBuffEffect(kBET_InGrass)) { + OnLeaveGrass(); + } + } + if (in_water) { + if (!HasBuffEffect(kBET_InWater)) { + OnEnterWater(); + } + } else { + if (HasBuffEffect(kBET_InWater)) { + OnLeaveWater(); + } + } + if (in_ice) { + if (!HasBuffEffect(kBET_InIce)) { + OnEnterIce(); + } + } else { + if (HasBuffEffect(kBET_InIce)) { + OnLeaveIce(); + } + } +} + +void Human::OnEnterGrass() +{ + +} + +void Human::OnLeaveGrass() +{ + +} + +void Human::OnEnterWater() +{ + +} + +void Human::OnLeaveWater() +{ + +} + +void Human::OnEnterIce() +{ + +} + +void Human::OnLeaveIce() +{ + } diff --git a/server/gameserver/human.h b/server/gameserver/human.h index a693c86..e6452b3 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -356,6 +356,12 @@ private: void DoGetOnWithLoot(Loot* loot_entity); void DoGetOnWithCar(Car* car); void CheckSpecObject(); + void OnEnterGrass(); + void OnLeaveGrass(); + void OnEnterWater(); + void OnLeaveWater(); + void OnEnterIce(); + void OnLeaveIce(); protected: int level_ = 0;