aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom
diff options
context:
space:
mode:
authorGazyi <Gazyi@users.noreply.github.com>2024-11-27 12:57:11 +0300
committerGitHub <noreply@github.com>2024-11-27 10:57:11 +0100
commitc3c2535cc4142dd8871cdeeafc31d588b4e642ee (patch)
tree92ea1945a46f04429c45b12ae54a491c68b92543 /Northstar.Custom
parent49791ea2edeb7192ef1d4d4659c485040b8da776 (diff)
downloadNorthstarMods-c3c2535cc4142dd8871cdeeafc31d588b4e642ee.tar.gz
NorthstarMods-c3c2535cc4142dd8871cdeeafc31d588b4e642ee.zip
Fix transferring active Stim ability to Titan and endless stim effects (#864)HEADv1.29.1-rc1main
Fix endless Stim ability not playing loop sound and visual effects. Fix transferring active Pilot Stim ability to Titan when embarking it. Fix transferring active timed Stim ability to Titan.
Diffstat (limited to 'Northstar.Custom')
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/weapons/sh_stim.gnut61
1 files changed, 42 insertions, 19 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/weapons/sh_stim.gnut b/Northstar.Custom/mod/scripts/vscripts/weapons/sh_stim.gnut
index 50e030ee..fd819626 100644
--- a/Northstar.Custom/mod/scripts/vscripts/weapons/sh_stim.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/weapons/sh_stim.gnut
@@ -40,20 +40,23 @@ void function StimPlayer( entity player, float duration, float severity = STIM_E
void function StimPlayer_Internal( entity player, float duration, float effectSeverity )
{
- int endlessStatusEffectHandle = 0
+ // Handles for tracking status effects
+ int statusEffectHandle_SpeedBoost = 0
+ int statusEffectHandle_StimVFX = 0
if ( duration == USE_TIME_INFINITE )
{
- endlessStatusEffectHandle = StatusEffect_AddEndless( player, eStatusEffect.speed_boost, effectSeverity )
+ statusEffectHandle_SpeedBoost = StatusEffect_AddEndless( player, eStatusEffect.speed_boost, effectSeverity )
+ statusEffectHandle_StimVFX = StatusEffect_AddEndless( player, eStatusEffect.stim_visual_effect, 1.0 )
}
else
{
- StatusEffect_AddTimed( player, eStatusEffect.speed_boost, effectSeverity, duration + 0.5, 0.25 ) // sound is slightly off
- StatusEffect_AddTimed( player, eStatusEffect.stim_visual_effect, 1.0, duration, duration )
+ statusEffectHandle_SpeedBoost = StatusEffect_AddTimed( player, eStatusEffect.speed_boost, effectSeverity, duration + 0.5, 0.25 ) // sound is slightly off
+ statusEffectHandle_StimVFX = StatusEffect_AddTimed( player, eStatusEffect.stim_visual_effect, 1.0, duration, duration )
}
#if SERVER
- thread StimThink( player, duration, endlessStatusEffectHandle )
-#else
+ thread StimThink( player, duration, statusEffectHandle_SpeedBoost, statusEffectHandle_StimVFX )
+#else // CLIENT
entity cockpit = player.GetCockpit()
if ( !IsValid( cockpit ) )
return
@@ -63,15 +66,25 @@ void function StimPlayer_Internal( entity player, float duration, float effectSe
}
#if SERVER
-void function StimThink( entity player, float duration, int endlessStatusEffectHandle )
+void function StimThink( entity player, float duration, int statusEffectHandle_SpeedBoost, int statusEffectHandle_StimVFX )
{
player.EndSignal( "OnDeath" )
player.EndSignal( "OnChangedPlayerClass" )
- if ( endlessStatusEffectHandle != 0 )
- player.EndSignal( "StopEndlessStim" )
+ player.EndSignal( "player_embarks_titan" ) // Prevent transferring active Stim ability to Titan.
- EmitSoundOnEntityOnlyToPlayer( player, player, "pilot_stimpack_loop_1P" )
- EmitSoundOnEntityExceptToPlayer( player, player, "pilot_stimpack_loop_3P" )
+ if ( duration == USE_TIME_INFINITE )
+ {
+ player.EndSignal( "StopEndlessStim" )
+ // TF|2 stim loop sounds don't actually loop, use TF|1 loop sound.
+ // TF|1 sound is very quiet, is there a way to boost its volume (it has 300% volume in TF|1), except playing 3 sounds at once?
+ // BUG: It still stops playing sometimes for whatever reason ( Too many sounds? )
+ EmitSoundOnEntity( player, "Pilot_Stimpack_Loop" )
+ }
+ else
+ {
+ EmitSoundOnEntityOnlyToPlayer( player, player, "pilot_stimpack_loop_1P" )
+ EmitSoundOnEntityExceptToPlayer( player, player, "pilot_stimpack_loop_3P" )
+ }
int attachmentIndex = player.LookupAttachment( "CHESTFOCUS" )
@@ -82,7 +95,7 @@ void function StimThink( entity player, float duration, int endlessStatusEffectH
//thread StimSlowmoAim( player, duration )
OnThreadEnd(
- function() : ( player, stimFX, endlessStatusEffectHandle )
+ function() : ( player, duration, stimFX, statusEffectHandle_SpeedBoost, statusEffectHandle_StimVFX )
{
if ( !IsValid( player ) )
return
@@ -90,11 +103,21 @@ void function StimThink( entity player, float duration, int endlessStatusEffectH
if ( IsValid( stimFX ) )
EffectStop( stimFX )
- StopSoundOnEntity( player, "pilot_stimpack_loop_1P" )
- StopSoundOnEntity( player, "pilot_stimpack_loop_3P" )
-
- if ( endlessStatusEffectHandle != 0 )
- StatusEffect_Stop( player, endlessStatusEffectHandle )
+ if ( duration == USE_TIME_INFINITE )
+ {
+ StopSoundOnEntity( player, "Pilot_Stimpack_Loop" )
+ }
+ else
+ {
+ StopSoundOnEntity( player, "pilot_stimpack_loop_1P" )
+ StopSoundOnEntity( player, "pilot_stimpack_loop_3P" )
+ }
+
+ if ( statusEffectHandle_SpeedBoost != 0 )
+ StatusEffect_Stop( player, statusEffectHandle_SpeedBoost )
+
+ if ( statusEffectHandle_StimVFX != 0 )
+ StatusEffect_Stop( player, statusEffectHandle_StimVFX )
player.Signal( "EndStim" )
}
@@ -111,7 +134,7 @@ void function StimThink( entity player, float duration, int endlessStatusEffectH
wait 2.0
}
-#else // #if SERVER
+#else // CLIENT
void function StimVisualsEnabled( entity ent, int statusEffect, bool actuallyChanged )
{
if ( ent != GetLocalViewPlayer() )
@@ -164,4 +187,4 @@ void function StimScreenFXThink( entity player, int fxHandle, entity cockpit )
}
}
-#endif // #else // #if SERVER
+#endif \ No newline at end of file