-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhookNade.uc
53 lines (41 loc) · 1.63 KB
/
hookNade.uc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Author : Shtoyan
* Home Repo : https://github.com/InsultingPros/KFPatcher
* License : https://www.gnu.org/licenses/gpl-3.0.en.html
*/
class hookNade extends Nade;
// https://github.com/InsultingPros/KillingFloor/blob/main/KFMod/Classes/Nade.uc#L48
// EXPERIMENTAL!! NOT IN A USE!!!
// fixes nade crashes, but obviously we can't use this :yoba:
function TakeDamage( int Damage, Pawn InstigatedBy, Vector Hitlocation, Vector Momentum, class<DamageType> damageType, optional int HitIndex){}
// https://github.com/InsultingPros/KillingFloor/blob/main/KFMod/Classes/Nade.uc#L79
// fix sound ref none log spam
simulated function Explode(vector HitLocation, vector HitNormal)
{
local PlayerController LocalPlayer;
local Projectile P;
local byte i;
bHasExploded = true;
BlowUp(HitLocation);
// null reference fix
if (ExplodeSounds.length > 0)
PlaySound(ExplodeSounds[rand(ExplodeSounds.length)],,2.0);
// Shrapnel
for (i = Rand(6); i < 10; i++)
{
P = Spawn(ShrapnelClass,,,,RotRand(true));
if (P != none)
P.RemoteRole = ROLE_None;
}
if (EffectIsRelevant(Location, false))
{
Spawn(class'KFmod.KFNadeExplosion',,, HitLocation, rotator(vect(0,0,1)));
Spawn(ExplosionDecal,self,,HitLocation, rotator(-HitNormal));
}
// Shake nearby players screens
LocalPlayer = Level.GetLocalPlayerController();
if ( (LocalPlayer != none) && (VSize(Location - LocalPlayer.ViewTarget.Location) < (DamageRadius * 1.5)) )
LocalPlayer.ShakeView(RotMag, RotRate, RotTime, OffsetMag, OffsetRate, OffsetTime);
Destroy();
}
defaultproperties{}