Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

WVPersesMAS.PersesArtilleryShell


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
/******************************************************************************
PersesArtilleryShell

Creation date: 2011-08-22 16:32
Last change: $Id$
Copyright © 2011, Wormbo
Website: http://www.koehler-homepage.de/Wormbo/
Feel free to reuse this code. Send me a note if you found it helpful or want
to report bugs/provide improvements.
Please ask for permission first, if you intend to make money off reused code.
******************************************************************************/

class PersesArtilleryShell extends ONSMortarShell;


#exec audio import file=Sounds\ShellBrakingExplode1.wav
#exec audio import file=Sounds\ShellBrakingExplode2.wav
#exec audio import file=Sounds\ShellFragmentExplode1.wav
#exec audio import file=Sounds\ShellFragmentExplode2.wav


var Sound AirExplosionSound;
var class<Projectile> ChildProjectileClass;
var float SpreadFactor;
var Emitter SmokeTrail;


simulated function PostBeginPlay()
{
	if (!PhysicsVolume.bWaterVolume && Level.NetMode != NM_DedicatedServer)
		Trail = Spawn(class'FlakShellTrail', self);

	Super(Projectile).PostBeginPlay();
}

simulated function Timer()
{
	local int i, j;
	local Projectile Child;
	local float Mag;
	local vector CurrentVelocity, X, Y, Z;
	
	if (Level.NetMode != NM_DedicatedServer)
		Spawn(class'ONSArtilleryShellSplit', self, , Location, Rotation);
	
	CurrentVelocity = 0.85 * Velocity;
	GetAxes(rotator(CurrentVelocity), X, Y, Z);
	
	// one shell in each of 9 zones
	for (i = -1; i < 2; i++)
	{
		for (j= -1; j < 2; j++)
		{
			if (Abs(i) + Abs(j) > 1)
				Mag = 0.7;
			else
				Mag = 1.0;
			Child = Spawn(ChildProjectileClass, self,, Location);
			if (Child != None)
			{
				Child.Velocity = CurrentVelocity + SpreadFactor * (X * (FRand() - 0.5) + Mag * (Y * (RandRange(0.3, 1.0) * i) + Z * (RandRange(0.3, 1.0) * j)));
				Child.InstigatorController = InstigatorController;
			}
		}
	}
	ExplodeInAir();
}

simulated function SpawnEffects(vector HitLocation, vector HitNormal)
{
	local PlayerController PC;

	PlaySound(ImpactSound, SLOT_None, 2.0);
	if (EffectIsRelevant(Location, false))
	{
		PC = Level.GetLocalPlayerController();
		if (PC.ViewTarget != None && VSize(PC.ViewTarget.Location - Location) < 3000)
			Spawn(ExplosionEffectClass,,, HitLocation + HitNormal * 16);
		Spawn(ExplosionEffectClass,,, HitLocation + HitNormal * 16);
		if (ExplosionDecal != None && Level.NetMode != NM_DedicatedServer)
			Spawn(ExplosionDecal, self,, HitLocation, rotator(-HitNormal));
	}
}

simulated function ExplodeInAir()
{
	bExploded = true;
	PlaySound(AirExplosionSound, SLOT_None, 2.0);
	if (Level.NetMode != NM_DedicatedServer)
		Spawn(AirExplosionEffectClass);
	
	Explode(Location, Normal(Velocity));
	Destroy();
}

event TakeDamage(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType)
{
    if (Damage > 0 && (EventInstigator == None || EventInstigator.Controller == None || InstigatorController == None || !EventInstigator.Controller.SameTeamAs(InstigatorController)))
	{
		if (EventInstigator != None)
			Instigator = EventInstigator;
        ExplodeInAir();
	}
}


//=============================================================================
// Default values
//=============================================================================

defaultproperties
{
	Begin Object Class=ProceduralSound Name=ShellBrakingExplode1P
		BaseSound = Sound'ShellBrakingExplode1'
		PitchModification = -10
		PitchVariance = 20
	End Object
	
	Begin Object Class=ProceduralSound Name=ShellBrakingExplode2P
		BaseSound = Sound'ShellBrakingExplode2'
		PitchModification = -10
		PitchVariance = 20
	End Object
	
	Begin Object Class=SoundGroup Name=ShellBrakingExplodeSound
		Sounds = (Sound'ShellBrakingExplode1P',Sound'ShellBrakingExplode2P')
	End Object
	
	AirExplosionSound = Sound'ShellBrakingExplodeSound';
	ImpactSound = Sound'ShellFragmentExplodeSound';
	ExplosionEffectClass = class'PersesArtilleryAirExplosion';
	AirExplosionEffectClass = class'PersesArtilleryAirExplosion';
	AmbientSound = None;
	MyDamageType = class'DamTypePersesArtilleryShell';
	ChildProjectileClass = class'PersesArtilleryShellChild';
	SpreadFactor = 400.0;
	TransientSoundRadius = 500.0;
}


Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: So 12.1.2014 17:49:42.000 - Creation time: Do 14.8.2014 09:58:48.188 - Created with UnCodeX