## XIDCine
Class BreakableMover

source: C:\XIII\XIDCine\Classes\BreakableMover.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Mover
             |
             +--XIII.XIIIMover
                |
                +--XIDCine.BreakableMover

Direct Known Subclasses:Fenetre, Neon, Explosif

class BreakableMover
extends XIII.XIIIMover

    //-----------------------------------------------------------
    // BreakableMover
    // Created by iKi
    // Last Modification by iKi
    //-----------------------------------------------------------

Variables
`E_BreakType` | `BreakType` Blow induce from player location
`Name` | `BreakedMeshAnim` Blow induce from player location
`array` | `BreakedMiddleStateSM` Blow induce from player location
`STATICMESH` | `BreakedStaticMesh` Blow induce from player location
`bool` | `CollisionWhenBreaked`
`class` | `DecoPickupGenerated` Blow induce from player location
`float` | `DelayDamage`
`float` | `DelayToUse` Blow induce from player location
`float` | `DelayTrigger`
`VECTOR` | `Fragment_Center` Blow induce from player location
`int` | `InitialHealth` Blow induce from player location
`int` | `LastDamage` Blow induce from player location
`EDrawType` | `MemoDrawType` Blow induce from player location
`Texture` | `OnomatopTextures[6]` Blow induce from player location
`XIIIPlayerController` | `PC` Blow induce from player location
`bool` | `ParticlesUseCollision`
`float` | `RelativeBlow` Blow induce from player location
`class` | `StruckEmitter` Blow induce from player location
`float` | `TempsContact` Blow induce from player location
`Pawn` | `Walker` Blow induce from player location
`bool` | `bDisperseInBoundingBox`
`bool` | `bMustShakeWhileDelay`
`mesh` | `breakingmesh` Blow induce from player location
`VECTOR` | `particles_speed` Blow induce from player location

States
STA_Breaking, STA_BreakingAnim

Function Summary
`simulated` | `Breaked()`
`simulated` | `Breaking(float fDelay)`
`simulated` | `ComputeDispersal()`
`void` | `EffectiveTakeDamage()`
`void` | `FastBreak()`
`simulated` | `InitDazzleAndShake(bool bBroken)`
`simulated` | `InitializeEmitters()`
`bool` | `IsBreakableByPlayer()`
`void` | `MakeGroupReturn()`
`simulated` | `NonDestructiveParticles(vector pos)`
    //_____________________________________________________________________________
`void` | `Reset()`

State STA_Breaking Function Summary

State STA_BreakingAnim Function Summary

