1
This commit is contained in:
parent
ad9b5de45c
commit
9544804a58
@ -351,6 +351,7 @@ class Creature : public MoveableEntity
|
|||||||
const mt::Equip* bullet_meta);
|
const mt::Equip* bullet_meta);
|
||||||
bool CanShot(bool try_reload);
|
bool CanShot(bool try_reload);
|
||||||
void AdjustPos();
|
void AdjustPos();
|
||||||
|
void OnLand();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnBuffRemove(Buff& buff);
|
virtual void OnBuffRemove(Buff& buff);
|
||||||
@ -372,7 +373,6 @@ private:
|
|||||||
void CheckAbilityUsed();
|
void CheckAbilityUsed();
|
||||||
void AutoSwitchWeapon();
|
void AutoSwitchWeapon();
|
||||||
void CheckLoadingBullet();
|
void CheckLoadingBullet();
|
||||||
void OnLand();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool need_sync_active_player_ = false;
|
bool need_sync_active_player_ = false;
|
||||||
|
@ -1295,3 +1295,20 @@ bool MapInstance::IsConnectablePoly(dtPolyRef poly_ref)
|
|||||||
{
|
{
|
||||||
return connectable_polys_.find(poly_ref) != connectable_polys_.end();
|
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;
|
||||||
|
}
|
||||||
|
@ -62,6 +62,7 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
|
|||||||
bool GetNearestGrass(const glm::vec3& center, glm::vec3& out_pt);
|
bool GetNearestGrass(const glm::vec3& center, glm::vec3& out_pt);
|
||||||
void AdjustOnLandPoint(glm::vec3& point);
|
void AdjustOnLandPoint(glm::vec3& point);
|
||||||
bool IsConnectablePoly(dtPolyRef poly_ref);
|
bool IsConnectablePoly(dtPolyRef poly_ref);
|
||||||
|
bool IsValidPos(const glm::vec3& point);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void LoadHouse();
|
void LoadHouse();
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "buff.h"
|
#include "buff.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "guide.h"
|
#include "guide.h"
|
||||||
|
#include "mapinstance.h"
|
||||||
|
|
||||||
#include "mt/Param.h"
|
#include "mt/Param.h"
|
||||||
#include "mt/Equip.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>();
|
sand_table_target_pos = std::make_shared<glm::vec3>();
|
||||||
}
|
}
|
||||||
TypeConvert::FromPb(*sand_table_target_pos, &msg.sand_table_target_pos());
|
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;
|
sand_table_target_pos = nullptr;
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
sand_table_target_pos = nullptr;
|
sand_table_target_pos = nullptr;
|
||||||
|
@ -1294,6 +1294,17 @@ void Room::UpdateGasInactivePvp()
|
|||||||
ForwardGasRing(map_meta_->init_gas_ring());
|
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();
|
NotifyUiUpdate();
|
||||||
NotifyGameStart();
|
NotifyGameStart();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user