@@ -40,20 +40,23 @@ void function StimPlayer( entity player, float duration, float severity = STIM_E
40
40
41
41
void function StimPlayer_Internal( entity player, float duration, float effectSeverity )
42
42
{
43
- int endlessStatusEffectHandle = 0
43
+ // Handles for tracking status effects
44
+ int statusEffectHandle_SpeedBoost = 0
45
+ int statusEffectHandle_StimVFX = 0
44
46
if ( duration == USE_TIME_INFINITE )
45
47
{
46
- endlessStatusEffectHandle = StatusEffect_AddEndless( player, eStatusEffect.speed_boost, effectSeverity )
48
+ statusEffectHandle_SpeedBoost = StatusEffect_AddEndless( player, eStatusEffect.speed_boost, effectSeverity )
49
+ statusEffectHandle_StimVFX = StatusEffect_AddEndless( player, eStatusEffect.stim_visual_effect, 1.0 )
47
50
}
48
51
else
49
52
{
50
- StatusEffect_AddTimed( player, eStatusEffect.speed_boost, effectSeverity, duration + 0.5, 0.25 ) // sound is slightly off
51
- StatusEffect_AddTimed( player, eStatusEffect.stim_visual_effect, 1.0, duration, duration )
53
+ statusEffectHandle_SpeedBoost = StatusEffect_AddTimed( player, eStatusEffect.speed_boost, effectSeverity, duration + 0.5, 0.25 ) // sound is slightly off
54
+ statusEffectHandle_StimVFX = StatusEffect_AddTimed( player, eStatusEffect.stim_visual_effect, 1.0, duration, duration )
52
55
}
53
56
54
57
#if SERVER
55
- thread StimThink( player, duration, endlessStatusEffectHandle )
56
- #else
58
+ thread StimThink( player, duration, statusEffectHandle_SpeedBoost, statusEffectHandle_StimVFX )
59
+ #else // CLIENT
57
60
entity cockpit = player.GetCockpit()
58
61
if ( !IsValid( cockpit ) )
59
62
return
@@ -63,15 +66,25 @@ void function StimPlayer_Internal( entity player, float duration, float effectSe
63
66
}
64
67
65
68
#if SERVER
66
- void function StimThink( entity player, float duration, int endlessStatusEffectHandle )
69
+ void function StimThink( entity player, float duration, int statusEffectHandle_SpeedBoost, int statusEffectHandle_StimVFX )
67
70
{
68
71
player.EndSignal( "OnDeath" )
69
72
player.EndSignal( "OnChangedPlayerClass" )
70
- if ( endlessStatusEffectHandle != 0 )
71
- player.EndSignal( "StopEndlessStim" )
73
+ player.EndSignal( "player_embarks_titan" ) // Prevent transferring active Stim ability to Titan.
72
74
73
- EmitSoundOnEntityOnlyToPlayer( player, player, "pilot_stimpack_loop_1P" )
74
- EmitSoundOnEntityExceptToPlayer( player, player, "pilot_stimpack_loop_3P" )
75
+ if ( duration == USE_TIME_INFINITE )
76
+ {
77
+ player.EndSignal( "StopEndlessStim" )
78
+ // TF|2 stim loop sounds don't actually loop, use TF|1 loop sound.
79
+ // 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?
80
+ // BUG: It still stops playing sometimes for whatever reason ( Too many sounds? )
81
+ EmitSoundOnEntity( player, "Pilot_Stimpack_Loop" )
82
+ }
83
+ else
84
+ {
85
+ EmitSoundOnEntityOnlyToPlayer( player, player, "pilot_stimpack_loop_1P" )
86
+ EmitSoundOnEntityExceptToPlayer( player, player, "pilot_stimpack_loop_3P" )
87
+ }
75
88
76
89
int attachmentIndex = player.LookupAttachment( "CHESTFOCUS" )
77
90
@@ -82,19 +95,29 @@ void function StimThink( entity player, float duration, int endlessStatusEffectH
82
95
//thread StimSlowmoAim( player, duration )
83
96
84
97
OnThreadEnd(
85
- function() : ( player, stimFX, endlessStatusEffectHandle )
98
+ function() : ( player, duration, stimFX, statusEffectHandle_SpeedBoost, statusEffectHandle_StimVFX )
86
99
{
87
100
if ( !IsValid( player ) )
88
101
return
89
102
90
103
if ( IsValid( stimFX ) )
91
104
EffectStop( stimFX )
92
105
93
- StopSoundOnEntity( player, "pilot_stimpack_loop_1P" )
94
- StopSoundOnEntity( player, "pilot_stimpack_loop_3P" )
95
-
96
- if ( endlessStatusEffectHandle != 0 )
97
- StatusEffect_Stop( player, endlessStatusEffectHandle )
106
+ if ( duration == USE_TIME_INFINITE )
107
+ {
108
+ StopSoundOnEntity( player, "Pilot_Stimpack_Loop" )
109
+ }
110
+ else
111
+ {
112
+ StopSoundOnEntity( player, "pilot_stimpack_loop_1P" )
113
+ StopSoundOnEntity( player, "pilot_stimpack_loop_3P" )
114
+ }
115
+
116
+ if ( statusEffectHandle_SpeedBoost != 0 )
117
+ StatusEffect_Stop( player, statusEffectHandle_SpeedBoost )
118
+
119
+ if ( statusEffectHandle_StimVFX != 0 )
120
+ StatusEffect_Stop( player, statusEffectHandle_StimVFX )
98
121
99
122
player.Signal( "EndStim" )
100
123
}
@@ -111,7 +134,7 @@ void function StimThink( entity player, float duration, int endlessStatusEffectH
111
134
wait 2.0
112
135
}
113
136
114
- #else // #if SERVER
137
+ #else // CLIENT
115
138
void function StimVisualsEnabled( entity ent, int statusEffect, bool actuallyChanged )
116
139
{
117
140
if ( ent != GetLocalViewPlayer() )
@@ -164,4 +187,4 @@ void function StimScreenFXThink( entity player, int fxHandle, entity cockpit )
164
187
}
165
188
}
166
189
167
- #endif // #else // #if SERVER
190
+ #endif
0 commit comments