diff options
author | Respawn <respawn@northstar.tf> | 2023-07-16 23:00:14 +0200 |
---|---|---|
committer | Respawn <respawn@northstar.tf> | 2023-07-16 23:00:14 +0200 |
commit | 0a20aaeda227ab35b18b651dc7325c34588faa8b (patch) | |
tree | ad0279895e319a82120b2d1eb7734d4b7af26878 /Northstar.Custom | |
parent | ef596fb867c91e4772bdc87e51ca7ecafc9217ee (diff) | |
download | NorthstarMods-0a20aaeda227ab35b18b651dc7325c34588faa8b.tar.gz NorthstarMods-0a20aaeda227ab35b18b651dc7325c34588faa8b.zip |
Add mp_titanweapon_arc_cannon.nut from englishclient_mp_common
Diffstat (limited to 'Northstar.Custom')
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/weapons/mp_titanweapon_arc_cannon.nut | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/weapons/mp_titanweapon_arc_cannon.nut b/Northstar.Custom/mod/scripts/vscripts/weapons/mp_titanweapon_arc_cannon.nut new file mode 100644 index 00000000..09faafa5 --- /dev/null +++ b/Northstar.Custom/mod/scripts/vscripts/weapons/mp_titanweapon_arc_cannon.nut @@ -0,0 +1,119 @@ +ArcCannon_PrecacheFX( self ) + +function OnWeaponActivate( activateParams ) +{ + local weaponOwner = self.GetWeaponOwner() + thread DelayedArcCannonStart( self, weaponOwner ) + if( !("weaponOwner" in self.s) ) + self.s.weaponOwner <- weaponOwner +} + +function DelayedArcCannonStart( weapon, weaponOwner ) +{ + weapon.EndSignal( "WeaponDeactivateEvent" ) + + wait 0 + + if ( IsValid( weapon ) && IsValid( weaponOwner ) && weapon == weaponOwner.GetActiveWeapon() ) + { + if( weaponOwner.IsPlayer() ) + { + local modelEnt = weaponOwner.GetViewModelEntity() + if( IsValid( modelEnt ) && EntHasModelSet( modelEnt ) ) + ArcCannon_Start( weapon ) + } + else + { + ArcCannon_Start( weapon ) + } + } +} + +function OnWeaponDeactivate( deactivateParams ) +{ + ArcCannon_ChargeEnd( self, self.s.weaponOwner ) + ArcCannon_Stop( self ) +} + +function OnWeaponReload( reloadParams ) +{ + local reloadTime = self.GetWeaponInfoFileKeyField( "reload_time" ) + thread ArcCannon_HideIdleEffect( self, reloadTime ) //constant seems to help it sync up better +} + +function OnWeaponOwnerChanged( changeParams ) +{ + if ( IsClient() ) + { + local viewPlayer = GetLocalViewPlayer() + if ( changeParams.oldOwner != null && changeParams.oldOwner == viewPlayer ) + { + ArcCannon_ChargeEnd( self, changeParams.oldOwner ) + ArcCannon_Stop( self, changeParams.oldOwner ) + } + if ( changeParams.newOwner != null && changeParams.newOwner == viewPlayer ) + thread ArcCannon_HideIdleEffect( self, 0.25 ) + } + else + { + if ( changeParams.oldOwner != null ) + { + ArcCannon_ChargeEnd( self, changeParams.oldOwner ) + ArcCannon_Stop( self, changeParams.oldOwner ) + } + if ( changeParams.newOwner != null ) + thread ArcCannon_HideIdleEffect( self, 0.25 ) + } +} + +function OnWeaponChargeBegin( chargeParams ) +{ + ArcCannon_ChargeBegin( self ) +} + +function OnWeaponChargeEnd( chargeParams ) +{ + ArcCannon_ChargeEnd( self ) +} + +function OnWeaponPrimaryAttack( attackParams ) +{ + if ( self.HasMod( "capacitor" ) && self.GetWeaponChargeFraction() < GetArcCannonChargeFraction( self ) ) + return 0 + + if ( !attackParams.firstTimePredicted ) + return + + local fireRate = self.GetWeaponInfoFileKeyField( "fire_rate" ) + thread ArcCannon_HideIdleEffect( self, (1 / fireRate) ) + return FireArcCannon( self, attackParams ) +} + +function OnWeaponNpcPrimaryAttack( attackParams ) +{ + local fireRate = self.GetWeaponInfoFileKeyField( "fire_rate" ) + thread ArcCannon_HideIdleEffect( self, fireRate ) + return FireArcCannon( self, attackParams ) +} + +function OnWeaponStartZoomIn() +{ + HandleWeaponSoundZoomIn( self, "Weapon_Titan_ArcCannon.ADS_In" ) +} + +function OnWeaponStartZoomOut() +{ + HandleWeaponSoundZoomOut( self, "Weapon_Titan_ArcCannon.ADS_Out" ) +} + +/* +function OnWeaponPrimaryAttackVMActivityToUse() +{ + local baseCharge = self.GetWeaponChargeFraction() + local charge = clamp ( baseCharge * ( 1 / 0.7 ), 0.0, 1.0 ) + + if ( charge > 0.25 ) + return 1 + else + return 0 +}*/ |