1
This commit is contained in:
parent
887454e786
commit
a1e724fea7
@ -4283,11 +4283,54 @@ void Human::ProcAddItemDto(AddItemDTO& dto)
|
|||||||
|
|
||||||
void Human::DropWeapon(int weapon_idx, int num)
|
void Human::DropWeapon(int weapon_idx, int num)
|
||||||
{
|
{
|
||||||
|
num = std::max(1, num);
|
||||||
|
switch (weapon_idx) {
|
||||||
|
case 101:
|
||||||
|
{
|
||||||
|
//医疗包
|
||||||
|
int slot_id = IS_HEALTHKIT;
|
||||||
|
if (GetInventory(slot_id) > 0) {
|
||||||
|
num = std::max(1, GetInventory(slot_id));
|
||||||
|
DecInventory(slot_id, num);
|
||||||
|
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 102:
|
||||||
|
{
|
||||||
|
//止痛药
|
||||||
|
int slot_id = IS_PAIN_KILLER;
|
||||||
|
if (GetInventory(slot_id) > 0) {
|
||||||
|
num = std::max(1, GetInventory(slot_id));
|
||||||
|
DecInventory(slot_id, num);
|
||||||
|
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 103:
|
||||||
|
{
|
||||||
|
//肾上腺速
|
||||||
|
int slot_id = IS_SHEN_BAO;
|
||||||
|
if (GetInventory(slot_id) > 0) {
|
||||||
|
num = std::max(1, GetInventory(slot_id));
|
||||||
|
DecInventory(slot_id, num);
|
||||||
|
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (weapon_idx < 0 ||
|
if (weapon_idx < 0 ||
|
||||||
weapon_idx >= weapons.size()) {
|
weapon_idx >= weapons.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
num = std::max(1, num);
|
|
||||||
bool drop_ok = false;
|
bool drop_ok = false;
|
||||||
Weapon* weapon = &weapons[weapon_idx];
|
Weapon* weapon = &weapons[weapon_idx];
|
||||||
int weapon_id = weapon->weapon_id;
|
int weapon_id = weapon->weapon_id;
|
||||||
|
@ -1090,9 +1090,7 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
|
|||||||
|
|
||||||
void Player::UpdateDropWeapon()
|
void Player::UpdateDropWeapon()
|
||||||
{
|
{
|
||||||
if (drop_weapon_idx >= 0 &&
|
if (!FreezeOperate()) {
|
||||||
drop_weapon_idx < weapons.size() &&
|
|
||||||
!FreezeOperate()) {
|
|
||||||
DropWeapon(drop_weapon_idx, drop_num);
|
DropWeapon(drop_weapon_idx, drop_num);
|
||||||
}
|
}
|
||||||
ResetAction();
|
ResetAction();
|
||||||
|
@ -1040,7 +1040,7 @@ message CMMove
|
|||||||
optional float fly_distance = 7; //子弹飞行距离(只有手雷和烟雾弹时这个字段才有意义)
|
optional float fly_distance = 7; //子弹飞行距离(只有手雷和烟雾弹时这个字段才有意义)
|
||||||
|
|
||||||
optional int32 select_weapon = 8; //切换武器(没切换是不用发)
|
optional int32 select_weapon = 8; //切换武器(没切换是不用发)
|
||||||
optional int32 drop_weapon = 9; //丢弃武器
|
optional int32 drop_weapon = 9; //丢弃武器 101:医疗包 102:止痛药 103:肾上腺速
|
||||||
optional int32 drop_num = 43; //丢弃武器(数量)
|
optional int32 drop_num = 43; //丢弃武器(数量)
|
||||||
|
|
||||||
optional bool cancel_action = 10; //取消当前操作(比如取消使用道具装弹等)
|
optional bool cancel_action = 10; //取消当前操作(比如取消使用道具装弹等)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user