Core.Object | +--Engine.Actor | +--Engine.Decoration | +--Engine.Carcass | +--Botpack.UTHumanCarcass
ZoneInfo
DeathZone
float
ExistTime
sound
GibSounds[4]
LandedSound
class
MasterReplacement
Decal
Pool
bool
bGreenBlood
void
AnimEnd()
ChunkUp(int Damage)
CreateReplacement()
simulated
Destroyed()
GibSound()
HitWall(vector HitNormal, Actor Wall)
Initfor(Actor Other)
LandThump()
Landed(vector HitNormal)
LieStill()
PostBeginPlay()
ReduceCylinder()
SpawnHead()
TakeDamage(int Damage, Pawn InstigatedBy, Vector Hitlocation, Vector Momentum, name DamageType)
BeginState()
Tick(float DeltaTime)
Timer()
CheckZoneCarcasses()
AddFliesAndRats()
00001 //============================================================================= 00002 // UTHumanCarcass. 00003 //============================================================================= 00004 class UTHumanCarcass extends Carcass 00005 abstract; 00006 00007 #exec AUDIO IMPORT FILE="Sounds\Male\gib01.WAV" NAME="NewGib" GROUP="Male" 00008 00009 var class<UTMasterCreatureChunk> MasterReplacement; 00010 var() bool bGreenBlood; 00011 var bool bThumped; 00012 var bool bPermanent; 00013 var bool bCorroding; 00014 var ZoneInfo DeathZone; 00015 var float ReducedHeightFactor; 00016 var float ExistTime; 00017 var() sound LandedSound; 00018 var() sound GibSounds[4]; 00019 var Decal Pool; 00020 00021 function PostBeginPlay() 00022 { 00023 if ( !bDecorative ) 00024 { 00025 DeathZone = Region.Zone; 00026 DeathZone.NumCarcasses++; 00027 } 00028 Super.PostBeginPlay(); 00029 if ( Physics == PHYS_None ) 00030 SetCollision(bCollideActors, false, false); 00031 } 00032 00033 function GibSound() 00034 { 00035 local int r; 00036 00037 r = Rand(4); 00038 PlaySound(GibSounds[r], SLOT_Interact, 16); 00039 PlaySound(GibSounds[r], SLOT_Misc, 12); 00040 } 00041 00042 simulated function Destroyed() 00043 { 00044 if ( Pool != None ) 00045 Pool.Destroy(); 00046 if ( !bDecorative ) 00047 DeathZone.NumCarcasses--; 00048 Super.Destroyed(); 00049 } 00050 00051 function CreateReplacement() 00052 { 00053 local UTMasterCreatureChunk carc; 00054 local UT_BloodBurst b; 00055 00056 if (bHidden) 00057 return; 00058 00059 b = Spawn(class'UT_BigBloodHit',,,Location, rot(-16384,0,0)); 00060 if ( bGreenBlood ) 00061 b.GreenBlood(); 00062 00063 carc = Spawn(MasterReplacement,,, Location + CollisionHeight * vect(0,0,0.5)); 00064 if (carc != None) 00065 { 00066 carc.PlayerRep = PlayerOwner; 00067 carc.Initfor(self); 00068 carc.Bugs = Bugs; 00069 if ( Bugs != None ) 00070 Bugs.SetBase(carc); 00071 Bugs = None; 00072 } 00073 else if ( Bugs != None ) 00074 Bugs.Destroy(); 00075 } 00076 00077 function SpawnHead() 00078 { 00079 } 00080 00081 function Initfor(actor Other) 00082 { 00083 local int i; 00084 local rotator carcRotation; 00085 00086 PlayerOwner = Pawn(Other).PlayerReplicationInfo; 00087 bReducedHeight = false; 00088 PrePivot = vect(0,0,3); 00089 for ( i=0; i<4; i++ ) 00090 Multiskins[i] = Pawn(Other).MultiSkins[i]; 00091 00092 if ( bDecorative ) 00093 { 00094 DeathZone = Region.Zone; 00095 DeathZone.NumCarcasses++; 00096 } 00097 bDecorative = false; 00098 bMeshCurvy = Other.bMeshCurvy; 00099 bMeshEnviroMap = Other.bMeshEnviroMap; 00100 Mesh = Other.Mesh; 00101 Skin = Other.Skin; 00102 Texture = Other.Texture; 00103 Fatness = Other.Fatness; 00104 DrawScale = Other.DrawScale; 00105 SetCollisionSize(Other.CollisionRadius + 4, Other.CollisionHeight); 00106 if ( !SetLocation(Location) ) 00107 SetCollisionSize(CollisionRadius - 4, CollisionHeight); 00108 00109 DesiredRotation = other.Rotation; 00110 DesiredRotation.Roll = 0; 00111 DesiredRotation.Pitch = 0; 00112 AnimSequence = Other.AnimSequence; 00113 AnimFrame = Other.AnimFrame; 00114 AnimRate = Other.AnimRate; 00115 TweenRate = Other.TweenRate; 00116 AnimMinRate = Other.AnimMinRate; 00117 AnimLast = Other.AnimLast; 00118 bAnimLoop = Other.bAnimLoop; 00119 SimAnim.X = 10000 * AnimFrame; 00120 SimAnim.Y = 5000 * AnimRate; 00121 SimAnim.Z = 1000 * TweenRate; 00122 SimAnim.W = 10000 * AnimLast; 00123 bAnimFinished = Other.bAnimFinished; 00124 Velocity = other.Velocity; 00125 Mass = Other.Mass; 00126 if ( Buoyancy < 0.8 * Mass ) 00127 Buoyancy = 0.9 * Mass; 00128 } 00129 00130 00131 function ReduceCylinder() 00132 { 00133 local float OldHeight; 00134 local vector OldLocation; 00135 00136 RemoteRole=ROLE_DumbProxy; 00137 bReducedHeight = true; 00138 SetCollision(bCollideActors,False,False); 00139 OldHeight = CollisionHeight; 00140 if ( ReducedHeightFactor < Default.ReducedHeightFactor ) 00141 SetCollisionSize(CollisionRadius, CollisionHeight * ReducedHeightFactor); 00142 else 00143 SetCollisionSize(CollisionRadius + 4, CollisionHeight * ReducedHeightFactor); 00144 PrePivot = vect(0,0,1) * (OldHeight - CollisionHeight); 00145 OldLocation = Location; 00146 if ( !SetLocation(OldLocation - PrePivot) ) 00147 { 00148 SetCollisionSize(CollisionRadius - 4, CollisionHeight); 00149 if ( !SetLocation(OldLocation - PrePivot) ) 00150 { 00151 SetCollisionSize(CollisionRadius, OldHeight); 00152 SetCollision(false, false, false); 00153 PrePivot = vect(0,0,0); 00154 if ( !SetLocation(OldLocation) ) 00155 ChunkUp(200); 00156 } 00157 } 00158 PrePivot = PrePivot + vect(0,0,3); 00159 Mass = Mass * 0.8; 00160 Buoyancy = Buoyancy * 0.8; 00161 } 00162 00163 function TakeDamage( int Damage, Pawn InstigatedBy, Vector Hitlocation, 00164 Vector Momentum, name DamageType) 00165 { 00166 local UT_BloodBurst b; 00167 00168 b = Spawn(class'UT_BloodHit',,,HitLocation, rotator(Momentum)); 00169 if ( bGreenBlood ) 00170 b.GreenBlood(); 00171 if ( !bPermanent ) 00172 { 00173 if ( (DamageType == 'Corroded') && (Damage >= 100) ) 00174 { 00175 bCorroding = true; 00176 GotoState('Corroding'); 00177 } 00178 else 00179 { 00180 if ( !bDecorative ) 00181 { 00182 bBobbing = false; 00183 SetPhysics(PHYS_Falling); 00184 } 00185 if ( (Physics == PHYS_None) && (Momentum.Z < 0) ) 00186 Momentum.Z *= -1; 00187 Velocity += 3 * momentum/(Mass + 200); 00188 if ( DamageType == 'shot' ) 00189 Damage *= 0.4; 00190 CumulativeDamage += Damage; 00191 if ( (((Damage > 30) || !IsAnimating()) && (CumulativeDamage > 0.8 * Mass)) || (Damage > 0.4 * Mass) 00192 || ((Velocity.Z > 150) && !IsAnimating()) ) 00193 ChunkUp(Damage); 00194 if ( bDecorative ) 00195 Velocity = vect(0,0,0); 00196 } 00197 } 00198 } 00199 00200 function ChunkUp(int Damage) 00201 { 00202 if ( bPermanent ) 00203 return; 00204 if ( Region.Zone.bPainZone && (Region.Zone.DamagePerSec > 0) ) 00205 { 00206 if ( Bugs != None ) 00207 Bugs.Destroy(); 00208 } 00209 else 00210 CreateReplacement(); 00211 SetPhysics(PHYS_None); 00212 bHidden = true; 00213 SetCollision(false,false,false); 00214 bProjTarget = false; 00215 GotoState('Gibbing'); 00216 } 00217 00218 simulated function Landed(vector HitNormal) 00219 { 00220 local rotator finalRot; 00221 local float OldHeight; 00222 00223 if ( (Velocity.Z < -1000) && !bPermanent ) 00224 { 00225 ChunkUp(200); 00226 return; 00227 } 00228 00229 finalRot = Rotation; 00230 finalRot.Roll = 0; 00231 finalRot.Pitch = 0; 00232 setRotation(finalRot); 00233 SetPhysics(PHYS_None); 00234 SetCollision(bCollideActors, false, false); 00235 if ( HitNormal.Z < 0.99 ) 00236 ReducedHeightFactor = 0.1; 00237 if ( HitNormal.Z < 0.93 ) 00238 ReducedHeightFactor = 0.0; 00239 if ( !IsAnimating() ) 00240 LieStill(); 00241 00242 if ( Level.NetMode == NM_DedicatedServer ) 00243 return; 00244 if ( Pool == None ) 00245 Pool = Spawn(class'UTBloodPool2',,,Location, rotator(HitNormal)); 00246 else 00247 Spawn(class'BloodSplat',,,Location, rotator(HitNormal + 0.5 * VRand())); 00248 } 00249 00250 function AnimEnd() 00251 { 00252 if ( Physics == PHYS_None ) 00253 LieStill(); 00254 else if ( Region.Zone.bWaterZone ) 00255 { 00256 bThumped = true; 00257 LieStill(); 00258 } 00259 } 00260 00261 function LieStill() 00262 { 00263 SimAnim.X = 10000 * AnimFrame; 00264 SimAnim.Y = 5000 * AnimRate; 00265 if ( !bThumped && !bDecorative ) 00266 LandThump(); 00267 if ( !bReducedHeight ) 00268 ReduceCylinder(); 00269 } 00270 00271 function LandThump() 00272 { 00273 local float impact; 00274 00275 if ( Physics == PHYS_None) 00276 { 00277 bThumped = true; 00278 if ( Role == ROLE_Authority ) 00279 { 00280 impact = 0.75 + Velocity.Z * 0.004; 00281 impact = Mass * impact * impact * 0.015; 00282 PlaySound(LandedSound,, impact); 00283 } 00284 } 00285 } 00286 00287 simulated function HitWall(vector HitNormal, actor Wall) 00288 { 00289 local UT_BloodBurst b; 00290 00291 b = Spawn(class 'UT_BloodBurst'); 00292 if ( bGreenBlood ) 00293 b.GreenBlood(); 00294 b.RemoteRole = ROLE_None; 00295 Velocity = 0.7 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal)); 00296 Velocity.Z *= 0.9; 00297 if ( Abs(Velocity.Z) < 120 ) 00298 { 00299 bBounce = false; 00300 Disable('HitWall'); 00301 } 00302 } 00303 00304 auto state Dying 00305 { 00306 ignores TakeDamage; 00307 00308 simulated function BeginState() 00309 { 00310 Super.BeginState(); 00311 if ( (PlayerOwner != None) && PlayerOwner.Owner.IsA('PlayerPawn') 00312 && PlayerOwner.Owner.IsInState('Dying') ) 00313 PlayerOwner.Owner.bHidden = true; 00314 } 00315 00316 Begin: 00317 if ( bCorroding ) 00318 GotoState('Corroding'); 00319 if ( bDecorative && !bReducedHeight ) 00320 { 00321 ReduceCylinder(); 00322 SetPhysics(PHYS_None); 00323 } 00324 Sleep(0.2); 00325 if ( bCorroding ) 00326 GotoState('Corroding'); 00327 GotoState('Dead'); 00328 } 00329 00330 state Dead 00331 { 00332 function AddFliesAndRats() 00333 { 00334 } 00335 00336 function CheckZoneCarcasses() 00337 { 00338 local UTHumanCarcass C, Best; 00339 00340 if ( !bDecorative && (DeathZone.NumCarcasses > DeathZone.MaxCarcasses) ) 00341 { 00342 Best = self; 00343 ForEach AllActors(class'UTHumanCarcass', C) 00344 if ( (C != Self) && !C.bDecorative && (C.DeathZone == DeathZone) && !C.IsAnimating() ) 00345 { 00346 if ( Best == self ) 00347 Best = C; 00348 else if ( !C.PlayerCanSeeMe() ) 00349 { 00350 Best = C; 00351 break; 00352 } 00353 } 00354 Best.Destroy(); 00355 } 00356 } 00357 00358 function Timer() 00359 { 00360 if ( ExistTime <= 0 ) 00361 Super.Timer(); 00362 else 00363 { 00364 SetPhysics(Phys_Falling); 00365 ExistTime -= 3.0; 00366 } 00367 } 00368 00369 singular event BaseChange() 00370 { 00371 if ( Pawn(Base) != None ) 00372 { 00373 ChunkUp(200); 00374 return; 00375 } 00376 00377 if ( (Mover(Base) != None) && (ExistTime == 0) ) 00378 { 00379 ExistTime = 10; 00380 SetTimer(3.0, true); 00381 } 00382 00383 Super.BaseChange(); 00384 } 00385 00386 function BeginState() 00387 { 00388 if ( bDecorative || bPermanent 00389 || ((Level.NetMode == NM_Standalone) && Level.Game.IsA('SinglePlayer')) ) 00390 lifespan = 0.0; 00391 else 00392 { 00393 if ( Mover(Base) != None ) 00394 { 00395 ExistTime = 12; 00396 SetTimer(3.0, true); 00397 } 00398 else 00399 SetTimer(12, false); 00400 } 00401 } 00402 00403 } 00404 00405 state Gibbing 00406 { 00407 ignores Landed, HitWall, AnimEnd, TakeDamage, ZoneChange; 00408 00409 Begin: 00410 Sleep(0.25); 00411 GibSound(); 00412 if ( !bPlayerCarcass ) 00413 Destroy(); 00414 } 00415 00416 state Corroding 00417 { 00418 ignores Landed, HitWall, AnimEnd, TakeDamage, ZoneChange; 00419 00420 function Tick( float DeltaTime ) 00421 { 00422 local int NewFatness; 00423 local float splashSize; 00424 local actor splash; 00425 00426 NewFatness = fatness - 80 * DeltaTime; 00427 if ( NewFatness < 85 ) 00428 { 00429 if ( Region.Zone.bWaterZone && Region.Zone.bDestructive ) 00430 { 00431 splashSize = FClamp(0.0002 * Mass * (250 - 0.5 * FMax(-600,Velocity.Z)), 1.0, 4.0 ); 00432 if ( Region.Zone.ExitSound != None ) 00433 PlaySound(Region.Zone.ExitSound, SLOT_Interact, splashSize); 00434 if ( Region.Zone.ExitActor != None ) 00435 { 00436 splash = Spawn(Region.Zone.ExitActor); 00437 if ( splash != None ) 00438 splash.DrawScale = splashSize; 00439 } 00440 } 00441 Destroy(); 00442 } 00443 fatness = Clamp(NewFatness, 0, 255); 00444 } 00445 00446 function BeginState() 00447 { 00448 Disable('Tick'); 00449 } 00450 00451 Begin: 00452 Sleep(0.5); 00453 Enable('Tick'); 00454 } 00455 00456 defaultproperties 00457 { 00458 ReducedHeightFactor=0.300000 00459 LandedSound=Sound'UnrealShare.Gibs.Thump' 00460 GibSounds(0)=Sound'UnrealShare.Gibs.Gib1' 00461 GibSounds(1)=Sound'Botpack.Male.NewGib' 00462 GibSounds(2)=Sound'UnrealShare.Gibs.Gib4' 00463 GibSounds(3)=Sound'UnrealShare.Gibs.Gib5' 00464 bReducedHeight=True 00465 bSlidingCarcass=True 00466 RemoteRole=ROLE_SimulatedProxy 00467 PrePivot=(Z=28.000000) 00468 TransientSoundVolume=3.000000 00469 CollisionRadius=27.000000 00470 CollisionHeight=13.000000 00471 NetPriority=2.500000 00472 }