Source Code

    00001	//-----------------------------------------------------------
    00002	// BreakableMover
    00003	// Created by iKi
    00004	// Last Modification by iKi
    00005	//-----------------------------------------------------------
    00006	class BreakableMover extends XIIIMover
    00007		hidecategories(Force,LightColor,Lighting,Mover,Porte,MoverSound);
    00008
    00009	ENUM E_BreakType	{	BT_Always, BT_TriggerOnly, BT_DamageOnly };
    00010
    00011	ENUM E_FireType		{	FT_None, FT_DontUseIt1, FT_DontUseIt2, FT_DontUseIt3 };
    00012
    00013	ENUM E_SmokeType	{	ST_None, ST_DontUseIt1, ST_DontUseIt2, ST_DontUseIt3, ST_DontUseIt4, ST_DontUseIt5 };
    00014
    00015	ENUM E_OnomatopType	{	OT_None, OT_Baommm, OT_Aahh, OT_Crac, OT_Cling, OT_Blam };
    00016
    00017	STRUCT C_MeshParticles
    00018	{
    00019		VAR() class<Emitter>	Type;
    00020		VAR() Vector			Eparpillement;
    00021		VAR() int				Number;
    00022		VAR() float				ScaleMin;
    00023		VAR() float				ScaleMax;
    00024		VAR() Vector			Offset;
    00025		VAR() StaticMesh		StaticMesh;
    00026		VAR() Vector			Blow;
    00027		VAR() bool				FadeOut;
    00028		VAR() float				FadeOutBegin;
    00029		VAR() float				FadeOutEnd;
    00030	};
    00031
    00032	STRUCT BMState
    00033	{
    00034		VAR() int			DamagePercentage;
    00035		VAR() StaticMesh	StateStaticMesh;
    00036		VAR() Texture		StateTexture;
    00037		VAR() Sound			StateSound;
    00038		VAR() name			StateEvent;
    00039	};
    00040
    00041	STRUCT C_FireSprites
    00042	{
    00043		VAR() E_FireType							Type;
    00044		VAR() Vector								Dispersal;
    00045		VAR() int									Number;
    00046		VAR() float									ScaleMin;
    00047		VAR() float									ScaleMax;
    00048		VAR() Vector								Offset;
    00049		VAR() ParticleEmitter.EParticleDrawStyle	DrawStyle;
    00050		VAR() float									LifeTime;
    00051		VAR() bool									OneTextureAnimOnly;
    00052		VAR() bool									FadeOut;
    00053		VAR() float									FadeOutBegin;
    00054	};
    00055
    00056	STRUCT C_SmokeSprites
    00057	{
    00058		VAR() E_SmokeType							Type;
    00059		VAR() Vector								Dispersal;
    00060		VAR() int									Number;
    00061		VAR() float									ScaleMin;
    00062		VAR() float									ScaleMax;
    00063		VAR() Vector								Offset;
    00064		VAR() ParticleEmitter.EParticleDrawStyle	DrawStyle;
    00065		VAR() float									LifeTime;
    00066		VAR() bool									OneTextureAnimOnly;
    00067		VAR() bool									FadeOut;
    00068		VAR() float									FadeOutBegin;
    00069	};
    00070
    00071	STRUCT C_OnomatopSprites
    00072	{
    00073		VAR() E_OnomatopType						Type;
    00074		VAR() Vector								Dispersal;
    00075		VAR() int									Number;
    00076		VAR() float									ScaleMin;
    00077		VAR() float									ScaleMax;
    00078		VAR() Vector								Offset;
    00079		VAR() ParticleEmitter.EParticleDrawStyle	DrawStyle;
    00080		VAR() float									LifeTime;
    00081		VAR() bool									OneTextureAnimOnly;
    00082	};
    00083
    00084	VAR()					bool	CollisionWhenBreaked;
    00085	VAR()					bool	ParticlesUseCollision;
    00086	VAR()					bool	bMustShakeWhileDelay;
    00087	VAR()					bool	bDisperseInBoundingBox;
    00088	VAR(BM_Vulnerability)	bool	bVulnerableBladeCut;
    00089	VAR(BM_Vulnerability)	bool	bVulnerableGrenade;
    00090	VAR(BM_Vulnerability)	bool	bVulnerableGun;
    00091	VAR(BM_Vulnerability)	bool	bVulnerableShotgun;
    00092	VAR(BM_Vulnerability)	bool	bVulnerableStunning;
    00093	VAR(BM_Vulnerability)	bool	bVulnerablePiercing;
    00094	VAR(BM_Vulnerability)	bool	bVulnerableToFist;
    00095	VAR(Fragments2D)		bool	Fragments_FadeOut;
    00096	VAR(Fragments3D)		bool	Fragments3DIgnoreDynLight;
    00097	VAR(Fragments3D)		bool	CollisionTime;
    00098	VAR						bool	bBreaking;
    00099	VAR						bool	bBroken;
    00100	VAR						bool	bToBeDestroyed;
    00101	VAR(ShakeCamera)		bool	SC_bActive;
    00102	VAR(ShakeCamera)		bool	SC_StartAfterBreakingAnim;
    00103	VAR						bool	SC_bRunning;
    00104	VAR(FlashDazzle)		bool	FD_bActive;
    00105	VAR(FlashDazzle)		bool	FD_StartAfterBreakingAnim;
    00106	VAR						bool	FD_bRunning;
    00107	VAR						bool	bMemoColActors;
    00108	VAR						bool	bMemoBlockActors;
    00109	VAR						bool	bMemoBlockPlayers;
    00110
    00111	VAR()					float	DelayDamage;
    00112	VAR()					float	DelayTrigger;
    00113	VAR()					float	RelativeBlow; // Blow induce from player location
    00114	VAR(Fragments2D)		float	Fragments_ScaleMin;
    00115	VAR(Fragments2D)		float	Fragments_ScaleMax;
    00116	VAR(Fragments2D)		float	Fragments_FadeOutBegin;
    00117	VAR(Fragments2D)		float	Fragments_FadeOutEnd;
    00118	VAR TRANSIENT			float	DelayToUse;
    00119	VAR TRANSIENT			float	TempsContact;
    00120	VAR	TRANSIENT			float	TimeStamp;
    00121	VAR(ShakeCamera)		float	SC_lifetime;
    00122	VAR(ShakeCamera)		float	SC_delay;
    00123	VAR(ShakeCamera)		float	SC_intensity;
    00124	VAR(ShakeCamera)		float	SC_distance_start;
    00125	VAR(ShakeCamera)		float	SC_distance_end;
    00126	VAR						float	SC_localintensity;
    00127	VAR						float	SC_starttime;
    00128	VAR(FlashDazzle)		float	FD_lifetime;
    00129	VAR(FlashDazzle)		float	FD_delay; // TODEL : Always be ZERO
    00130	VAR(FlashDazzle)		float	FD_intensity;
    00131	VAR(FlashDazzle)		float	FD_distance_start;
    00132	VAR(FlashDazzle)		float	FD_distance_end;
    00133	VAR						float	FD_localintensity;
    00134	VAR						float	FD_starttime;
    00135
    00136	VAR(Fragments2D)		int		FragmentTextureUSubdivisions;
    00137	VAR(Fragments2D)		int		FragmentTextureVSubdivisions;
    00138	VAR(Fragments2D)		int		Fragments_Number;
    00139	VAR(Save)				int		BreakPoint;
    00140	VAR(Sound)				int		ExplosiveType; // for SoundWhenBreaked parameter
    00141	VAR TRANSIENT			int		InitialHealth;
    00142	VAR TRANSIENT			int		LastDamage;
    00143
    00144	VAR(Fragments2D)		VECTOR	Fragments_Eparpillement;
    00145	VAR(Fragments2D)		VECTOR	Fragments_Offset;
    00146	VAR(Fragments2D)		VECTOR	Fragments_Blow;
    00147	VAR TRANSIENT			VECTOR	particles_speed;
    00148	VAR TRANSIENT			VECTOR	Fragment_Center;
    00149	VAR						VECTOR	ExplosiveEmitterOffset;
    00150	VAR						VECTOR	FD_vectorcolor;
    00151
    00152	VAR(Fragments2D)		TEXTURE	FragmentTexture;
    00153	VAR(Explosif)			TEXTURE	FireTexture;
    00154	VAR(Explosif)			TEXTURE	SmokeTexture;
    00155	VAR(Explosif)			TEXTURE	OnomatopTexture;
    00156	VAR CONST				TEXTURE	OnomatopTextures[6];
    00157
    00158	VAR()					STATICMESH	BreakedStaticMesh;
    00159	VAR						STATICMESH	InitialStaticMesh;
    00160
    00161	VAR()			E_BreakType	BreakType;
    00162	VAR()			Name		BreakedMeshAnim;
    00163	VAR(Sound)		Sound		SoundWhenBroken;
    00164
    00165	VAR(FlashDazzle) color	FD_color;
    00166
    00167	VAR TRANSIENT	Pawn	Walker;
    00168
    00169	VAR TRANSIENT	mesh	breakingmesh;
    00170
    00171	VAR(Fragments2D)	class<Emitter>						Fragments_Type;
    00172
    00173	VAR(Fragments2D)	ParticleEmitter.EParticleDrawStyle	FragmentDrawStyle;
    00174
    00175	VAR TRANSIENT		EDrawType							MemoDrawType;
    00176
    00177	VAR(Fragments3D)	C_MeshParticles Fragments3D;
    00178
    00179	VAR() array<BMState>	BreakedMiddleStateSM;
    00180
    00181	VAR(Explosif) C_FireSprites Fire;
    00182
    00183	VAR(Explosif) C_SmokeSprites Smoke;
    00184
    00185	VAR(Explosif) C_OnomatopSprites Onomatop;
    00186
    00187	VAR(Explosif) class<Emitter> ExplosiveEmitter;
    00188
    00189	VAR() class<XIIIDecoPickup> DecoPickupGenerated;
    00190
    00191	VAR() class<Emitter>		StruckEmitter;
    00192
    00193	VAR XIIIPlayerController PC;
    00194
    00195
    00196	replication
    00197	{
    00198	  reliable if( Role==ROLE_Authority )
    00199	    bBroken, Walker, SoundWhenBroken, ExplosiveType;
    00200	}
    00201
    00202	FUNCTION Reset()
    00203	{
    00204		if ( bBroken )
    00205		{
    00206			StaticMesh=InitialStaticMesh;
    00207			bHidden=false;
    00208			RefreshDisplaying();
    00209			SetCollision(bMemoColActors,bMemoBlockActors,bMemoBlockPlayers);
    00210			bBroken=false;
    00211			bBreaking=false;
    00212			bToBeDestroyed=false;
    00213		}
    00214	}
    00215
    00216	simulated EVENT Tick(float dt)
    00217	{
    00218		LOCAL float time;
    00219
    00220		TimeStamp+=dt;
    00221
    00222		if ( Level.NetMode == NM_Client )
    00223		{
    00224			if ( bBroken )
    00225			{
    00226				Breaked();
    00227				Disable('Tick');
    00228			}
    00229		}
    00230		else
    00231			if (FD_bRunning)
    00232			{
    00233				time=(TimeStamp-FD_starttime)/FD_lifetime;
    00234				if (time>=0 && time<=1.0)
    00235					PC.ClientInstantFlash( Lerp(time,-FD_localintensity,0), FD_VectorColor);/*vect(1000,1000,1000));*/
    00236				else
    00237				{
    00238					if (time>1)
    00239
{ 00240 if (bToBeDestroyed) 00241 Destroy(); 00242 FD_bRunning=false; 00243 } 00244 } 00245 } 00246 } 00247 00248 simulated FUNCTION InitDazzleAndShake(bool bBroken) 00249 { 00250 LOCAL float dist; 00251 00252 if ( !Level.bLonePlayer ) 00253 return; 00254 00255 PC=XIIIGameInfo(Level.Game).MapInfo.XIIIController; 00256 00257 dist=VSize(Location-XIIIGameInfo(Level.Game).MapInfo.XIIIPawn.Location); 00258 00259 if (FD_bActive && (FD_StartAfterBreakingAnim==bBroken)) 00260 { 00261 FD_starttime=TimeStamp+FD_delay; 00262 00263 FD_VectorColor.X=FD_Color.R*3.9; 00264 FD_VectorColor.Y=FD_Color.G*3.9; 00265 FD_VectorColor.Z=FD_Color.B*3.9; 00266 00267 if (dist<FD_distance_start) 00268 { 00269 FD_bRunning=true; 00270 FD_localintensity=FD_intensity; 00271 } 00272 else 00273 { 00274 if (dist<FD_distance_end) 00275 { 00276 FD_localintensity=(FD_distance_end-dist)/(FD_distance_end-FD_distance_start)*FD_intensity; 00277 FD_bRunning=true; 00278 } 00279 else 00280 FD_bRunning=false; 00281 } 00282 } 00283 00284 if (SC_bActive && (SC_StartAfterBreakingAnim==bBroken)) 00285 { 00286 if (dist<SC_distance_start) 00287 { 00288 SC_bRunning=true; 00289 SC_localintensity=SC_intensity; 00290 } 00291 else 00292 { 00293 if (dist<SC_distance_end) 00294 { 00295 SC_localintensity=(SC_distance_end-dist)/(SC_distance_end-SC_distance_start)*SC_intensity; 00296 SC_bRunning=true; 00297 } 00298 else 00299 { 00300 SC_bRunning=false; 00301 } 00302 } 00303 if (SC_bRunning) 00304 { 00305 PC.ShakeView( SC_LifeTime*25.6, SC_localintensity*1600.000000, vect(0,0,30), SC_localintensity*120000, vect(0,0,0), 0) ; 00306 SC_bRunning=false; 00307 } 00308 00309 } 00310 00311 if (FD_bRunning) 00312 enable('Tick'); 00313 } 00314 00315 //_____________________________________________________________________________ 00316 simulated FUNCTION NonDestructiveParticles(vector pos) 00317 { 00318 LOCAL emitter e; 00319 00320 if ( StruckEmitter!=none ) 00321 e = SPAWN( StruckEmitter, self, ,pos ); 00322 } 00323 00324 FUNCTION MakeGroupReturn() 00325 { 00326 } 00327 00328 EVENT TakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType) 00329 { 00330 LOCAL int i,stage; 00331 00332 if ( BreakType == BT_TriggerOnly ) 00333 return; 00334 00335 Instigator=EventInstigator; 00336 00337 switch (DamageType) 00338 { 00339 case class'DTBladeCut': 00340 if (!bVulnerableBladeCut) 00341 { 00342 NonDestructiveParticles(HitLocation); 00343 return; 00344 } 00345 break; 00346 case class'DTGrenaded': 00347 if (!bVulnerableGrenade) 00348 { 00349 NonDestructiveParticles(HitLocation); 00350 return; 00351 } 00352 break; 00353 case class'DTRocketed': 00354 if (!bVulnerableGrenade) 00355 { 00356 NonDestructiveParticles(HitLocation); 00357 return; 00358 } 00359 break; 00360 case class'DTGunned': 00361 if (!bVulnerableGun) 00362 { 00363 NonDestructiveParticles(HitLocation); 00364 return; 00365 } 00366 break; 00367 case class'DTShotgunned': 00368 if (!bVulnerableShotgun) 00369 { 00370 NonDestructiveParticles(HitLocation); 00371 return; 00372 } 00373 break; 00374 case class'DTSniped': 00375 if (!bVulnerableShotgun) 00376 { 00377 NonDestructiveParticles(HitLocation); 00378 return; 00379 } 00380 break; 00381 case class'DTStunned': 00382 if (!bVulnerableStunning) 00383 { 00384 NonDestructiveParticles(HitLocation); 00385 return; 00386 } 00387 break; 00388 case class'DTPierced': 00389 if (!bVulnerablePiercing) 00390 { 00391 NonDestructiveParticles(HitLocation); 00392 return; 00393 } 00394 break; 00395 case class'DTFisted': 00396 if (!bVulnerableToFist) 00397 { 00398 NonDestructiveParticles(HitLocation); 00399 return; 00400 } 00401 break; 00402 } 00403 00404 LastDamage = Damage; 00405 Health -= Damage; 00406 00407 if ( Health <= 0 ) 00408 { 00409 Walker=EventInstigator; 00410 // DebugLog("BreakableMover::TakeDamage Instigator : "$EventInstigator); 00411 particles_speed=Normal(HitLocation - Walker.Location); 00412 00413 if (IsA('Explosif') && ((DamageType == class'DTGrenaded')||(DamageType == class'DTRocketed'))) 00414 { 00415 SetTimer2(fRand()*0.8, false); 00416 } 00417 else 00418 { 00419 EffectiveTakeDamage(); 00420 } 00421 } 00422 else 00423 { 00424 stage=-1; 00425 for (i=0;i<BreakedMiddleStateSM.Length;++i) 00426 { 00427 if ( ( BreakedMiddleStateSM[i].DamagePercentage * InitialHealth < ( InitialHealth - Health ) * 100 ) && ( stage==-1 || BreakedMiddleStateSM[stage].DamagePercentage<BreakedMiddleStateSM[i].DamagePercentage) ) 00428 stage=i; 00429 } 00430 if ( stage!=-1 ) 00431 { 00432 if ( BreakedMiddleStateSM[stage].StateStaticMesh!=none ) 00433 StaticMesh = BreakedMiddleStateSM[stage].StateStaticMesh; 00434 if ( BreakedMiddleStateSM[stage].StateEvent!='' && BreakedMiddleStateSM[stage].StateEvent!='none' ) 00435 TriggerEvent(BreakedMiddleStateSM[stage].StateEvent,self,EventInstigator); 00436 if ( BreakedMiddleStateSM[stage].StateSound!=none ) 00437 PlaySound( BreakedMiddleStateSM[stage].StateSound ); 00438 } 00439 NonDestructiveParticles(HitLocation); 00440 } 00441 } 00442 00443 EVENT Timer2() 00444 { 00445 EffectiveTakeDamage(); 00446 } 00447 00448 SIMULATED FUNCTION bool IsBreakableByPlayer() 00449 { 00450 return ( BreakType != BT_TriggerOnly ); 00451 } 00452 00453 EVENT Bump( actor Other ) 00454 { 00455 } 00456 00457 EVENT SetInitialState() 00458 { 00459 // Dont't touch my state 00460 bScriptInitialized = true; 00461 InitialHealth = Health; 00462 breakingmesh=mesh; 00463 mesh=none; 00464 if ( Level.NetMode == NM_Client ) 00465 enable( 'Tick' ); 00466 else 00467 Disable('Tick'); 00468 Disable('Bump'); 00469 00470 if ( BreakType==BT_DamageOnly ) 00471 Disable('Trigger'); 00472 /* 00473 switch(BreakType) 00474 { 00475 case BT_TriggerOnly: 00476 // Disable('TakeDamage'); 00477 break; 00478 case BT_DamageOnly: 00479 Disable('Trigger'); 00480 break; 00481 }*/ 00482 } 00483 00484 EVENT PostBeginPlay() 00485 { 00486 Super.PostBeginPlay(); 00487 InitialStaticMesh=StaticMesh; 00488 bMemoColActors = bCollideActors; 00489 bMemoBlockActors = bBlockActors; 00490 bMemoBlockPlayers = bBlockPlayers; 00491 00492 if ( Level.bLonePlayer ) 00493 SetTimer( 0.06, false ); 00494 else 00495 LOG( self@"POSTBEGINPLAY called" ); 00496 } 00497 00498 EVENT Timer( ) 00499 { 00500 if ( (BreakPoint>=0) && (XIIIGameInfo(Level.Game).CheckPointNumber-2>=BreakPoint) ) 00501 FastBreak(); 00502 } 00503 00504 FUNCTION EffectiveTakeDamage() 00505 { 00506 if (((BreakType==BT_Always) || (BreakType==BT_DamageOnly)) && !bBroken) 00507 { 00508 // DebugLog("BreakableMover::EffectiveTakeDamage Calling Breaking"); 00509 Breaking(DelayDamage); 00510 } 00511 // else 00512 // LOG("ERROR : TAKEDAMAGE on a TriggerOnly BreakableMover !!"); 00513 } 00514 00515 EVENT Trigger(actor Other, pawn EventInstigator) 00516 { 00517 if (((BreakType==BreakType) || (BreakType==BT_TriggerOnly)) && !bBroken) 00518 Breaking(DelayTrigger); 00519 } 00520 00521 SIMULATED FUNCTION ComputeDispersal() 00522 { 00523 LOCAL Box MyBoundingBox; 00524 00525 if (bDisperseInBoundingBox) 00526 { 00527 MyBoundingBox=GetBoundingBox(); 00528 if ( MyBoundingBox.IsValid!=0) 00529 { 00530 Fragment_Center=0.5*(MyBoundingBox.Min+MyBoundingBox.Max); 00531 Fragments_Eparpillement=0.5*(MyBoundingBox.Max-MyBoundingBox.Min); 00532 return; 00533 } 00534 } 00535 Fragment_Center=Location; 00536 } 00537 00538 SIMULATED FUNCTION InitializeEmitters() 00539 { 00540 LOCAL Emitter emit, emit2; 00541 LOCAL MeshEmitter meshemit; 00542 00543 if ( Fragments_Type != None ) 00544 { 00545 if ( Walker!=none) 00546 emit=Spawn(Fragments_Type,self,,Fragment_Center+Fragments_Offset,Walker.Rotation); 00547 else 00548 emit=Spawn(Fragments_Type,self,,Fragment_Center+Fragments_Offset); 00549 00550 if (emit!=none) 00551 { 00552 emit.Emitters[0].StartVelocityRange.X.Min=-100+(3*LastDamage*particles_speed.X)*RelativeBlow+Fragments_Blow.X; 00553 emit.Emitters[0].StartVelocityRange.X.Max=100+(3*LastDamage*particles_speed.X)*RelativeBlow+Fragments_Blow.X; 00554 emit.Emitters[0].StartVelocityRange.Y.Min=-100+(3*LastDamage*particles_speed.Y)*RelativeBlow+Fragments_Blow.Y; 00555 emit.Emitters[0].StartVelocityRange.Y.Max=100+(3*LastDamage*particles_speed.Y)*RelativeBlow+Fragments_Blow.Y; 00556 emit.Emitters[0].StartVelocityRange.Z.Min=Fragments_Blow.Z; 00557 emit.Emitters[0].StartVelocityRange.Z.Max=Fragments_Blow.Z; 00558 00559 emit.Emitters[0].StartLocationRange.X.Min=-Fragments_Eparpillement.X; 00560 emit.Emitters[0].StartLocationRange.X.Max=Fragments_Eparpillement.X; 00561 emit.Emitters[0].StartLocationRange.Y.Min=-Fragments_Eparpillement.Y; 00562 emit.Emitters[0].StartLocationRange.Y.Max=Fragments_Eparpillement.Y; 00563 emit.Emitters[0].StartLocationRange.Z.Min=-Fragments_Eparpillement.Z; 00564 emit.Emitters[0].StartLocationRange.Z.Max=Fragments_Eparpillement.Z; 00565 00566 emit.Emitters[0].SetMaxParticles(Fragments_Number); 00567 00568 emit.Emitters[0].StartSizeRange.X.Max=Fragments_ScaleMax; 00569 emit.Emitters[0].StartSizeRange.X.Min=Fragments_ScaleMin; 00570 emit.Emitters[0].StartSizeRange.Y.Max=Fragments_ScaleMax; 00571 emit.Emitters[0].StartSizeRange.Y.Min=Fragments_ScaleMin; 00572 00573 emit.Emitters[0].Texture=FragmentTexture; 00574 emit.Emitters[0].TextureUSubdivisions=FragmentTextureUSubdivisions; 00575 emit.Emitters[0].TextureVSubdivisions=FragmentTextureVSubdivisions; 00576 emit.Emitters[0].DrawStyle=FragmentDrawStyle; 00577 00578 emit.Emitters[0].UseCollision=ParticlesUseCollision; 00579 00580 if ( Fragments_FadeOut ) 00581 { 00582 emit.Emitters[0].FadeOut=true; 00583 emit.Emitters[0].FadeOutStartTime=Fragments_FadeOutBegin; 00584 emit.Emitters[0].LifeTimeRange.Min=Fragments_FadeOutEnd; 00585 emit.Emitters[0].LifeTimeRange.Max=Fragments_FadeOutEnd; 00586 } 00587 } 00588 } 00589 00590 if ((Fragments3D.Type!=None) && (Fragments3D.StaticMesh!=none)) 00591 { 00592 if (Walker!=none) 00593 emit2=Spawn(Fragments3D.Type,self,,Fragment_Center+Fragments3D.Offset,Walker.Rotation); 00594 else 00595 emit2=Spawn(Fragments3D.Type,self,,Fragment_Center+Fragments3D.Offset); 00596 00597 if (emit2!=none) 00598 { 00599 emit2.Emitters[0].StartVelocityRange.X.Min=-100+(3*LastDamage*particles_speed.X)*RelativeBlow+Fragments3D.Blow.X; 00600 emit2.Emitters[0].StartVelocityRange.X.Max=100+(3*LastDamage*particles_speed.X)*RelativeBlow+Fragments3D.Blow.X; 00601 emit2.Emitters[0].StartVelocityRange.Y.Min=-100+(3*LastDamage*particles_speed.Y)*RelativeBlow+Fragments3D.Blow.Y; 00602 emit2.Emitters[0].StartVelocityRange.Y.Max=100+(3*LastDamage*particles_speed.Y)*RelativeBlow+Fragments3D.Blow.Y; 00603 emit2.Emitters[0].StartVelocityRange.Z.Max=Fragments3D.Blow.Z; 00604 emit2.Emitters[0].StartVelocityRange.Z.Min=Fragments3D.Blow.Z; 00605 00606 emit2.Emitters[0].StartLocationRange.X.Min=-Fragments3D.Eparpillement.X; 00607 emit2.Emitters[0].StartLocationRange.X.Max=Fragments3D.Eparpillement.X; 00608 emit2.Emitters[0].StartLocationRange.Y.Min=-Fragments3D.Eparpillement.Y; 00609 emit2.Emitters[0].StartLocationRange.Y.Max=Fragments3D.Eparpillement.Y; 00610 emit2.Emitters[0].StartLocationRange.Z.Min=-Fragments3D.Eparpillement.Z; 00611 emit2.Emitters[0].StartLocationRange.Z.Max=Fragments3D.Eparpillement.Z; 00612 00613 emit2.Emitters[0].SetMaxParticles(Fragments3D.Number); 00614 00615 emit2.Emitters[0].StartSizeRange.X.Max=Fragments3D.ScaleMax; 00616 emit2.Emitters[0].StartSizeRange.X.Min=Fragments3D.ScaleMin; 00617 emit2.Emitters[0].StartSizeRange.Y.Max=Fragments3D.ScaleMax; 00618 emit2.Emitters[0].StartSizeRange.Y.Min=Fragments3D.ScaleMin; 00619 emit2.Emitters[0].StartSizeRange.Z.Max=Fragments3D.ScaleMax; 00620 emit2.Emitters[0].StartSizeRange.Z.Min=Fragments3D.ScaleMin; 00621 00622 emit2.Emitters[0].UseCollision=ParticlesUseCollision; 00623 emit2.bIgnoreDynLight = Fragments3DIgnoreDynLight; 00624 00625 meshemit= MeshEmitter(emit2.Emitters[0]); 00626 00627 if (Fragments3D.FadeOut) 00628 { 00629 emit2.Emitters[0].FadeOut=true; 00630 emit2.Emitters[0].FadeOutStartTime=Fragments3D.FadeOutBegin; 00631 emit2.Emitters[0].LifeTimeRange.Min=Fragments3D.FadeOutEnd; 00632 emit2.Emitters[0].LifeTimeRange.Max=Fragments3D.FadeOutEnd; 00633 if (meshemit!=none) 00634 meshemit.UseMeshBlendMode=false; 00635 emit2.Emitters[0].DrawStyle=PTDS_AlphaBlend; 00636 } 00637 00638 if (meshemit!=none) 00639 meshemit.StaticMesh=Fragments3D.StaticMesh; 00640 } 00641 } 00642 00643 if (ExplosiveEmitter!=none) 00644 { 00645 if (ExplosiveEmitter!=class'XIIIExplosiveEmitter') 00646 { 00647 if ( Walker!=none ) 00648 emit=Spawn(ExplosiveEmitter,self,,Location+ExplosiveEmitterOffset,Walker.Rotation); 00649 else 00650 emit=Spawn(ExplosiveEmitter,self,,Location+ExplosiveEmitterOffset); 00651 } 00652 else 00653 { 00654 if ((Fire.Type!=FT_None) || (Smoke.Type!=ST_None) || (Onomatop.Type!=OT_None) 00655 || (FireTexture!=None) || (SmokeTexture!=None) || (OnomatopTexture!=None) 00656 ) 00657 { 00658 if ( Walker!=none ) 00659 emit=Spawn(ExplosiveEmitter,self,,Location+ExplosiveEmitterOffset,Walker.Rotation); 00660 else 00661 emit=Spawn(ExplosiveEmitter,self,,Location+ExplosiveEmitterOffset); 00662 } 00663 00664 if ( FireTexture!=None ) 00665 { 00666 emit.Emitters[0].Texture = FireTexture; 00667 emit.Emitters[0].StartLocationRange.X.Min=-Fire.Dispersal.X; 00668 emit.Emitters[0].StartLocationRange.X.Max=Fire.Dispersal.X; 00669 emit.Emitters[0].StartLocationRange.Y.Min=-Fire.Dispersal.Y; 00670 emit.Emitters[0].StartLocationRange.Y.Max=Fire.Dispersal.Y; 00671 emit.Emitters[0].StartLocationRange.Z.Min=-Fire.Dispersal.Z; 00672 emit.Emitters[0].StartLocationRange.Z.Max=Fire.Dispersal.Z; 00673 emit.Emitters[0].StartLocationOffset=Fire.Offset; 00674 00675 emit.Emitters[0].SetMaxParticles(Fire.Number); 00676 emit.Emitters[0].NoSynchroAnim=true; 00677 emit.Emitters[0].RespawnDeadParticles=False; 00678 emit.Emitters[0].UseRotationFrom=PTRS_Actor; 00679 00680 emit.Emitters[0].OnceTextureAnim=Fire.OneTextureAnimOnly; 00681 emit.Emitters[0].InitialParticlesPerSecond=10.0; 00682 emit.Emitters[0].AutomaticInitialSpawning=False; 00683 if (Fire.LifeTime==0.0) 00684 Fire.LifeTime=0.1; 00685 emit.Emitters[0].LifetimeRange.Min=Fire.LifeTime; 00686 emit.Emitters[0].LifetimeRange.Max=Fire.LifeTime; 00687 00688 if (Fire.FadeOut) 00689 { 00690 emit.Emitters[0].FadeOut=true; 00691 emit.Emitters[0].FadeOutStartTime=Fire.FadeOutBegin; 00692 } 00693 00694 emit.Emitters[0].DrawStyle=Fire.DrawStyle; 00695 00696 emit.Emitters[0].StartSizeRange.X.Max=Fire.ScaleMax; 00697 emit.Emitters[0].StartSizeRange.X.Min=Fire.ScaleMin; 00698 emit.Emitters[0].Disabled=false; 00699 } 00700 if ( SmokeTexture!=None ) 00701 { 00702 emit.Emitters[1].Texture = SmokeTexture; 00703 emit.Emitters[1].StartLocationRange.X.Min=-Smoke.Dispersal.X; 00704 emit.Emitters[1].StartLocationRange.X.Max=Smoke.Dispersal.X; 00705 emit.Emitters[1].StartLocationRange.Y.Min=-Smoke.Dispersal.Y; 00706 emit.Emitters[1].StartLocationRange.Y.Max=Smoke.Dispersal.Y; 00707 emit.Emitters[1].StartLocationRange.Z.Min=-Smoke.Dispersal.Z; 00708 emit.Emitters[1].StartLocationRange.Z.Max=Smoke.Dispersal.Z; 00709 emit.Emitters[1].StartLocationOffset=Smoke.Offset; 00710 00711 emit.Emitters[1].SetMaxParticles(Smoke.Number); 00712 emit.Emitters[1].NoSynchroAnim=true; 00713 emit.Emitters[1].RespawnDeadParticles=False; 00714 emit.Emitters[1].UseRotationFrom=PTRS_Actor; 00715 00716 emit.Emitters[1].OnceTextureAnim=Smoke.OneTextureAnimOnly; 00717 emit.Emitters[1].InitialParticlesPerSecond=10.0; 00718 emit.Emitters[1].AutomaticInitialSpawning=False; 00719 if (Smoke.LifeTime==0.0) 00720 Smoke.LifeTime=0.1; 00721 emit.Emitters[1].LifetimeRange.Min=Smoke.LifeTime; 00722 emit.Emitters[1].LifetimeRange.Max=Smoke.LifeTime; 00723 if (Smoke.FadeOut) 00724 { 00725 emit.Emitters[1].FadeOut=true; 00726 emit.Emitters[1].FadeOutStartTime=Smoke.FadeOutBegin; 00727 } 00728 00729 emit.Emitters[1].DrawStyle=Smoke.DrawStyle; 00730 00731 emit.Emitters[1].StartSizeRange.X.Max=Smoke.ScaleMax; 00732 emit.Emitters[1].StartSizeRange.X.Min=Smoke.ScaleMin; 00733 emit.Emitters[1].Disabled=false; 00734 } 00735 00736 if ((Onomatop.Type!=OT_None) || (OnomatopTexture!=None)) 00737 { 00738 if (OnomatopTexture!=None) 00739 emit.Emitters[2].Texture = OnomatopTexture; 00740 else 00741 emit.Emitters[2].Texture = OnomatopTextures[Onomatop.Type]; 00742 emit.Emitters[2].StartLocationRange.X.Min=-Onomatop.Dispersal.X; 00743 emit.Emitters[2].StartLocationRange.X.Max=Onomatop.Dispersal.X; 00744 emit.Emitters[2].StartLocationRange.Y.Min=-Onomatop.Dispersal.Y; 00745 emit.Emitters[2].StartLocationRange.Y.Max=Onomatop.Dispersal.Y; 00746 emit.Emitters[2].StartLocationRange.Z.Min=-Onomatop.Dispersal.Z; 00747 emit.Emitters[2].StartLocationRange.Z.Max=Onomatop.Dispersal.Z; 00748 emit.Emitters[2].StartLocationOffset=Onomatop.Offset; 00749 00750 emit.Emitters[2].SetMaxParticles(Onomatop.Number); 00751 if (Onomatop.LifeTime==0.0) 00752 Onomatop.LifeTime=0.1; 00753 emit.Emitters[2].LifetimeRange.Min=Onomatop.LifeTime; 00754 emit.Emitters[2].LifetimeRange.Max=Onomatop.LifeTime; 00755 00756 emit.Emitters[2].DrawStyle=Onomatop.DrawStyle; 00757 00758 emit.Emitters[2].StartSizeRange.X.Max=Onomatop.ScaleMax; 00759 emit.Emitters[2].StartSizeRange.X.Min=Onomatop.ScaleMin; 00760 emit.Emitters[2].Disabled=false; 00761 } 00762 } 00763 } 00764 } 00765 00766 SIMULATED FUNCTION Breaking( float fDelay ) 00767 { 00768 Disable('Bump'); 00769 00770 DelayToUse=fDelay; 00771 00772 if (Level.NetMode == NM_StandAlone) 00773 InitDazzleAndShake(false); 00774 00775 if ( ((DrawType==DT_StaticMesh) && (breakingmesh!=none)) || (DrawType==DT_Mesh) ) 00776 { 00777 GotoState('STA_BreakingAnim'); 00778 return; 00779 } 00780 00781 if (fDelay==0.0) 00782 Breaked(); 00783 else 00784 GotoState('STA_Breaking'); 00785 } 00786 00787 FUNCTION FastBreak() 00788 { 00789 LOG( "FASTBREAK"@self ); 00790 bBreaking = false; 00791 bBroken = true; 00792 bNoInteractionIcon = true; 00793 if(BreakedStaticMesh!=none) 00794 { 00795 StaticMesh=BreakedStaticMesh; 00796 } 00797 else 00798 Destroy(); 00799 } 00800 00801 simulated FUNCTION Breaked() 00802 { 00803 Local Pickup TheDecoPickupGenerated; // ELR the deco thing to pickup 00804 00805 ComputeDispersal(); 00806 if (event!='') 00807 TriggerEvent(event,self,none); 00808 00809 bBreaking = false; 00810 bBroken = true; 00811 bNoInteractionIcon = true; 00812 PlaySound( SoundWhenBroken, ExplosiveType ); 00813 if (Level.NetMode == NM_StandAlone) 00814 InitDazzleAndShake(true); 00815 InitializeEmitters(); 00816 00817 if ( DecoPickupGenerated != none ) 00818 { 00819 TheDecoPickupGenerated = Spawn(DecoPickupGenerated,,,Location); 00820 TheDecoPickupGenerated.InitDroppedPickupFor(none); 00821 } 00822 00823 switch (DrawType) 00824 { 00825 case DT_StaticMesh: 00826 if(BreakedStaticMesh!=none) 00827 { 00828 StaticMesh=BreakedStaticMesh; 00829 } 00830 else 00831 if (FD_bRunning || Level.NetMode != NM_StandAlone) 00832 { 00833 bHidden=true; 00834 RefreshDisplaying(); 00835 // SetCollision(false,false,false); 00836 bToBeDestroyed=true; 00837 } 00838 else 00839 Destroy(); 00840 break; 00841 default: 00842 if (FD_bRunning || Level.NetMode != NM_StandAlone) 00843 { 00844 bHidden=true; 00845 RefreshDisplaying(); 00846 // SetCollision(false,false,false); 00847 bToBeDestroyed=true; 00848 } 00849 else 00850 Destroy(); 00851 break; 00852 } 00853 00854 // if (CollisionWhenBreaked==false) 00855 SetCollision(CollisionWhenBreaked,CollisionWhenBreaked,CollisionWhenBreaked); 00856 00857 if ( Walker!=none && Walker.Base==self ) 00858 { 00859 Walker.DropToGround(); 00860 Walker.Acceleration = vect(0,0,0); 00861 } 00862 00863 GotoState(''); 00864 } 00865 00866 STATE STA_BreakingAnim 00867 { 00868 EVENT AnimEnd(int Channel) 00869 { 00870 SetDrawType(MemoDrawType); 00871 Breaked(); 00872 Mesh=none; 00873 } 00874 begin: 00875 Sleep(DelayToUse); 00876 Mesh=breakingmesh; 00877 StaticMesh=none; 00878 MemoDrawType=DrawType; 00879 SetDrawType(DT_Mesh); 00880 PlayAnim( BreakedMeshAnim ); 00881 stop; 00882 00883 } 00884 00885 STATE STA_Breaking 00886 { 00887 IGNORES Bump,TakeDamage; 00888 00889 EVENT BeginState() 00890 { 00891 bBreaking=true; 00892 TempsContact=0; 00893 } 00894 00895 EVENT Tick(float dt) 00896 { 00897 LOCAL ROTATOR r; 00898 00899 Global.Tick(dt); 00900 00901 if ( bMustShakeWhileDelay ) 00902 { 00903 r.Yaw=0; 00904 r.Pitch=FRand()*128-64; 00905 r.Roll=FRand()*128-64; 00906 SetRotation(r); 00907 } 00908 TempsContact+=dt; 00909 if (TempsContact>DelayToUse) 00910 Breaked(); 00911 } 00912 } 00913 00914 00915 00916 defaultproperties 00917 { 00918 ParticlesUseCollision=True 00919 bDisperseInBoundingBox=True 00920 bVulnerableBladeCut=True 00921 bVulnerableGrenade=True 00922 bVulnerableGun=True 00923 bVulnerableShotgun=True 00924 bVulnerableStunning=True 00925 bVulnerablePiercing=True 00926 bVulnerableToFist=True 00927 Fragments_FadeOut=True 00928 Fragments3DIgnoreDynLight=True 00929 RelativeBlow=1.000000 00930 Fragments_ScaleMin=10.000000 00931 Fragments_ScaleMax=10.000000 00932 Fragments_FadeOutBegin=3.000000 00933 Fragments_FadeOutEnd=5.000000 00934 SC_lifetime=3.000000 00935 SC_intensity=1.000000 00936 SC_distance_end=1024.000000 00937 FD_lifetime=0.400000 00938 FD_intensity=1.100000 00939 FD_distance_start=512.000000 00940 FD_distance_end=1024.000000 00941 FragmentTextureUSubdivisions=1 00942 FragmentTextureVSubdivisions=1 00943 Fragments_Number=50 00944 BreakPoint=-1 00945 Fragments_Eparpillement=(X=100.000000,Y=100.000000,Z=100.000000) 00946 FragmentTexture=Texture'XIIICine.effets.glass13' 00947 OnomatopTextures(1)=Texture'XIIICine.effets.Baommm' 00948 OnomatopTextures(3)=Texture'XIIICine.effets.crac' 00949 OnomatopTextures(4)=Texture'XIIICine.effets.cling' 00950 OnomatopTextures(5)=Texture'XIIICine.effets.Blam' 00951 FD_color=(B=255,G=255,R=255) 00952 Fragments_Type=Class'XIDCine.XIIIBreakingGlassEmitter' 00953 FragmentDrawStyle=PTDS_Translucent 00954 Fragments3D=(Number=10,ScaleMin=1.000000,ScaleMax=1.000000,FadeOutBegin=1.000000,FadeOutEnd=2.000000) 00955 Fire=(Number=1,ScaleMin=100.000000,ScaleMax=100.000000) 00956 Smoke=(Number=1,ScaleMin=100.000000,ScaleMax=100.000000) 00957 Onomatop=(Number=1,ScaleMin=100.000000,ScaleMax=100.000000) 00958 ExplosiveEmitter=Class'XIDCine.XIIIExplosiveEmitter' 00959 Health=10 00960 bBreakable=True 00961 bNoDelete=False 00962 bMovable=False 00963 Physics=PHYS_None 00964 InitialState="None" 00965 bPathColliding=True 00966 }

End Source Code