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

WVPersesMAS.PersesFragChunk


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
/**
WVPersesMAS.PersesFragChunk

Creation date: 2013-12-12 12:52
Last change: $Id$
Copyright (c) 2013, Wormbo
*/

class PersesFragChunk extends PersesProjectileBase;


//=============================================================================
// Imports
//=============================================================================

#exec audio import file=Sounds\FragBounce1.wav
#exec audio import file=Sounds\FragBounce2.wav


//=============================================================================
// Properties
//=============================================================================

var array<Sound> ImpactSounds;


//=============================================================================
// Variables
//=============================================================================

var byte RemainingBounces;


replication
{
	reliable if (bNetInitial)
		RemainingBounces;
}


simulated function ProcessContact(Actor Other, vector HitLocation, vector HitNormal)
{
	ExplosionSound = ImpactSounds[Rand(ImpactSounds.Length)];
	
	if (Other != None && (Other.bStatic || Other.bWorldGeometry) && RemainingBounces != 0)
	{
		Bounce(HitLocation, HitNormal);
	}
	else
	{
		Damage *= VSize(Velocity) / MaxSpeed;
		Explode(HitLocation, HitNormal);
	}
}

simulated function Bounce(vector HitLocation, vector HitNormal)
{
	RemainingBounces--;
	
	if (Role == ROLE_Authority)
		MakeNoise(0.5);

	if (LastTouched != None)
	{
		LastTouched.TakeDamage(Damage * VSize(Velocity) / MaxSpeed, Instigator, HitLocation, Normal(Velocity) * MomentumTransfer, MyDamageType);
	}
	else if (HurtWall != None)
	{
		HurtWall.TakeDamage(Damage * VSize(Velocity) / MaxSpeed, Instigator, HitLocation, Normal(Velocity) * MomentumTransfer, MyDamageType);
	}
	SpawnExplosionEffects(HitLocation, HitNormal);
	
	Velocity = MirrorVectorByNormal(Velocity, HitNormal) * 0.85;
	
	if (ProjEffects != None)
	{
		ProjEffects.SetBase(None);
		ProjEffects.SetLocation(HitLocation);
	}
	SpawnFlightEffects(); // create a new trail so the old one ends at the impact location
}


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

defaultproperties
{
	Damage           =    20.0
	DamageRadius     =     0.0
	MomentumTransfer = 10000.0
	MyDamageType     = class'DamTypePersesFragChunk'
	RemainingBounces = 3
	bBlockedByInstigator = True
	
	Mass     =    1.0
	LifeSpan =    1.0
	Speed    = 6000.0
	MaxSpeed = 6000.0
	Physics  = PHYS_Falling
	bIgnoreTerminalVelocity = True
	
	FlightParticleSystem = class'PersesFragChunkFlightEffects'
	ExplosionParticleSystem = class'PersesFragImpactSparks'
	ImpactSounds = (Sound'FragBounce1',Sound'FragBounce2')
	ExplosionDecal = class'BulletDecal'
	MaxEffectDistance    = 5000.0
	
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Do 19.6.2014 17:29:04.000 - Creation time: Do 14.8.2014 09:58:48.275 - Created with UnCodeX