aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts
diff options
context:
space:
mode:
authorx3Karma <juliuslimck@gmail.com>2022-01-20 18:07:09 +0800
committerBarichello <artur@barichello.me>2022-01-20 14:58:28 -0300
commit5567438641037b23cb95bf7c6a046eb19e172917 (patch)
tree4a0e1dae28905524ac3f15761ca12a05ea8ec901 /Northstar.CustomServers/mod/scripts/vscripts
parent6b0400269e2709fe97533f1e447084854b7f80b4 (diff)
downloadNorthstarMods-5567438641037b23cb95bf7c6a046eb19e172917.tar.gz
NorthstarMods-5567438641037b23cb95bf7c6a046eb19e172917.zip
Add "MAPHACK DETECTED" on client side and sonars the viewmodel
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/burnmeter/cl_maphack.nut90
1 files changed, 90 insertions, 0 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/burnmeter/cl_maphack.nut b/Northstar.CustomServers/mod/scripts/vscripts/burnmeter/cl_maphack.nut
new file mode 100644
index 00000000..58b408ca
--- /dev/null
+++ b/Northstar.CustomServers/mod/scripts/vscripts/burnmeter/cl_maphack.nut
@@ -0,0 +1,90 @@
+global function ClMapHack_Init
+
+void function ClMapHack_Init()
+{
+ StatusEffect_RegisterEnabledCallback( eStatusEffect.maphack_detected, EntitySonarDetectedEnabled )
+ StatusEffect_RegisterDisabledCallback( eStatusEffect.maphack_detected, EntitySonarDetectedDisabled )
+}
+
+void function EntitySonarDetectedEnabled( entity ent, int statusEffect, bool actuallyChanged )
+{
+ if ( ent == GetLocalViewPlayer() )
+ {
+ // player is already maphack highlighted
+ if ( statusEffect == eStatusEffect.maphack_detected && StatusEffect_Get( ent, eStatusEffect.lockon_detected ) )
+ return
+
+ entity viewModelEntity = ent.GetViewModelEntity()
+ entity firstPersonProxy = ent.GetFirstPersonProxy()
+ entity predictedFirstPersonProxy = ent.GetPredictedFirstPersonProxy()
+
+ vector highlightColor = statusEffect == eStatusEffect.maphack_detected ? HIGHLIGHT_COLOR_ENEMY : <1, 0, 0>
+
+ if ( IsValid( viewModelEntity ) )
+ SonarViewModelHighlight( viewModelEntity, highlightColor )
+
+ if ( IsValid( firstPersonProxy ) )
+ SonarViewModelHighlight( firstPersonProxy, highlightColor )
+
+ if ( IsValid( predictedFirstPersonProxy ) )
+ SonarViewModelHighlight( predictedFirstPersonProxy, highlightColor )
+
+ thread PlayLoopingSonarSound( ent )
+ }
+ else
+ {
+ ClInitHighlight( ent )
+ }
+}
+
+void function EntitySonarDetectedDisabled( entity ent, int statusEffect, bool actuallyChanged )
+{
+ if ( ent == GetLocalViewPlayer() )
+ {
+ // player should have maphack highlighted
+ if ( statusEffect == eStatusEffect.maphack_detected && StatusEffect_Get( ent, eStatusEffect.lockon_detected ) )
+ {
+ return
+ }
+ else if ( statusEffect == eStatusEffect.lockon_detected && StatusEffect_Get( ent, eStatusEffect.maphack_detected ) )
+ {
+ // restore sonar after lockon wears off
+ EntitySonarDetectedEnabled( ent, eStatusEffect.maphack_detected, true )
+ return
+ }
+
+ entity viewModelEntity = ent.GetViewModelEntity()
+ entity firstPersonProxy = ent.GetFirstPersonProxy()
+ entity predictedFirstPersonProxy = ent.GetPredictedFirstPersonProxy()
+
+ if ( IsValid( viewModelEntity ) )
+ SonarViewModelClearHighlight( viewModelEntity )
+
+ if ( IsValid( firstPersonProxy ) )
+ SonarViewModelClearHighlight( firstPersonProxy )
+
+ if ( IsValid( predictedFirstPersonProxy ) )
+ SonarViewModelClearHighlight( predictedFirstPersonProxy )
+
+ ent.Signal( "EntitySonarDetectedDisabled" )
+ }
+ else
+ {
+ ClInitHighlight( ent )
+ }
+}
+
+void function PlayLoopingSonarSound( entity ent )
+{
+ EmitSoundOnEntity( ent, "HUD_MP_EnemySonarTag_Activated_1P" )
+
+ ent.EndSignal( "EntitySonarDetectedDisabled" )
+ ent.EndSignal( "OnDeath" )
+
+ while( true )
+ {
+ wait 1.5
+ EmitSoundOnEntity( ent, "HUD_MP_EnemySonarTag_Flashed_1P" )
+ }
+
+} \ No newline at end of file