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

UTGame.UTSkelControl_Damage


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
/**
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
 */

class UTSkelControl_Damage extends SkelControlSingleBone
	native(Animation);

/** Is this control initialized */
var bool bInitialized;

/** Quick link to the owning UTVehicle */
var UTVehicle OwnerVehicle;

/** Which morph Target to use for health.  If none, use the main vehicle health */
var float HealthPerc;

/** Whether the OnDamage functionality is active **/
var(Damage) bool bOnDamageActive;

/** Value to scale this bone to on death **/
var(Damage) float DamageBoneScale;

/** How much damage the control can take */
var(Damage) int DamageMax;

/** If the health target is above this threshold, this control will be inactive */
var(Damage) float ActivationThreshold;

/** Once activated, does we generate the control strength as a product of the health remaining, or is it always full */
var(Damage) bool bControlStrFollowsHealth;

/** The Static Mesh component to display when it breaks off */
var(Damage) StaticMesh	BreakMesh;

/** The threshold at which the spring will begin looking to break */
var(Damage) float BreakThreshold;

/** This is the amount of time to go from breaking to broken */
var(Damage) float BreakTime;

/** When breaking off, use this to build the vector */
var(Damage) vector DefaultBreakDir;

/**
 * The scale to use for the spawned piece.  (i.e. we have one static mesh asset but it is being spawned from different locations on a vehicle
 * which is mirrored down the center.
 **/
var(Damage) vector DamageScale;

/** ParticleSystem to spawn when this piece breaks */
var(Damage) ParticleSystem PS_DamageOnBreak;

/** ParticleSystem to attach when this piece flies off (i.e. a dark acrid trailing smoke trail!) */
var(Damage) ParticleSystem PS_DamageTrail;


/** Is this control broken */
var transient bool bIsBroken;

/** This is set to true when Break() is called.  It signals the control is breaking but not yet broken */
var transient bool bIsBreaking;

/** This holds the name of the bone that was broken */
var transient name BrokenBone;

/** This holds the real-time at which this should break */
var transient float BreakTimer;

/** cached MaxDamage for a vehicle */
var transient float OwnerVehicleMaxHealth;



/** force that pushes the part up when the part is broken off to clear the vehicle. */
var() vector BreakSpeed;


/** Whether the OnDeath functionality is active **/
var(OnDeath) bool bOnDeathActive;

/** Whether the OnDeath functionality is active for the secondary explosion **/
var(OnDeath) bool bOnDeathUseForSecondaryExplosion;

/** This is the percent that this piece will actually spawn if OnDeath is active **/
var(OnDeath) float DeathPercentToActuallySpawn;

/** Value to scale this bone to on death **/
var(OnDeath) float DeathBoneScale;

/** The static mesh to spawn on death **/
var(OnDeath) StaticMesh DeathStaticMesh;

/** This is the direction which the spawned vehicle piece will fly **/
var(OnDeath) vector DeathImpulseDir;

/**
 * The scale to use for the spawned piece.  (i.e. we have one static mesh asset but it is being spawned from different locations on a vehicle
 * which is mirrored down the center.
 **/
var(OnDeath) vector DeathScale;

/** ParticleSystem to spawn when this piece breaks */
var(OnDeath) ParticleSystem PS_DeathOnBreak;

/** ParticleSystem to attach when this piece flies off (i.e. a dark acrid trailing smoke trail!) */
var(OnDeath) ParticleSystem PS_DeathTrail;



// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)

/**
 * This event is triggered when the spring has decided to break.
 *
 * Network - Called everywhere except on a dedicated server.
 */

simulated event BreakApart(vector PartLocation, bool bIsVisible)
{
	local UTGib Gib;

	if( !bOnDamageActive
		|| ( BreakMesh == none )
		|| ( OwnerVehicle == none )
		|| bIsBroken
		)
	{
		// if this was called these flags should be set even if there is no visual effects
		bIsBreaking = FALSE;
		bIsBroken = TRUE;
		return;
	}

	//`log( "No BreakMesh set for: " $ OwnerVehicle $ " " $ self $ bIsVisible $ OwnerVehicle.WorldInfo.NetMode );

	if ( bIsVisible && (OwnerVehicle.WorldInfo.NetMode != NM_DedicatedServer) )
	{
		Gib = OwnerVehicle.SpawnGibVehicle(PartLocation, OwnerVehicle.Rotation, BreakMesh, PartLocation, true, DefaultBreakDir, PS_DamageOnBreak, PS_DamageTrail);

		if( Gib != none )
		{
			Gib.SetDrawScale3D( DamageScale );
		}
	}

	BoneScale = DamageBoneScale;

	bIsBreaking = FALSE;
	bIsBroken = TRUE;
}


simulated event BreakApartOnDeath(vector PartLocation, bool bIsVisible)
{
	local UTGib Gib;

	if ( !bOnDeathActive )
	{
		return;
	}
	if ( DeathStaticMesh == None )
	{
		DeathStaticMesh = BreakMesh;
	}
	if( ( DeathStaticMesh == none )
		// if we are not within the percentage to spawn
		|| ( DeathPercentToActuallySpawn < FRand() )
		|| ( OwnerVehicle == none )
		|| bIsBroken )
	{
		// if this was called these flags should be set even if there is no visual effects
		bIsBroken = TRUE;
		return;
	}
	//`log( "No BreakMesh set for: " $ OwnerVehicle $ " " $ self );


	if( bIsVisible && (OwnerVehicle.WorldInfo.NetMode != NM_DedicatedServer) )
	{
		Gib = OwnerVehicle.SpawnGibVehicle(PartLocation, OwnerVehicle.Rotation, DeathStaticMesh, PartLocation, true, DeathImpulseDir, None, PS_DeathTrail);

		if( Gib != none )
		{
			Gib.SetDrawScale3D( DeathScale );
		}
	}

	BoneScale = DeathBoneScale;

	bIsBroken = TRUE;
}


simulated event float RestorePart()
{
	BoneScale = 1.0f;
	HealthPerc = 1.0f;

	return HealthPerc;
}

defaultproperties
{
   bOnDamageActive=True
   HealthPerc=1.000000
   DamageMax=25
   BreakThreshold=1.100000
   DamageScale=(X=1.000000,Y=1.000000,Z=1.000000)
   PS_DamageOnBreak=ParticleSystem'Envy_Effects.Particles.P_VH_Gib_Explosion'
   PS_DamageTrail=ParticleSystem'Envy_Effects.Tests.Effects.P_Vehicle_Damage_1'
   DeathPercentToActuallySpawn=1.000000
   DeathScale=(X=1.000000,Y=1.000000,Z=1.000000)
   PS_DeathOnBreak=ParticleSystem'Envy_Effects.Particles.P_VH_Gib_Explosion'
   PS_DeathTrail=ParticleSystem'Envy_Effects.Tests.Effects.P_Vehicle_Damage_1'
   bIgnoreWhenNotRendered=True
   Name="Default__UTSkelControl_Damage"
   ObjectArchetype=SkelControlSingleBone'Engine.Default__SkelControlSingleBone'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:24.000 - Creation time: sk 18-3-2018 10:01:25.239 - Created with UnCodeX