From 7051354fd59254b51ae6abb3e829d03723845c18 Mon Sep 17 00:00:00 2001 From: EladNLG <44613424+EladNLG@users.noreply.github.com> Date: Wed, 12 Jan 2022 20:09:08 +0200 Subject: Peacekraber Bug fixing + balance update. (#103) * peacekraber fix i have no idea why this works but it does and therefore I do not intend to take into calculation anyone else's opinion on the matter. * Balance update for peacekraber Now requires to hit weak spots to damage a titan. Increased fire rate (1.33 -> 4.0) and rechamber time (0.756 -> 0.924) to make it look more fluid. Increased damage (11 -> 15) to decrease the distance between it and the mastiff (as it is pretty much overall a slower mastiff that reaches further) Increased titan damage (20-15 -> 40-30). * Fix error when respawning after killreplay (PK) * Add OnWeaponOwnerChanged callback * Fixed crosshair persisting after picking up another weapon instead of the peacekraber --- .../vscripts/weapons/mp_weapon_peacekraber.nut | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'Northstar.Custom/mod/scripts/vscripts/weapons') 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 +} -- cgit v1.2.3