Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TakeDamage(int Damage, Pawn instigatedBy, Vector HitLocation, Vector Momentum, class<DamageType> DamageType, optional int HitIdx)
- {
- local class<KFWeaponDamageType> KFDamType;
- local KFPlayerReplicationInfo InstigatorPRI;
- local int OldHealth, OriginalDamage;
- if(instigatedBy != none)
- {
- InstigatorPRI = KFPlayerReplicationInfo(instigatedBy.PlayerReplicationInfo);
- }
- if(DamageType == none)
- {
- DamageType = class'DamageType';
- }
- if((Controller != none) && Controller.bGodMode)
- {
- return;
- }
- KFDamType = class<KFWeaponDamageType>(DamageType);
- OriginalDamage = Damage;
- OldHealth = Health;
- // copied from KFPawn to adjust player-to-player damage -- PooSH
- LastHitDamType = damageType;
- LastDamagedBy = instigatedBy;
- LastDamageTime = Level.TimeSeconds;
- if ( KFDamType != none && KFHumanPawn(InstigatedBy) != none ) {
- // HDMG
- if ( InstigatorPRI != none && InstigatorPRI.ClientVeteranSkill != none )
- Damage = InstigatorPRI.ClientVeteranSkill.Static.AddDamage(InstigatorPRI, none, KFHumanPawn(instigatedBy), Damage, DamageType);
- if ( LastExplosionTime == Level.TimeSeconds && LastExplosionDistance > 50 )
- Damage *= (1.0 - lerp( LastExplosionDistance / 200, 0.0, 1.00, true ));
- if ( KFDamType.default.bDealBurningDamage ) {
- if ( class<DamTypeMAC10MPInc>(KFDamType) == none )
- Damage *= 1.50; // Increase burn damage 1.5 times, except MAC10.
- }
- else if ( KFDamType.default.bIsExplosive ) {
- if ( KFDamType != class'DamTypeFrag' )
- Damage *= 0.70;
- }
- else if ( KFDamType.default.bIsMeleeDamage ) {
- if ( ClassIsChildOf(KFDamType, class'DamTypeCrossbuzzsaw') )
- Damage *= 0.80;
- }
- }
- if(instigatedBy == none)
- {
- if((KFDamType != none) && class<DamTypeZombieAttack>(KFDamType) == none)
- {
- return;
- }
- }
- else
- {
- if(KFMonster(instigatedBy) != none)
- {
- KFMonster(instigatedBy).bDamagedAPlayer = true;
- }
- else
- {
- if(KFHumanPawn(instigatedBy) != none)
- {
- InstigatorPRI = KFPlayerReplicationInfo(instigatedBy.PlayerReplicationInfo);
- Momentum = vect(0.0, 0.0, 0.0);
- if((InstigatorPRI != none) && InstigatorPRI.bOnlySpectator)
- {
- return;
- }
- }
- }
- }
- super(xPawn).TakeDamage(Damage, instigatedBy, HitLocation, Momentum, DamageType);
- if( class<DamTypeVomit>(DamageType)!=none ) {
- BileCount=7;
- BileInstigator = instigatedBy;
- LastBileDamagedByType=class<DamTypeVomit>(DamageType);
- if(NextBileTime< Level.TimeSeconds )
- NextBileTime = Level.TimeSeconds+BileFrequency;
- if ( Level.Game != none && Level.Game.GameDifficulty >= 4.0 && KFPlayerController(Controller) != none &&
- !KFPlayerController(Controller).bVomittedOn)
- {
- KFPlayerController(Controller).bVomittedOn = true;
- KFPlayerController(Controller).VomittedOnTime = Level.TimeSeconds;
- if ( Controller.TimerRate == 0.0 )
- Controller.SetTimer(10.0, false);
- }
- }
- else if ( class<SirenScreamDamage>(DamageType) != none ) {
- if ( Level.Game != none && Level.Game.GameDifficulty >= 4.0 && KFPlayerController(Controller) != none &&
- !KFPlayerController(Controller).bScreamedAt)
- {
- KFPlayerController(Controller).bScreamedAt = true;
- KFPlayerController(Controller).ScreamTime = Level.TimeSeconds;
- if ( Controller.TimerRate == 0.0 )
- Controller.SetTimer(10.0, false);
- }
- }
- //Bloody Overlays
- if ( Health <= 50 )
- SetOverlayMaterial(InjuredOverlay,0, true);
- // SERVER-SIDE ONLY
- if ( Role < ROLE_Authority )
- return;
- if ( KFDamType != none ) {
- if ( KFDamType.default.bDealBurningDamage ) {
- // Do burn damage if the damage was significant enough
- if( Damage > 2 ) {
- // If we are already burning, and this damage is more than our current burn amount, add more burn time
- if( BurnDown == 0 || OriginalDamage > LastBurnDamage ) {
- if ( InstigatedBy != self && KFPawn(InstigatedBy) != none )
- BurnDown = 8;
- else
- BurnDown = 5;
- BurnInstigator = InstigatedBy;
- LastBurnDamage = OriginalDamage;
- bBurnified = true;
- }
- }
- }
- }
- // added null check for Instigator -- PooSH
- if ( Level.Game.NumPlayers > 1 && Instigator != none && PlayerController(Instigator.Controller) != none
- && Health < 25 && Level.TimeSeconds - LastDyingMessageTime > DyingMessageDelay )
- {
- // Tell everyone we're dying
- PlayerController(Instigator.Controller).Speech('AUTO', 6, "");
- LastDyingMessageTime = Level.TimeSeconds;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment