This commit is contained in:
aozhiwei 2019-07-11 09:34:28 +08:00
parent d84652ec93
commit 721fa5ffd5
2 changed files with 8 additions and 52 deletions

View File

@ -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:

View File

@ -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();
}