Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AURA energy regeneration feature should take into account player might be in Observer or Dead... #117

Open
N7P0L3ON opened this issue Nov 14, 2024 · 3 comments
Assignees
Labels
Bug Something isn't working Feature Request New feature or request Fix Proposed Good First Issue Good for newcomers
Milestone

Comments

@N7P0L3ON
Copy link

N7P0L3ON commented Nov 14, 2024

I was looking ta the code for the energy regeneration you have in Aura and I noticed few flaws...

  1. First the regeneration is too fast...
  2. The sound for the regen it a bit too annoying...
  3. The regen sound and all the sounds in general are not taking into account that the player might be dead or in Observer...

I will suggest the solutions to those here:

For 1: the solution is quite simple, increase the time for regen to say 0.5 / 0.3 secs.

For 2: Add a client CVAR to disable the sound or tone the sounds down more...

For 3: You should add some checks and few additional stops for the sounds.
Let's start with the checks:

right after the statements: if (pev->armorvalue <= 0) , if (pev->armorvalue < 10) and if (sv_aura_regeneration.value != 0 && pev->armorvalue < MAX_NORMAL_BATTERY && m_flNextSuitRegenTime < gpGlobals->time)

add this:

		// only do this if we're NOT: In observer or dead...
		if ( IsObserver() || !IsAlive() )
		{
			return;
		}

The we need to add the stop for the sounds if we die or we get to Spectator/Observer:

In the functions: void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) and void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )

add this:

	// make sure to stop the energy regen sounds on kill or observer enter...
	if (sv_aura_regeneration.value != 0 )
	{
		STOP_SOUND(ENT(pev), CHAN_STATIC, "items/suitcharge1.wav");
		STOP_SOUND(ENT(pev), CHAN_AUTO, "player/shield_empty.wav");
		STOP_SOUND(ENT(pev), CHAN_STATIC, "items/suitcharge_no_lp.wav");
		STOP_SOUND(ENT(pev), CHAN_STATIC, "player/shield_charge.wav");
		STOP_SOUND(ENT(pev), CHAN_AUTO, "player/shield_low.wav");

		isShieldLow = false;
		m_fRegenOn = false;
	}

And this should fix the issues... IF you have other functions like welcome camera etc you'll have to take that one into account as well.

More clean way would be to create a function to stop those sounds and to call it instead, but it's up to use to decide.

@sabianroberts sabianroberts self-assigned this Nov 14, 2024
@sabianroberts sabianroberts added Bug Something isn't working Feature Request New feature or request Good First Issue Good for newcomers Fix Proposed labels Nov 14, 2024
@sabianroberts sabianroberts added this to the 2.9.1 milestone Nov 14, 2024
@sabianroberts
Copy link
Member

Hello @N7P0L3ON, thanks for the suggestions and for proposing a fix.

  1. The shield regeneration's purpose is to be rapid whilst the player is taking cover during combat, and to balance we've tried to make the wait before the shield starts regenerating as long as possible (it currently stands at 5.5 seconds). m_flNextSuitRegenTime = gpGlobals->time + 5.5 + sv_aura_regeneration_wait.value;
  2. Since cl_music_enabled has already been implemented, cl_aura_regeneration_sound_enabled or something like that won't be too hard to implement so thanks for the suggestion.
  3. Thanks for proposing this, it will be implemented.

Sabian

@N7P0L3ON
Copy link
Author

Maybe you can make it to count the time out of combat and after that to start regenerating; not to regenerate during combat.

sabianroberts added a commit to phoenixprojectsoftware/Aura-SE that referenced this issue Nov 15, 2024
…nhlmp#117

* more comments to help code-searching.
* stop all shield-regen sounds if the player is spectating or not alive.
* stop regenerating the shield if the player is spectating or not alive.

TODO: apply these changes to the welcome-cam.
Co-Authored-By: Zarko Dinev <[email protected]>
@sabianroberts
Copy link
Member

instead of adding the if statements to each other one, I decided to nest the entire suit energy regeneration code in a single if else statement. I haven't been able to test this in-depth with more than one player but it should work okay, if there's any problems I'll do your proposed method.

phoenixprojectsoftware/Aura-SE@f4712fd#diff-dae8eaadc24decdf403b98675e70a85d9c3d20c0fffc5906a3c1203927275541R4673

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Feature Request New feature or request Fix Proposed Good First Issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants