NeotokyoRevamp / neo

This project has moved to: https://github.com/NeotokyoRebuild/neo
Other
30 stars 13 forks source link

Unable to restock grenade slot items from console after exhausting ammo #46

Open Rainyan opened 4 years ago

Rainyan commented 4 years ago

Players should be able to re-stock grenades with console commands "give weapon_grenade/smokegrenade/remotedet".

Rainyan commented 4 years ago

Possibly related to #35.

brekiy commented 3 years ago

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.

https://developer.valvesoftware.com/wiki/Weapon_script

AdamTadeusz commented 1 year ago

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

AdamTadeusz commented 11 months ago

I stuck the following into basecombatweapon_shared.cpp in the first if statement of ReloadOrSwitchWeapons(void)

ifndef CLIENT_DLL

    // If weapon is exhaustible, delete the weapon
    if ((GetWeaponFlags() & ITEM_FLAG_EXHAUSTIBLE) == true) {
        UTIL_Remove(this);
    }

endif // !CLIENT_DLL

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.

AdamTadeusz commented 11 months ago

Fixed in #66