This commit is contained in:
aozhiwei 2024-04-11 15:52:24 +08:00
parent b3de47d013
commit fdd88cc7d8

View File

@ -46,6 +46,16 @@
const int kREVIVE_BUFF_ID = 1005;
static void SendUnityDebugMsg(Player* hum, const std::string msg)
{
#ifdef MYDEBUG
cs::SMDebugMsg dbg_msg;
dbg_msg.set_debug_msg(msg);
dbg_msg.set_out_unity(1);
hum->SendNotifyMsg(dbg_msg);
#endif
}
Player::Player():Human()
{
++PerfMonitor::Instance()->entity_num[ET_Player];
@ -1179,6 +1189,7 @@ void Player::_CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg)
if (msg.has_throw_bomb()) {
throw_bomb = std::make_shared<cs::MFThrow>();
*(throw_bomb.get()) = msg.throw_bomb();
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 1 throw_uniid:%d", {throw_bomb->throw_uniid()}));
} else {
throw_bomb.reset();
}
@ -1675,20 +1686,24 @@ void Player::InternalRevive(int target_uniid, int revive_coin)
void Player::UpdateThrowBomb()
{
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 2 throw_uniid:%d", {throw_bomb->throw_uniid()}));
if (downed) {
throw_bomb.reset();
return;
}
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 3 throw_uniid:%d", {throw_bomb->throw_uniid()}));
if (IsCar()) {
throw_bomb.reset();
return;
}
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 4 throw_uniid:%d", {throw_bomb->throw_uniid()}));
if (HasBuffEffect(kBET_Jump) ||
HasBuffEffect(kBET_Fly) ||
HasBuffEffect(kBET_Floating)) {
throw_bomb.reset();
return;
}
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 5 throw_uniid:%d", {throw_bomb->throw_uniid()}));
if (action_type == AT_Reload ||
action_type == AT_Rescue ||
action_type == AT_UseItem ||
@ -1697,12 +1712,14 @@ void Player::UpdateThrowBomb()
throw_bomb.reset();
return;
}
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 6 throw_uniid:%d", {throw_bomb->throw_uniid()}));
if (pending_throw_bomb.find(throw_bomb->throw_uniid()) !=
pending_throw_bomb.end() ||
!throw_bomb->throw_uniid()) {
throw_bomb.reset();
return;
}
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 7 throw_uniid:%d", {throw_bomb->throw_uniid()}));
const mt::Equip* equip_meta = mt::Equip::GetById(throw_bomb->weapon_id());
if (equip_meta && equip_meta->_inventory_slot() > 0) {
int slot_id = 0;
@ -1724,6 +1741,7 @@ void Player::UpdateThrowBomb()
}
break;
}//end switch
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 8 throw_uniid:%d", {throw_bomb->throw_uniid()}));
if (slot_id > 0 && slot_id < weapons.size()) {
Weapon& weapon = weapons[slot_id];
if (weapon.weapon_idx != 0 &&
@ -1744,9 +1762,12 @@ void Player::UpdateThrowBomb()
bomb_dir,
throw_bomb->fly_distance(),
0);
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 9 throw_uniid:%d", {throw_bomb->throw_uniid()}));
}
}
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 10 throw_uniid:%d", {throw_bomb->throw_uniid()}));
}
SendUnityDebugMsg(this, a8::Format("xxxxxxxx 100 throw_uniid:%d", {throw_bomb->throw_uniid()}));
throw_bomb.reset();
}