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

ROEngine.ROShellEject


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
//=====================================================
// ROShellEject
// started by Antarian 7/25/03
//
// Copyright (C) 2003 Jeffrey Nakai
//
// This is the base shell ejection class.
// Making the shells projectiles will give us more control of them
//=====================================================

// Ramm: Refactor - lets use an emitter or something so this isn't so heavy. This
// spawns an actor every time you fire a weapon

class ROShellEject extends Projectile
	abstract;

//-----------------------------------------------------------------------------
// Projectile variables.

// Impact reflection variables
var() 	float 	DampenFactor,
				DampenFactorParallel;
var() 	byte	Bounces;

var()	int		RandomYawRange;		// Random yaw variation for spawning
var()	int		RandomPitchRange;	// Random pitch variation for spawning
var()	int		RandomRollRange;	// Random pitch variation for spawning
var()	float	MinStartSpeed;      // Minimum speed to eject at
var()	float	MaxStartSpeed;      // Minimum speed to eject at

simulated function Reset()
{
	Destroy();
}

simulated function PostBeginPlay()
{
	Super.PostBeginPlay();

	LifeSpan = +10.00;

	RandSpin(150000);

	Acceleration = 0.5 * PhysicsVolume.Gravity;
}

// no need for a hurt radius on shell cases
simulated function DelayedHurtRadius( float a, float e, class<DamageType> i, float o, vector u ) {}

simulated function PhysicsVolumeChange( PhysicsVolume Volume )
{
	if (Volume.bWaterVolume)
		Velocity *= 0.15;

	//PlaySound(Sound'Inf_Weapons.ShellRifleWater', SLOT_Misc,0.15,,20,,false );
}

simulated function Landed( Vector HitNormal )
{
	HitWall(HitNormal, none);
}

//=============================================================================
// GetHitSurfaceType(RO) - Will get the surface type of the surface the
//	projectile has collided with.
//=============================================================================
simulated function GetHitSurfaceType( out ESurfaceTypes ST, vector HitNormal)
{
	local vector HitLoc, HitNorm;
	local Material HitMat;

	if (Level.NetMode == NM_DedicatedServer)
		return;

	Trace(HitLoc, HitNorm, Location - (HitNormal * 16), Location, false,, HitMat);

	if (HitMat == None)
		ST = EST_Default;
	else
		ST = ESurfaceTypes(HitMat.SurfaceType);
}

//=============================================================================
// GetDampenAndSoundValue(RO) - Gets the DampenFactor's and hit sound for the
//	surface the projectile hits
//=============================================================================
simulated function GetDampenAndSoundValue( ESurfaceTypes ST )
{
/*	switch( ST )
	{
		case EST_Default:
			DampenFactor=0.3;
    		DampenFactorParallel=0.5;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleDirt';
			break;

		case EST_Rock:
			DampenFactor=0.4;
    		DampenFactorParallel=0.7;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleDirt';
			break;

		case EST_Dirt:
			DampenFactor=0.3;
    		DampenFactorParallel=0.4;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleDirt';
			break;

		case EST_Metal:
		case EST_MetalArmor:
			DampenFactor=0.4;
    		DampenFactorParallel=0.7;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleConcrete';
			break;

		case EST_Wood:
			DampenFactor=0.25;
    		DampenFactorParallel=0.6;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleWood';
			break;

		case EST_Plant:
			DampenFactor=0.1;
    		DampenFactorParallel=0.3;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleDirt';
			break;

		case EST_Flesh:
			DampenFactor=0.1;
    		DampenFactorParallel=0.2;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleDirt';
			break;

		case EST_Ice:
			DampenFactor=0.4;
    		DampenFactorParallel=0.7;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleConcrete';
			break;

		case EST_Snow:
			DampenFactor=0.0;
    		DampenFactorParallel=0.05;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleDirt';
			break;

		case EST_Water:
			DampenFactor=0.0;
    		DampenFactorParallel=0.05;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleWater';
			break;

		case EST_Glass:
			DampenFactor=0.4;
    		DampenFactorParallel=0.7;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleConcrete';
			break;

		case EST_Gravel:
			DampenFactor=0.3;
    		DampenFactorParallel=0.4;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleDirt';
			break;

		case EST_Concrete:
			DampenFactor=0.4;
    		DampenFactorParallel=0.7;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleConcrete';
			break;

		case EST_HollowWood:
			DampenFactor=0.25;
    		DampenFactorParallel=0.6;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleWood';
			break;

		case EST_Mud:
			DampenFactor=0.0;
    		DampenFactorParallel=0.05;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleDirt';
			break;

		default:
			DampenFactor=0.3;
    		DampenFactorParallel=0.5;
    		ImpactSound=Sound'Inf_Weapons.ShellRifleDirt';
			break;
	}*/
}

simulated function HitWall (vector HitNormal, actor Wall)
{
	local Vector VNorm;
	local ESurfaceTypes ST;
	local rotator LandRot;

	GetHitSurfaceType(ST, HitNormal);
    GetDampenAndSoundValue(ST);

    // Reflect off Wall w/damping
    VNorm = (Velocity dot HitNormal) * HitNormal;
    Velocity = -VNorm * DampenFactor + (Velocity - VNorm) * DampenFactorParallel;

    RandSpin(75000);
    Speed = VSize(Velocity);
    Bounces--;

    if( Speed < 20 || Bounces <= 0 )
	{
		bBounce = false;
		LandRot = Rotation;
		LandRot.Pitch = rotator(HitNormal).Pitch;
		LandRot.Pitch += 16384;
		SetRotation(LandRot);
    	SetPhysics(PHYS_None);
    }
    else if( ImpactSound != none )
    {
		PlaySound(ImpactSound, SLOT_Misc,0.4,,25,,true );
	}
}

simulated function BlowUp(vector HitLocation) {} // doesn't blow up

simulated function Explode(vector HitLocation, vector HitNormal) {}  // doesn't explode

defaultproperties
{
     DampenFactor=0.600000
     DampenFactorParallel=0.800000
     Bounces=10
     RandomYawRange=2000
     RandomPitchRange=2500
     RandomRollRange=500
     MinStartSpeed=125.000000
     MaxStartSpeed=175.000000
     Speed=175.000000
     DamageRadius=0.000000
     MyDamageType=None
     DrawType=DT_StaticMesh
     bReplicateInstigator=False
     bNetInitialRotation=False
     Physics=PHYS_Falling
     NetPriority=0.000000
     LifeSpan=10.000000
     bCanBeDamaged=False
     bBounce=True
     bRotateToDesired=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 13-10-2023 03:17:28.000 - Creation time: Fri 13-10-2023 03:19:07.417 - Created with UnCodeX