diff options
author | Tristan Kennedy <tristan@taskinoz.com> | 2022-03-27 13:22:11 +1100 |
---|---|---|
committer | Barichello <artur@barichello.me> | 2022-03-28 22:05:49 -0300 |
commit | 6dfe2856e8c4b9c533f0c380abbfd4b6fada3518 (patch) | |
tree | 1db43d2023ec29645b32c71ede069867407d27b4 /Northstar.Custom/mod/scripts/vscripts/weapons/mp_projectile_titanweapon_triple_threat.nut | |
parent | 464825cb304b070fb0d497f47a3e8a8d831d5248 (diff) | |
download | NorthstarMods-6dfe2856e8c4b9c533f0c380abbfd4b6fada3518.tar.gz NorthstarMods-6dfe2856e8c4b9c533f0c380abbfd4b6fada3518.zip |
Restored Triple Threat Titan gun
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/weapons/mp_projectile_titanweapon_triple_threat.nut')
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/weapons/mp_projectile_titanweapon_triple_threat.nut | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/weapons/mp_projectile_titanweapon_triple_threat.nut b/Northstar.Custom/mod/scripts/vscripts/weapons/mp_projectile_titanweapon_triple_threat.nut new file mode 100644 index 000000000..afdb6961e --- /dev/null +++ b/Northstar.Custom/mod/scripts/vscripts/weapons/mp_projectile_titanweapon_triple_threat.nut @@ -0,0 +1,85 @@ +untyped + + +global function OnProjectileCollision_titanweapon_triple_threat + + +void function OnProjectileCollision_titanweapon_triple_threat( entity projectile, vector pos, vector normal, entity hitEnt, int hitbox, bool isCritical ) +{ + if( !IsValid( hitEnt ) ) + return + + if( "impactFuse" in projectile.s && projectile.s.impactFuse == true ) + projectile.GrenadeExplode( Vector( 0,0,0 ) ) + + if( hitEnt.GetClassName() == "player" && !hitEnt.IsTitan() ) + return + + if( !IsValid( projectile ) ) + return + + if( IsMagneticTarget( hitEnt ) ) + { + if( hitEnt.GetTeam() != projectile.GetTeam() ) + { + local normal = Vector( 0, 0, 1 ) + if( "collisionNormal" in projectile.s ) + normal = projectile.s.collisionNormal + projectile.GrenadeExplode( normal ) + } + } + else if( "becomeProxMine" in projectile.s && projectile.s.becomeProxMine == true ) + { + table collisionParams = + { + pos = pos, + normal = normal, + hitEnt = hitEnt, + hitbox = hitbox + } + + PlantStickyEntity( projectile, collisionParams ) + projectile.s.collisionNormal <- normal + #if SERVER + thread TripleThreatProximityTrigger( projectile ) + #endif + } + +} + +#if SERVER +function TripleThreatProximityTrigger( entity nade ) +{ + //Hack, shouldn't be necessary with the IsValid check in OnProjectileCollision. + if( !IsValid( nade ) ) + return + + nade.EndSignal( "OnDestroy" ) + EmitSoundOnEntity( nade, "Wpn_TripleThreat_Grenade_MineAttach" ) + + wait TRIPLETHREAT_MINE_FIELD_ACTIVATION_TIME + + EmitSoundOnEntity( nade, "Weapon_Vortex_Gun.ExplosiveWarningBeep" ) + local rangeCheck = PROX_MINE_RANGE + while( 1 ) + { + local origin = nade.GetOrigin() + int team = nade.GetTeam() + + local entityArray = GetScriptManagedEntArrayWithinCenter( level._proximityTargetArrayID, team, origin, PROX_MINE_RANGE ) + foreach( entity ent in entityArray ) + { + if ( TRIPLETHREAT_MINE_FIELD_TITAN_ONLY ) + if ( !ent.IsTitan() ) + continue + + if ( IsAlive( ent ) ) + { + nade.Signal( "ProxMineTrigger" ) + return + } + } + WaitFrame() + } +} +#endif // SERVER |