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

U2Weapons.projectileBlackHole


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
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
//=============================================================================
// projectileBlackHole.uc -- spawned by the weaponSingularityCannon Fire()
// $Author: Mfox $
// $Date: 12/06/02 7:43p $
// $Revision: 29 $
//=============================================================================
class projectileBlackHole extends U2Projectile;

#exec OBJ LOAD File=..\Meshes\GlmWeaponsG.ugx
#exec OBJ LOAD File=..\System\ParticleRes\SC_FX.u

var() float FieldRadius;
var() float PainRadius;
var() float DistortionRadius;
var() float GravityRadius;
var() float KillRadius;
var() float GravityStrength;
var() float DamagePerSecond;

var ParticleGenerator EffectA,EffectB,EffectC;
var rotator EffectRotation;

var SC_Sucker Sucker[2];

/*!!ARL Fatness is gone (and pbly need to use a golem approach anyway
event Replication()
{
	Super.Replication();
	DOREP('Fatness');
}
*/

simulated event PreBeginPlay()
{
	Super.PreBeginPlay();

	EffectRotation.Pitch = RandRange(20000,40000);

	if(!bDeleteMe)
	{
		EffectA = class'ParticleGenerator'.static.CreateNew( self, ParticleGenerator'SC_FX.ParticleSalamander1', Location );	//green
		EffectB = class'ParticleGenerator'.static.CreateNew( self, ParticleGenerator'SC_FX.ParticleSalamander0', Location );	//black
		EffectC = class'ParticleGenerator'.static.CreateNew( self, ParticleGenerator'SC_FX.ParticleSalamander7', Location );	//center

		Sucker[0] = Spawn( class'SC_Sucker', , , Location, Rotation );
		Sucker[0].SetBase( Self );

		Sucker[1] = Spawn( class'SC_Sucker', , , Location, rotator( -Vector( Rotation ) ) );
		Sucker[1].SetBase( Self );
	}
}

simulated event Destroyed()
{
	if(EffectA?)
	{
		EffectA.Destroy();
		EffectA=None;
	}

	if(EffectB?)
	{
		EffectB.Destroy();
		EffectB=None;
	}

	if(EffectC?)
	{
		EffectC.ParticleDestroy();
		EffectC=None;
	}

	if( Sucker[0] != None )
	{
		Sucker[0].Destroy();
		Sucker[0] = None;
	}

	if( Sucker[1] != None )
	{
		Sucker[1].Destroy();
		Sucker[1] = None;
	}

	Super.Destroyed();
}

simulated event PhysicsVolumeChange( PhysicsVolume NewVolume )
{
	// do nothing
}


simulated function bool Immune( Actor A )
{
	if( A == Instigator )
		return true;
	if( A.bStatic )	
		return true;
	if( A.bNoDelete )
		return true;
	if( A.default.bHidden )
		return true;
	/*tbd: don't move anything that could block AI/player? but shooting these with RL could do same thing, no?
	if( Pawn(A) != None && (A.bBlockActors || A.bBlockPlayers) )	
		return true;
	*/
	// tbd: this will allow placed pickups in singleplayer to be sucked in
	if( Pickup(A) != None && U2DeathMatch(Level.Game) != None && A.bEditorPlaced )
		return true;
	return false;
}


