Open Rainyan opened 4 years ago
Possibly related to #35.
As far as I can tell, the ITEM_FLAG_EXHAUSTIBLE item flag should fix this, but doesn't seem to be doing anything. Maybe the appropriate behavior needs to be implemented? I can't even restock the base HL2MP grenade.
using "ent_remove_all weapon_grenade" after depleting all grenades allows grenades to be picked up again either by giving them to the player through "give weapon_grenade" or by walking over a grenade placed with "ent_create weapon_grenade", therefore implementing the behaviour from the exhaistible flag will likely fix this issue
I stuck the following into basecombatweapon_shared.cpp in the first if statement of ReloadOrSwitchWeapons(void)
// If weapon is exhaustible, delete the weapon
if ((GetWeaponFlags() & ITEM_FLAG_EXHAUSTIBLE) == true) {
UTIL_Remove(this);
}
UTIL_Remove works on its own, but I'm having trouble picking up the weapon flag is_exhaustible, so doesnt work in this if statement.
Soon as I work out how to do that properly we should have at least a hacky way of deleting a grenade object from the players inventory.
On a side note, the game doesnt switch away from the grenade on empty even though the grenade doesnt have the noautoswitchonempty flag.
Fixed in #66
Players should be able to re-stock grenades with console commands "give weapon_grenade/smokegrenade/remotedet".