1
This commit is contained in:
parent
08ce0b619a
commit
523c92e1c5
@ -267,12 +267,22 @@ void Player::LootInteraction(Loot* entity)
|
||||
weapons[0].num = 0;
|
||||
need_sync_active_player = true;
|
||||
}
|
||||
need_sync_active_player = true;
|
||||
for (auto& pair : room->human_hash_) {
|
||||
pair.second->new_objects.insert(this);
|
||||
}
|
||||
} else {
|
||||
Weapon* weapon = nullptr;
|
||||
if (weapons[GUN_SLOT1].weapon_id == 0) {
|
||||
weapon = &weapons[GUN_SLOT1];
|
||||
if (curr_weapon != &weapons[GUN_SLOT2]) {
|
||||
curr_weapon = &weapons[GUN_SLOT1];
|
||||
}
|
||||
} else if (weapons[GUN_SLOT2].weapon_id == 0) {
|
||||
weapon = &weapons[GUN_SLOT2];
|
||||
if (curr_weapon != &weapons[GUN_SLOT1]) {
|
||||
curr_weapon = &weapons[GUN_SLOT2];
|
||||
}
|
||||
}
|
||||
if (!weapon) {
|
||||
cs::SMPickup notifymsg;
|
||||
@ -280,11 +290,14 @@ void Player::LootInteraction(Loot* entity)
|
||||
SendNotifyMsg(notifymsg);
|
||||
return;
|
||||
}
|
||||
weapons[0].weapon_idx = 0;
|
||||
weapons[0].weapon_id = entity->item_id;
|
||||
weapons[0].weapon_lv = 1;
|
||||
weapons[0].num = 0;
|
||||
weapon->weapon_idx = 0;
|
||||
weapon->weapon_id = entity->item_id;
|
||||
weapon->weapon_lv = 1;
|
||||
weapon->num = 0;
|
||||
need_sync_active_player = true;
|
||||
for (auto& pair : room->human_hash_) {
|
||||
pair.second->new_objects.insert(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -338,7 +351,47 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
||||
|
||||
void Player::_CMDropItem(f8::MsgHdr& hdr, const cs::CMDropItem& msg)
|
||||
{
|
||||
|
||||
if (msg.has_weapon_idx()) {
|
||||
if (msg.weapon_idx() >= 0 && msg.weapon_idx() < weapons.size()) {
|
||||
bool drop_ok = false;
|
||||
Weapon* weapon = &weapons[msg.weapon_idx()];
|
||||
if (weapon->weapon_id != 0) {
|
||||
if (weapon->weapon_idx == 0) {
|
||||
if (weapon->weapon_id != default_weapon.weapon_id) {
|
||||
drop_ok = true;
|
||||
*weapon = default_weapon;
|
||||
}
|
||||
} else if (weapon->weapon_idx == GUN_SLOT1) {
|
||||
drop_ok = true;
|
||||
*weapon = Weapon();
|
||||
weapon->weapon_idx = msg.weapon_idx();
|
||||
if (curr_weapon == weapon) {
|
||||
if (weapons[GUN_SLOT2].weapon_id != 0) {
|
||||
curr_weapon = &weapons[GUN_SLOT2];
|
||||
} else {
|
||||
curr_weapon = &weapons[0];
|
||||
}
|
||||
}
|
||||
} else if (weapon->weapon_idx == GUN_SLOT2) {
|
||||
drop_ok = true;
|
||||
*weapon = Weapon();
|
||||
weapon->weapon_idx = msg.weapon_idx();
|
||||
if (curr_weapon == weapon) {
|
||||
if (weapons[GUN_SLOT1].weapon_id != 0) {
|
||||
curr_weapon = &weapons[GUN_SLOT1];
|
||||
} else {
|
||||
curr_weapon = &weapons[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (drop_ok) {
|
||||
for (auto& pair : room->human_hash_) {
|
||||
pair.second->new_objects.insert(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_CMEmote(f8::MsgHdr& hdr, const cs::CMEmote& msg)
|
||||
@ -425,9 +478,10 @@ void Player::MakeUpdateMsg()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (updated_times == 0) {
|
||||
if (updated_times == 0 || need_sync_active_player) {
|
||||
update_msg->set_active_player_id(entity_uniid);
|
||||
FillMFActivePlayerData(update_msg->mutable_active_player_data());
|
||||
need_sync_active_player = true;
|
||||
}
|
||||
if (updated_times == 0 || last_sync_gas_frameno < room->gas_data.gas_start_frameno) {
|
||||
last_sync_gas_frameno = room->gas_data.gas_start_frameno;
|
||||
|
Loading…
x
Reference in New Issue
Block a user