Added OnSelect() and OnDeselect() to weapons

This commit is contained in:
jekyllgrim 2025-08-14 02:17:50 +03:00 committed by Ricardo Luís Vaz Silva
commit 977b5acbe1
2 changed files with 6 additions and 0 deletions

View file

@ -143,6 +143,10 @@ class Weapon : StateProvider
}
return -1, 0;
}
virtual void OnSelect() {}
virtual void OnDeselect() {}
virtual State GetReadyState ()
{

View file

@ -1884,6 +1884,7 @@ class PlayerPawn : Actor
if (weapon != null)
{
weapon.OnSelect();
weapon.PlayUpSound(self);
player.refire = 0;
@ -1976,6 +1977,7 @@ class PlayerPawn : Actor
Weapon weap = player.ReadyWeapon;
if ((weap != null) && (player.health > 0 || !weap.bNoDeathDeselect))
{
weap.OnDeselect();
player.SetPsprite(PSP_WEAPON, weap.GetDownState());
}
}