This commit is contained in:
aozhiwei 2023-03-07 15:21:43 +08:00
parent c7c137de9a
commit a4afec4b0c

View File

@ -1608,6 +1608,7 @@ void Human::DeadDrop()
room->DropItem(drop_pos.ToGlmVec3(), equip_meta->id(), drop_num, 1);
}
DecInventory(slot, GetInventory(slot));
SyncVolume(slot);
}
}
break;
@ -1627,6 +1628,7 @@ void Human::DeadDrop()
#endif
}
DecInventory(slot, GetInventory(slot));
SyncVolume(slot);
}
}
break;
@ -2122,12 +2124,14 @@ void Human::ProcReloadAction()
add_num = 1;
}
DecInventory(bullet_meta->_inventory_slot(), add_num);
SyncVolume(bullet_meta->_inventory_slot());
} else {
add_num = p_weapon->GetClipVolume(this) - ammo;
if (p_weapon->meta->reloadtype() == 1) {
add_num = 1;
}
DecInventory(bullet_meta->_inventory_slot(), add_num);
SyncVolume(bullet_meta->_inventory_slot());
}
p_weapon->ammo += add_num;
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
@ -2139,7 +2143,9 @@ void Human::ProcReloadAction()
[this, weapon_idx, weapon_id]
(int event, const a8::Args* args)
{
NextReload(weapon_id, weapon_idx);
if (a8::TIMER_EXEC_EVENT == event) {
NextReload(weapon_id, weapon_idx);
}
},
&xtimer_attacher);
}
@ -2190,6 +2196,7 @@ void Human::ProcUseItemAction()
break;
}
DecInventory(item_meta->_inventory_slot(), 1);
SyncVolume(item_meta->_inventory_slot());
GetTrigger()->UseItemAction(item_meta->_inventory_slot());
}
break;
@ -2255,6 +2262,7 @@ void Human::ProcUseItemAction()
}
}
DecInventory(item_meta->_inventory_slot(), 1);
SyncVolume(item_meta->_inventory_slot());
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
GetTrigger()->UseItemAction(item_meta->_inventory_slot());
}
@ -2289,6 +2297,7 @@ void Human::ProcUseItemAction()
}
}
DecInventory(item_meta->_inventory_slot(), 1);
SyncVolume(item_meta->_inventory_slot());
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
GetTrigger()->UseItemAction(item_meta->_inventory_slot());
}
@ -2736,6 +2745,7 @@ void Human::ProcLootSpecItem(AddItemDTO& dto)
add_num = std::min(dto.count, add_num);
AddInventory(dto.item_meta->_inventory_slot(), add_num);
SyncVolume(dto.item_meta->_inventory_slot());
switch (dto.item_meta->_inventory_slot()) {
case IS_FRAG:
case IS_SMOKE:
@ -3087,6 +3097,7 @@ void Human::DropWeapon(int weapon_idx, int num)
weapon->ammo = std::max(0, weapon->ammo - weapon_ammo);
int slot_id = weapon->meta->_inventory_slot();
DecInventory(slot_id, weapon_ammo);
SyncVolume(slot_id);
if (weapon->ammo <= 0) {
*weapon = Weapon();
weapon->weapon_idx = weapon_idx;
@ -3111,6 +3122,7 @@ void Human::DropWeapon(int weapon_idx, int num)
weapon->ammo = std::max(0, weapon->ammo - weapon_ammo);
int slot_id = weapon->meta->_inventory_slot();
DecInventory(slot_id, weapon_ammo);
SyncVolume(slot_id);
if (weapon->ammo <= 0) {
*weapon = Weapon();
weapon->weapon_idx = weapon_idx;
@ -3135,6 +3147,7 @@ void Human::DropWeapon(int weapon_idx, int num)
weapon->ammo = std::max(0, weapon->ammo - weapon_ammo);
int slot_id = weapon->meta->_inventory_slot();
DecInventory(slot_id, weapon_ammo);
SyncVolume(slot_id);
if (weapon->ammo <= 0) {
*weapon = Weapon();
weapon->weapon_idx = weapon_idx;