From 721fa5ffd5502d1dbdd9b60e7cc04e4d31fd9f55 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 11 Jul 2019 09:34:28 +0800 Subject: [PATCH] 1 --- server/gameserver/human.cc | 9 ++++++- server/gameserver/player.cc | 51 ------------------------------------- 2 files changed, 8 insertions(+), 52 deletions(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 981abbf..85d29a4 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -199,6 +199,10 @@ void Human::Shot(a8::Vec2& target_dir) return; } + if (action_type == AT_Reload) { + CancelAction(); + } + #if 1 float fly_distance = 5; #endif @@ -231,6 +235,9 @@ void Human::Shot(a8::Vec2& target_dir) room->CreateBullet(this, curr_weapon, bullet_born_pos, attack_dir, fly_distance); } --curr_weapon->ammo; + if (curr_weapon->ammo <= 0) { + AutoLoadingBullet(); + } last_shot_frameno_ = room->frame_no; need_sync_active_player = true; } @@ -1714,7 +1721,7 @@ void Human::ProcSkillPhase(MetaData::SkillPhase* phase) switch (phase->func_id) { case Skill_Jump: { - + pos = skill_target_pos; } break; case Skill_Shot: diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index b9a0132..3fadbab 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -297,57 +297,6 @@ void Player::Shot() return; } --curr_weapon->ammo; - #if 0 - int slot_id = curr_weapon->meta->i->_inventory_slot(); - switch (slot_id) { - case 5: - { - //手雷 - if (curr_weapon->ammo <= 0) { - if (GetInventory(slot_id) > 0) { - DecInventory(slot_id, 1); - ++curr_weapon->ammo; - } else { - int weapon_idx = curr_weapon->weapon_idx; - *curr_weapon = Weapon(); - curr_weapon->weapon_idx = weapon_idx; - if (weapons[SMOKE_SLOT].weapon_id != 0) { - curr_weapon = &weapons[SMOKE_SLOT]; - } else { - curr_weapon = &weapons[0]; - } - AutoLoadingBullet(); - } - } - need_sync_active_player = true; - SyncAroundPlayers(); - } - break; - case 6: - { - //烟雾弹 - if (curr_weapon->ammo <= 0) { - if (GetInventory(slot_id) > 0) { - DecInventory(slot_id, 1); - ++curr_weapon->ammo; - } else { - int weapon_idx = curr_weapon->weapon_idx; - *curr_weapon = Weapon(); - curr_weapon->weapon_idx = weapon_idx; - if (weapons[FRAG_SLOT].weapon_id != 0) { - curr_weapon = &weapons[FRAG_SLOT]; - } else { - curr_weapon = &weapons[0]; - } - AutoLoadingBullet(); - } - } - need_sync_active_player = true; - SyncAroundPlayers(); - } - break; - } - #endif if (curr_weapon->ammo <= 0) { AutoLoadingBullet(); }