diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 4c8c6a8..b995487 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1384,6 +1384,34 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance) SyncAroundPlayers(__FILE__, __LINE__, __func__); } break; + case IS_C4: + case IS_SHIELD_WALL: + case IS_SINGAL_GUN: + case IS_OIL_BUCKET: + { + if (GetCurrWeapon()->ammo <= 0) { + if (GetInventory(slot_id) > 0) { + DecInventory(slot_id, 1); + ++GetCurrWeapon()->ammo; + } else { + int weapon_idx = GetCurrWeapon()->weapon_idx; + *GetCurrWeapon() = Weapon(); + GetCurrWeapon()->weapon_idx = weapon_idx; + Weapon* next_weapon = ChooseNextWeapon(slot_id, SPEC3_IS_BEGIN, SPEC3_IS_END); + if (!next_weapon) { + next_weapon = ChooseNextWeapon(SPEC1_IS_BEGIN, SPEC1_IS_BEGIN, SPEC1_IS_END); + } + if (!next_weapon) { + next_weapon = AutoChgWeapon(); + } + SetCurrWeapon(next_weapon); + AutoLoadingBullet(); + } + } + need_sync_active_player = true; + SyncAroundPlayers(__FILE__, __LINE__, __func__); + } + break; default: { }