KF2-Server-Extension/ServerExt/Classes/ExtProj_SUPERGrenade.uc

96 lines
2.5 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
// Written by Marco.
class ExtProj_SUPERGrenade extends KFProj_FragGrenade
hidedropdown;
/** On Contact demo skill can turn our grenade into an insta boom device */
var bool bExplodeOnContact;
var class<KFProj_Grenade> ClusterNades;
var() byte NumClusters;
simulated function PostBeginPlay()
{
local KFPerk InstigatorPerk;
local KFPawn InstigatorPawn;
InstigatorPawn = KFPawn(Instigator);
2020-11-28 20:12:58 +00:00
if (InstigatorPawn != none)
2017-10-20 02:00:49 +00:00
{
InstigatorPerk = InstigatorPawn.GetPerk();
2020-11-28 20:12:58 +00:00
if (InstigatorPerk != none)
2023-05-14 03:01:17 +00:00
bExplodeOnContact = InstigatorPerk.IsOnContactActive();
2017-10-20 02:00:49 +00:00
}
Super.PostBeginPlay();
2020-11-28 20:12:58 +00:00
if (Instigator!=None && ExtPlayerReplicationInfo(Instigator.PlayerReplicationInfo)!=None && ExtPlayerReplicationInfo(Instigator.PlayerReplicationInfo).ECurrentPerk!=None)
2017-10-20 02:00:49 +00:00
ClusterNades = ExtPlayerReplicationInfo(Instigator.PlayerReplicationInfo).ECurrentPerk.Default.PerkGrenade;
}
simulated function ProcessTouch(Actor Other, Vector HitLocation, Vector HitNormal)
{
2020-11-28 20:12:58 +00:00
if (bExplodeOnContact && Other != Instigator && !Other.bWorldGeometry && Pawn(Other)!=None && Pawn(Other).GetTeamNum() != GetTeamNum())
2017-10-20 02:00:49 +00:00
{
// For opposing team, make the grenade explode instantly
2020-11-28 20:04:55 +00:00
GetExplodeEffectLocation(HitLocation, HitNormal, Other);
TriggerExplosion(HitLocation, HitNormal, Other);
2017-10-20 02:00:49 +00:00
}
2020-11-28 20:04:55 +00:00
else super.ProcessTouch(Other, HitLocation, HitNormal);
2017-10-20 02:00:49 +00:00
}
2020-11-28 20:04:55 +00:00
simulated function Disintegrate(rotator inDisintegrateEffectRotation); // Nope!
2017-10-20 02:00:49 +00:00
simulated function TriggerExplosion(Vector HitLocation, Vector HitNormal, Actor HitActor)
{
local byte i;
local KFProj_Grenade P;
2020-11-28 20:12:58 +00:00
if (bHasExploded)
2017-10-20 02:00:49 +00:00
return;
2020-11-28 20:12:58 +00:00
if (InstigatorController==None && WorldInfo.NetMode!=NM_Client) // Prevent Team-Kill.
2017-10-20 02:00:49 +00:00
{
Destroy();
return;
}
Super.TriggerExplosion(HitLocation,HitNormal,HitActor);
2020-11-28 20:12:58 +00:00
if (WorldInfo.NetMode!=NM_Client)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
for (i=0; i<NumClusters; ++i)
2017-10-20 02:00:49 +00:00
{
P = Spawn(ClusterNades,,,Location);
2020-11-28 20:12:58 +00:00
if (P!=None)
2017-10-20 02:00:49 +00:00
{
P.InstigatorController = InstigatorController;
P.Init(VRand());
}
}
}
bHasExploded = true;
}
simulated function Destroyed()
{
2020-11-28 19:53:57 +00:00
local Actor HitActor;
local vector HitLocation, HitNormal;
2017-10-20 02:00:49 +00:00
// Final Failsafe check for explosion effect
2020-11-28 20:12:58 +00:00
if (!bHasExploded && WorldInfo.NetMode==NM_Client)
2017-10-20 02:00:49 +00:00
{
GetExplodeEffectLocation(HitLocation, HitNormal, HitActor);
2020-11-28 19:53:57 +00:00
TriggerExplosion(HitLocation, HitNormal, HitActor);
2017-10-20 02:00:49 +00:00
}
}
defaultproperties
{
bCanDisintegrate=false
ClusterNades=class'KFProj_FragGrenade'
DrawScale=2
NumClusters=6
ProjFlightTemplate=ParticleSystem'ZED_Hans_EMIT.FX_Grenade_Explosive_01'
Begin Object Name=ExploTemplate0
Damage=500
DamageRadius=1000
End Object
}