diff --git a/server/gameserver/human.h b/server/gameserver/human.h index e95737f6..c19738aa 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -207,6 +207,7 @@ class Human : public Creature a8::XTimerWp dead_timer; int match_mode = 0; std::shared_ptr throw_bomb; + std::map> pending_throw_bomb; std::string name; std::string avatar_url; diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index f932691c..5f307da3 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -1581,5 +1581,67 @@ void Player::InternalRevive(int target_uniid, int revive_coin) void Player::UpdateThrowBomb() { + if (downed) { + throw_bomb.reset(); + return; + } + if (IsCar()) { + throw_bomb.reset(); + return; + } + if (HasBuffEffect(kBET_Jump) || + HasBuffEffect(kBET_Fly)) { + throw_bomb.reset(); + return; + } + if (action_type == AT_Reload || + action_type == AT_Rescue || + action_type == AT_UseItem || + action_type == AT_Relive) { + CancelAction(); + throw_bomb.reset(); + return; + } + const mt::Equip* equip_meta = mt::Equip::GetById(throw_bomb->weapon_id()); + if (equip_meta && equip_meta->_inventory_slot() > 0) { + int slot_id = 0; + switch (equip_meta->_inventory_slot()) { + case IS_FRAG: + case IS_SMOKE: + { + slot_id = SPEC1_SLOT_BEGIN + equip_meta->_inventory_slot() - IS_FRAG; + } + break; + case IS_MOLOTOR_COCKTAIL: + { + slot_id = SPEC2_SLOT_BEGIN + equip_meta->_inventory_slot() - IS_MINE; + } + break; + default: + { + + } + break; + }//end switch + if (slot_id > 0 && slot_id < weapons.size()) { + Weapon& weapon = weapons[slot_id]; + if (weapon.weapon_idx != 0 && + weapon.meta && + weapon.ammo > 0) { + if (HasBuffEffect(kBET_Hide)) { + RemoveBuffByEffectId(kBET_Hide); + } + --weapon.ammo; + room->frame_event.AddPropChg + ( + GetWeakPtrRef(), + kPropWeaponAmmo, + weapon.weapon_idx, + weapon.ammo, + true + ); + } + } + } throw_bomb.reset(); } diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index e39fb3b3..ea0dc66b 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -662,6 +662,7 @@ message MFThrow optional MFVec3 pos = 3; //位置 optional MFVec3 dir = 4; //方向 optional float fly_distance = 5; //飞行距离 + optional int32 estimated_time = 6; //预估时间(单位毫秒) } //爆炸