This commit is contained in:
aozhiwei 2023-05-21 08:57:39 +08:00
parent 8d1e9f6284
commit b901e454a7

View File

@ -2830,6 +2830,7 @@ void Human::DropWeapon(int weapon_idx, int num)
weapon_idx >= weapons.size()) {
return;
}
bool is_curr_weapon = weapon_idx == GetCurrWeapon()->weapon_idx;
bool drop_ok = false;
Weapon* weapon = &weapons[weapon_idx];
int weapon_id = weapon->weapon_id;
@ -2991,11 +2992,14 @@ void Human::DropWeapon(int weapon_idx, int num)
weapon_idx == GUN_SLOT0 ||
weapon_idx == GUN_SLOT1 ||
weapon_idx == GUN_SLOT2) {
glm::vec3 dir = GlmHelper::UP;
GlmHelper::RotateY(dir, a8::RandAngle());
Position pos = GetPos();
pos.FromGlmVec3(GetPos().ToGlmVec3() + dir * (40.0f + rand() % 50));
room->CreateLoot(weapon_id, pos.ToGlmVec3(), 1, 1);
int drop_num = 1;
for (int i = 0; i < drop_num; ++i) {
glm::vec3 dir = GlmHelper::UP;
GlmHelper::RotateY(dir, a8::RandAngle());
Position pos = GetPos();
pos.FromGlmVec3(GetPos().ToGlmVec3() + dir * (40.0f + rand() % 50));
room->CreateLoot(weapon_id, pos.ToGlmVec3(), 1, 1);
}
}
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
SyncAroundPlayers(__FILE__, __LINE__, __func__);