event Tick( float DeltaTime )
{
	local Actor A, SatActor;
	local Vector Delta, AttractionForce;
	local float Distance;
	local int GravityChannel;
	local int ApplyDamage;
	local int OldTeam;

	// Update particle attachments.
	EffectRotation = EffectRotation + (rot(-1800,48000,3150) * DeltaTime);
	EffectA.SetLocation( Location - (vect(0,32,0) >> EffectRotation) );
	EffectB.SetLocation( Location + (vect(0,32,0) >> EffectRotation) );
	EffectB.SetRotation( rotator(Location - EffectB.Location) );
	EffectC.SetLocation( Location );

	foreach VisibleActors( class'Actor', A, FieldRadius, Location )
	{
		if( A != Self && !Immune( A ) )
		{
			//DMTNS( "affecting " $ A );
			
			if (Pawn(A)? && Pawn(A).Controller?)
				Pawn(A).Controller.FearThisSpot(self);
			
			// suck everything toward Location
			Delta = Location - A.Location;
			Distance = FMax( VSize( Delta ), 1.0 );

			if( !A.bIgnoreSingularityForces )
			{
				if( Distance < DistortionRadius && A.Mesh != None )
				{
					SatActor = A.MeshGetSatelliteActor('Sat_GravityWell');
					if ((SatActor!=self) && ((SatActor==None) || (VSize(Location-A.Location) < VSize(SatActor.Location-A.Location))))
						A.MeshSetSatellite('Sat_GravityWell', self);
					/*
					GravityChannel = A.MeshAgentGetChannelCount() + 5;
					A.LoopAnim('SHARED_GravityWell', 1.0, 0.0, GravityChannel);
					*/
					A.MeshAgentImmediateAction("force AuxGravity { keepset 1 1; script "$Quotes("SHARED_GravityWell")$"; blend 1.0; blendin 0; }");
				}

				if (!projectileBlackHole(A))
				{
					if (true)
					{
						if( Distance < GravityRadius )
						{
							AttractionForce = GravityStrength * DeltaTime * Normal( Delta ) / Distance;
							if (!A.IsRealPlayer())
								AttractionForce *= 2.0;
							A.Velocity += AttractionForce;
							A.SetPhysics( PHYS_Falling );
						}
					}
				}
			}
			
			if( !A.bIgnoreSingularityDamage && Distance < PainRadius )
			{
				if (!Pawn(A) || Pawn(A).Health > 0)
				{
					//A.TakeDamage( DamagePerSecond * DeltaTime, Instigator, A.Location, Vect(0,0,0), MyDamageType );
					if (Distance < KillRadius)
					{
						// instakill
						ApplyDamage = 9999;
					}
					else
					{
						ApplyDamage = (DamagePerSecond * DeltaTime) / (Distance / PainRadius);
					}
					
					if (Instigator?)
					{
						OldTeam = Instigator.TeamNumber;
						Instigator.TeamNumber = Pawn.Team_None; // the black hole knows no friends
					}
					A.TakeDamage( ApplyDamage, Instigator, A.Location, Vect(0,0,0), MyDamageType );
					if (Instigator?)
						Instigator.TeamNumber = OldTeam;
				}
				
				if (Pawn(A)? && Pawn(A).Health <= 0)
				{
					A.bHidden = true; // let the normal death process take care of the corpse (Died() will have already been called), but hide it
					if (U2Pawn(A)?)
						U2Pawn(A).RemainingPowerSuitEnergy = -1; // no powersuit glow thank you very much
				}
			}
		}
	}
}

simulated function ExplodeEx( CheckResult Hit )
{
	local ParticleGenerator Explosion;

	Explosion=class'ParticleGenerator'.static.CreateNew( self, ParticleGenerator'SC_FX.ParticleSalamander2', Hit.Location + (Hit.Normal*16.0) );
	Explosion.SetRotation( rotator(Hit.Normal) );
	Explosion.Trigger(Self,Instigator);
	Explosion.ParticleLifespan = Explosion.GetMaxLifeSpan() + 2.0;

	PlaySound( ImpactSound, SLOT_Interact );
	MakeNoise( 1.0 );

	Super.ExplodeEx(Hit);
}

defaultproperties
{
	FieldRadius=512.000000
	PainRadius=192.000000
	DistortionRadius=512.000000
	GravityRadius=512.000000
	KillRadius=64.000000
	GravityStrength=500000.000000
	DamagePerSecond=300.000000
	ShakeRadius=2048.000000
	ShakeMagnitude=30.000000
	ShakeDuration=1.250000
	speed=400.000000
	MaxSpeed=400.000000
	Damage=50.000000
	MyDamageType=Class'U2.DamageTypeSingularityCannon'
	DrawType=DT_None
	bIgnoreSingularityDamage=true
	bIgnoreSingularityForces=true
	LifeSpan=10.000000
	AmbientSound=Sound'U2WeaponsA.SingularityCannon.SC_BlackHole'
	bCollideActors=false
     UseReticleOnEvents(0)="UseReticleText"
     UseReticleOnEvents(1)="UseReticleCorners"
     UseReticleOnEvents(2)="UseReticleTopBars"
     ProximityReticleOnEvents(0)="ProximityReticleCorners"
     ProximityReticleOnEvents(1)="ProximityReticleTopBars"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:42.000 - Creation time: sk 3-1-2016 10:48:41.134 - Created with UnCodeX