1
This commit is contained in:
parent
693d189c08
commit
88a7117a5f
@ -404,95 +404,9 @@ void Player::Shot()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Shot();
|
bool shot_ok = false;
|
||||||
if (!curr_weapon->meta) {
|
a8::Vec2 target_dir = attack_dir;
|
||||||
return;
|
Creature::Shot(target_dir, shot_ok, fly_distance);
|
||||||
}
|
|
||||||
|
|
||||||
if (curr_weapon->weapon_idx != 0 &&
|
|
||||||
curr_weapon->ammo <= 0) {
|
|
||||||
AutoLoadingBullet();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action_type == AT_Reload) {
|
|
||||||
CancelAction();
|
|
||||||
}
|
|
||||||
if (action_type == AT_Reload ||
|
|
||||||
action_type == AT_Rescue ||
|
|
||||||
action_type == AT_UseItem ||
|
|
||||||
action_type == AT_Relive) {
|
|
||||||
CancelAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
InternalShot(this,
|
|
||||||
curr_weapon->meta,
|
|
||||||
curr_weapon->GetUpgradeMeta(),
|
|
||||||
curr_weapon->bullet_meta,
|
|
||||||
curr_weapon->weapon_lv,
|
|
||||||
0,
|
|
||||||
fly_distance,
|
|
||||||
false);
|
|
||||||
|
|
||||||
if (curr_weapon->weapon_idx != 0) {
|
|
||||||
--curr_weapon->ammo;
|
|
||||||
}
|
|
||||||
int slot_id = curr_weapon->meta->i->_inventory_slot();
|
|
||||||
//扔完手雷,如无手雷,则优先换武器1>武器2
|
|
||||||
switch (slot_id) {
|
|
||||||
case IS_FRAG:
|
|
||||||
{
|
|
||||||
//手雷
|
|
||||||
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 {
|
|
||||||
AutoChgWeapon();
|
|
||||||
}
|
|
||||||
AutoLoadingBullet();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
need_sync_active_player = true;
|
|
||||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IS_SMOKE:
|
|
||||||
{
|
|
||||||
//烟雾弹
|
|
||||||
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 {
|
|
||||||
AutoChgWeapon();
|
|
||||||
}
|
|
||||||
AutoLoadingBullet();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
need_sync_active_player = true;
|
|
||||||
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (curr_weapon->weapon_idx != 0 &&
|
|
||||||
curr_weapon->ammo <= 0) {
|
|
||||||
AutoLoadingBullet();
|
|
||||||
}
|
|
||||||
last_shot_frameno_ = room->GetFrameNo();
|
|
||||||
room->frame_event.AddWeaponAmmoChg(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::ProcInteraction()
|
void Player::ProcInteraction()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user