This commit is contained in:
aozhiwei 2023-05-17 15:56:37 +08:00
parent ad9b5de45c
commit 9544804a58
5 changed files with 40 additions and 3 deletions

View File

@ -351,6 +351,7 @@ class Creature : public MoveableEntity
const mt::Equip* bullet_meta);
bool CanShot(bool try_reload);
void AdjustPos();
void OnLand();
protected:
virtual void OnBuffRemove(Buff& buff);
@ -372,7 +373,6 @@ private:
void CheckAbilityUsed();
void AutoSwitchWeapon();
void CheckLoadingBullet();
void OnLand();
protected:
bool need_sync_active_player_ = false;

View File

@ -1295,3 +1295,20 @@ bool MapInstance::IsConnectablePoly(dtPolyRef poly_ref)
{
return connectable_polys_.find(poly_ref) != connectable_polys_.end();
}
bool MapInstance::IsValidPos(const glm::vec3& point)
{
if (point.x >= GetMapMeta()->map_width()) {
return false;
}
if (point.x <= 0) {
return false;
}
if (point.z >= GetMapMeta()->map_height()) {
return false;
}
if (point.z <= 0) {
return false;
}
return true;
}

View File

@ -62,6 +62,7 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
bool GetNearestGrass(const glm::vec3& center, glm::vec3& out_pt);
void AdjustOnLandPoint(glm::vec3& point);
bool IsConnectablePoly(dtPolyRef poly_ref);
bool IsValidPos(const glm::vec3& point);
private:
void LoadHouse();

View File

@ -30,6 +30,7 @@
#include "buff.h"
#include "stats.h"
#include "guide.h"
#include "mapinstance.h"
#include "mt/Param.h"
#include "mt/Equip.h"
@ -1039,10 +1040,17 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
sand_table_target_pos = std::make_shared<glm::vec3>();
}
TypeConvert::FromPb(*sand_table_target_pos, &msg.sand_table_target_pos());
if (GlmHelper::IsEqual2D(*sand_table_target_pos, GetPos().ToGlmVec3())) {
if (GlmHelper::IsEqual2D(*sand_table_target_pos, GetPos().ToGlmVec3()) ||
!room->map_instance->IsValidPos(*sand_table_target_pos)) {
sand_table_target_pos = nullptr;
} else {
glm::vec3 dir = *sand_table_target_pos - GetPos().ToGlmVec3();
glm::vec3 target_dir = *sand_table_target_pos - GetPos().ToGlmVec3();
target_dir = glm::vec3(target_dir.x, 0.0f, target_dir.z);
float distance = GlmHelper::Norm(target_dir);
GlmHelper::Normalize(target_dir);
SetMoveDir(target_dir);
SetAttackDir(target_dir);
GetMovement()->CalcTargetPos(distance);
}
} else {
sand_table_target_pos = nullptr;

View File

@ -1294,6 +1294,17 @@ void Room::UpdateGasInactivePvp()
ForwardGasRing(map_meta_->init_gas_ring());
}
}
TraverseHumanList
(
[] (Human* hum) -> bool
{
hum->RemoveBuffByEffectId(kBET_ThroughWall);
hum->OnLand();
if (hum->GetEntitySubType() == EST_Player) {
GameLog::Instance()->GameStart((Player*)hum);
}
return true;
});
NotifyUiUpdate();
NotifyGameStart();
} else {