This commit is contained in:
aozhiwei 2024-09-10 17:40:45 +08:00
parent f27e70d722
commit 0cbe144e57
4 changed files with 35 additions and 11 deletions

View File

@ -524,6 +524,7 @@ void CallFuncBuff::ProcFlashMove()
owner->SetPos(new_pos);
App::Instance()->verify_set_pos = 0;
owner->room->grid_service->MoveCreature(owner);
owner->SyncServerPos(1);
if (owner->IsCar()) {
Car* car = owner->AsCar();
if (car->GetDriver()) {
@ -611,13 +612,10 @@ void CallFuncBuff::ProcFlashMoveToPos()
owner->GetMovement()->ClearPath();
App::Instance()->verify_set_pos = 1;
if (owner->IsClientMove()) {
owner->GetMutablePos().FromGlmVec3(glm::vec3(x, y, z));
} else {
owner->GetMutablePos().FromGlmVec3(glm::vec3(x, y, z));
}
owner->GetMutablePos().FromGlmVec3(glm::vec3(x, y, z));
App::Instance()->verify_set_pos = 0;
owner->room->grid_service->MoveCreature(owner);
owner->SyncServerPos(1);
#if 0
owner->room->frame_event.AddPropChg(owner->GetWeakPtrRef(),
kPropFlyTo,

View File

@ -16,6 +16,7 @@
#include "mt/Buff.h"
#include "mt/Skill.h"
#include "mt/Param.h"
#include "mt/SkillNumber.h"
void SprintBuff::Activate()
@ -44,6 +45,10 @@ void SprintBuff::SprintMove()
owner->SetAttackDir(owner->context_dir);
owner->SetDisableMoveDirTimes(old_times);
owner->IncDisableMoveDirTimes();
if (owner->IsClientMove()) {
owner->GetMovement()->ClearPath();
owner->GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
}
#ifdef MYDEBUG
a8::XPrintf("%s\n",
{

View File

@ -2694,20 +2694,32 @@ void Creature::UpdateMove()
{
Position old_pos = GetPos();
if (GetMovement()->UpdatePosition()) {
if (HasBuffEffect(kBET_Sprint) && IsPlayer()) {
if (room->GetFrameNo() % 2 == 0) {
SyncServerPos(1);
}
}
} else {
if (HasBuffEffect(kBET_Sprint) && IsPlayer()) {
if (room->GetFrameNo() % 2 == 0) {
SyncServerPos(1);
}
}
if (!GetMovement()->IsFindPath()) {
if (room->GetGasData().GetGasMode() == GasInactive &&
room->IsSandTableRoom()) {
} else {
if (IsPlayer() || HasBuffEffect(kBET_Sprint)) {
if (HasBuffEffect(kBET_Sprint)) {
GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
}
if (!GetMovement()->UpdatePosition()) {
if (HasBuffEffect(kBET_Sprint)) {
GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
SprintBuff* buff = (SprintBuff*)GetBuffByEffectId(kBET_Sprint);
if (buff) {
buff->SprintEnd();
}
} else if (IsPlayer() && !AsPlayer()->is_client_move) {
} else if (IsPlayer() && !AsPlayer()->IsClientMove()) {
GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
ShortFindPath();
}
@ -3503,6 +3515,9 @@ float Creature::InternalGetSpeed()
float rate = addition + ruduce;
finaly_speed *= 1.0f + rate;
#ifdef MYDEBUG
if (IsPlayer() && HasBuffEffect(kBET_Sprint)) {
int i = 0;
}
if (IsPlayer() && finaly_speed > 500) {
a8::XPrintf("player speed:%f\n", {finaly_speed});
}

View File

@ -229,11 +229,16 @@ void Player::InternalUpdate(int delta_time)
moving = false;
}
}
if (is_client_move) {
if (IsClientMove()) {
if (GetMovement()->GetPathSize() > 0) {
moving = true;
} else {
moving = false;
if (HasBuffEffect(kBET_Sprint)) {
moving = true;
moved_frames = 0;
} else {
moving = false;
}
}
} else {
if (GetMovement()->IsFindPath()) {
@ -1012,7 +1017,7 @@ void Player::_CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg)
long long pre_frameno = last_cmmove_frameno_;
last_cmmove_frameno_ = room->GetFrameNo();
moving = false;
if (is_client_move) {
if (IsClientMove()) {
if (msg.has_move_target_pos()) {
if (std::isfinite(msg.move_target_pos().x()) &&
std::isfinite(msg.move_target_pos().y()) &&
@ -1021,7 +1026,8 @@ void Player::_CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg)
std::abs(msg.move_target_pos().x()) > 0.00001f ||
std::abs(msg.move_target_pos().y()) > 0.00001f ||
std::abs(msg.move_target_pos().z()) > 0.00001f
)
) &&
!HasBuffEffect(kBET_Sprint)
){
glm::vec3 tmp_pos;
TypeConvert::FromPb(tmp_pos, &msg.move_target_pos());