diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-15 00:41:45 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-15 00:41:45 +0000 |
commit | 3f7c13c0df67d1e80ffafa65f9fb6d87c38f4653 (patch) | |
tree | 86c154287f2fa858a2f9a07e7c49fec08a555c9d /Northstar.Custom/mod/scripts/vscripts/weapons | |
parent | 4f53db798e049fd55219a6a3ec3157568cac6828 (diff) | |
parent | 9d346f8c96cbfad841c82eaefa437015c9bf4ce4 (diff) | |
download | NorthstarMods-3f7c13c0df67d1e80ffafa65f9fb6d87c38f4653.tar.gz NorthstarMods-3f7c13c0df67d1e80ffafa65f9fb6d87c38f4653.zip |
Merge branch 'main' of https://github.com/R2Northstar/NorthstarMods
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/weapons')
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/weapons/mp_weapon_peacekraber.nut | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/weapons/mp_weapon_peacekraber.nut b/Northstar.Custom/mod/scripts/vscripts/weapons/mp_weapon_peacekraber.nut index a9da541f..b910cff3 100644 --- a/Northstar.Custom/mod/scripts/vscripts/weapons/mp_weapon_peacekraber.nut +++ b/Northstar.Custom/mod/scripts/vscripts/weapons/mp_weapon_peacekraber.nut @@ -5,6 +5,7 @@ untyped global function OnWeaponPrimaryAttack_peacekraber; global function OnWeaponDeactivate_peacekraber global function OnWeaponActivate_peacekraber +global function OnWeaponOwnerChanged_weapon_peacekraber #if SERVER global function OnWeaponNpcPrimaryAttack_peacekraber @@ -47,8 +48,19 @@ void function OnWeaponActivate_peacekraber (entity weapon) { void function OnWeaponDeactivate_peacekraber (entity weapon) { #if CLIENT + if (!IsValid( weapon.GetWeaponOwner() )) return if (!weapon.GetWeaponOwner().IsPlayer() || weapon.GetWeaponOwner() != GetLocalViewPlayer()) return; - isWeaponActive = false; + isWeaponActive = false + #endif +} + +void function OnWeaponOwnerChanged_weapon_peacekraber (entity weapon, WeaponOwnerChangedParams changeParams) +{ + #if CLIENT + if (changeParams.oldOwner == GetLocalViewPlayer()) + { + isWeaponActive = false + } #endif } #if CLIENT @@ -60,7 +72,11 @@ void function CrosshairCycle() { int chargeLevel; float chargeFrac; while (isWeaponActive) { - WaitFrame() + if (!IsValid( clientWeapon )) + { + isWeaponActive = false + continue + } chargeLevel = clientWeapon.GetWeaponChargeLevel(); chargeFrac = clientWeapon.GetWeaponChargeFraction(); RuiSetFloat3(rui, "teamColor", colors[chargeLevel]); @@ -89,6 +105,7 @@ void function CrosshairCycle() { default: break; } + WaitFrame() } RuiDestroy(rui); @@ -159,4 +176,4 @@ function FireWeaponPlayerAndNPC( WeaponPrimaryAttackParams attackParams, bool pl } return 1 -}
\ No newline at end of file +} |