1
This commit is contained in:
parent
523c92e1c5
commit
061a45c188
@ -275,11 +275,13 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
Weapon* weapon = nullptr;
|
Weapon* weapon = nullptr;
|
||||||
if (weapons[GUN_SLOT1].weapon_id == 0) {
|
if (weapons[GUN_SLOT1].weapon_id == 0) {
|
||||||
weapon = &weapons[GUN_SLOT1];
|
weapon = &weapons[GUN_SLOT1];
|
||||||
|
weapon->weapon_idx = GUN_SLOT1;
|
||||||
if (curr_weapon != &weapons[GUN_SLOT2]) {
|
if (curr_weapon != &weapons[GUN_SLOT2]) {
|
||||||
curr_weapon = &weapons[GUN_SLOT1];
|
curr_weapon = &weapons[GUN_SLOT1];
|
||||||
}
|
}
|
||||||
} else if (weapons[GUN_SLOT2].weapon_id == 0) {
|
} else if (weapons[GUN_SLOT2].weapon_id == 0) {
|
||||||
weapon = &weapons[GUN_SLOT2];
|
weapon = &weapons[GUN_SLOT2];
|
||||||
|
weapon->weapon_idx = GUN_SLOT2;
|
||||||
if (curr_weapon != &weapons[GUN_SLOT1]) {
|
if (curr_weapon != &weapons[GUN_SLOT1]) {
|
||||||
curr_weapon = &weapons[GUN_SLOT2];
|
curr_weapon = &weapons[GUN_SLOT2];
|
||||||
}
|
}
|
||||||
@ -290,7 +292,6 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
SendNotifyMsg(notifymsg);
|
SendNotifyMsg(notifymsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
weapon->weapon_idx = 0;
|
|
||||||
weapon->weapon_id = entity->item_id;
|
weapon->weapon_id = entity->item_id;
|
||||||
weapon->weapon_lv = 1;
|
weapon->weapon_lv = 1;
|
||||||
weapon->num = 0;
|
weapon->num = 0;
|
||||||
@ -355,6 +356,7 @@ void Player::_CMDropItem(f8::MsgHdr& hdr, const cs::CMDropItem& msg)
|
|||||||
if (msg.weapon_idx() >= 0 && msg.weapon_idx() < weapons.size()) {
|
if (msg.weapon_idx() >= 0 && msg.weapon_idx() < weapons.size()) {
|
||||||
bool drop_ok = false;
|
bool drop_ok = false;
|
||||||
Weapon* weapon = &weapons[msg.weapon_idx()];
|
Weapon* weapon = &weapons[msg.weapon_idx()];
|
||||||
|
int weapon_id = weapon->weapon_id;
|
||||||
if (weapon->weapon_id != 0) {
|
if (weapon->weapon_id != 0) {
|
||||||
if (weapon->weapon_idx == 0) {
|
if (weapon->weapon_idx == 0) {
|
||||||
if (weapon->weapon_id != default_weapon.weapon_id) {
|
if (weapon->weapon_id != default_weapon.weapon_id) {
|
||||||
@ -385,6 +387,30 @@ void Player::_CMDropItem(f8::MsgHdr& hdr, const cs::CMDropItem& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (drop_ok) {
|
if (drop_ok) {
|
||||||
|
#if 1
|
||||||
|
{
|
||||||
|
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(weapon_id);
|
||||||
|
if (equip_meta) {
|
||||||
|
Loot* entity = new Loot();
|
||||||
|
entity->room = room;
|
||||||
|
entity->meta = equip_meta;
|
||||||
|
entity->entity_uniid = room->AllocUniid();
|
||||||
|
{
|
||||||
|
Vector2D dir = Vector2D::UP;
|
||||||
|
dir.Rotate(a8::RandAngle());
|
||||||
|
entity->pos = pos + dir * (5 + rand() % 50);
|
||||||
|
}
|
||||||
|
entity->item_id = weapon_id;
|
||||||
|
entity->count = 1;
|
||||||
|
entity->Initialize();
|
||||||
|
room->uniid_hash_[entity->entity_uniid] = entity;
|
||||||
|
for (auto& pair : room->human_hash_) {
|
||||||
|
pair.second->new_objects.insert(entity);
|
||||||
|
pair.second->part_objects.insert(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
for (auto& pair : room->human_hash_) {
|
for (auto& pair : room->human_hash_) {
|
||||||
pair.second->new_objects.insert(this);
|
pair.second->new_objects.insert(this);
|
||||||
}
|
}
|
||||||
@ -423,6 +449,11 @@ void Player::_CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg)
|
|||||||
void Player::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
|
void Player::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
|
||||||
{
|
{
|
||||||
player_data->set_has_action(false);
|
player_data->set_has_action(false);
|
||||||
|
player_data->set_cur_weapon_idx(curr_weapon->weapon_idx);
|
||||||
|
for (auto& weapon : weapons) {
|
||||||
|
auto p = player_data->add_weapons();
|
||||||
|
weapon.ToPB(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::FillMFGasData(cs::MFGasData* gas_data)
|
void Player::FillMFGasData(cs::MFGasData* gas_data)
|
||||||
|
@ -479,7 +479,9 @@ void Room::UpdateGas()
|
|||||||
gas_data.pos_old = gas_data.pos_old_bk + dir * distance;
|
gas_data.pos_old = gas_data.pos_old_bk + dir * distance;
|
||||||
}
|
}
|
||||||
if (gas_data.rad_old - distance <= gas_data.rad_new) {
|
if (gas_data.rad_old - distance <= gas_data.rad_new) {
|
||||||
|
#if 0
|
||||||
assert(gas_data.pos_new == gas_data.pos_old);
|
assert(gas_data.pos_new == gas_data.pos_old);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (std::abs(gas_data.gas_progress - gas_data.rad_new) <= 0.001f) {
|
if (std::abs(gas_data.gas_progress - gas_data.rad_new) <= 0.001f) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user