Trebit

Untitled

May 26th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.20 KB | None | 0 0
  1. function TakeDamage(int Damage, Pawn instigatedBy, Vector HitLocation, Vector Momentum, class<DamageType> DamageType, optional int HitIdx)
  2. {
  3. local class<KFWeaponDamageType> KFDamType;
  4. local KFPlayerReplicationInfo InstigatorPRI;
  5. local int OldHealth, OriginalDamage;
  6.  
  7. if(instigatedBy != none)
  8. {
  9. InstigatorPRI = KFPlayerReplicationInfo(instigatedBy.PlayerReplicationInfo);
  10. }
  11. if(DamageType == none)
  12. {
  13. DamageType = class'DamageType';
  14. }
  15. if((Controller != none) && Controller.bGodMode)
  16. {
  17. return;
  18. }
  19. KFDamType = class<KFWeaponDamageType>(DamageType);
  20.  
  21. OriginalDamage = Damage;
  22. OldHealth = Health;
  23. // copied from KFPawn to adjust player-to-player damage -- PooSH
  24. LastHitDamType = damageType;
  25. LastDamagedBy = instigatedBy;
  26. LastDamageTime = Level.TimeSeconds;
  27.  
  28. if ( KFDamType != none && KFHumanPawn(InstigatedBy) != none ) {
  29. // HDMG
  30. if ( InstigatorPRI != none && InstigatorPRI.ClientVeteranSkill != none )
  31. Damage = InstigatorPRI.ClientVeteranSkill.Static.AddDamage(InstigatorPRI, none, KFHumanPawn(instigatedBy), Damage, DamageType);
  32. if ( LastExplosionTime == Level.TimeSeconds && LastExplosionDistance > 50 )
  33. Damage *= (1.0 - lerp( LastExplosionDistance / 200, 0.0, 1.00, true ));
  34.  
  35. if ( KFDamType.default.bDealBurningDamage ) {
  36. if ( class<DamTypeMAC10MPInc>(KFDamType) == none )
  37. Damage *= 1.50; // Increase burn damage 1.5 times, except MAC10.
  38. }
  39. else if ( KFDamType.default.bIsExplosive ) {
  40. if ( KFDamType != class'DamTypeFrag' )
  41. Damage *= 0.70;
  42. }
  43. else if ( KFDamType.default.bIsMeleeDamage ) {
  44. if ( ClassIsChildOf(KFDamType, class'DamTypeCrossbuzzsaw') )
  45. Damage *= 0.80;
  46. }
  47. }
  48. if(instigatedBy == none)
  49. {
  50. if((KFDamType != none) && class<DamTypeZombieAttack>(KFDamType) == none)
  51. {
  52. return;
  53. }
  54. }
  55. else
  56. {
  57. if(KFMonster(instigatedBy) != none)
  58. {
  59. KFMonster(instigatedBy).bDamagedAPlayer = true;
  60. }
  61. else
  62. {
  63. if(KFHumanPawn(instigatedBy) != none)
  64. {
  65. InstigatorPRI = KFPlayerReplicationInfo(instigatedBy.PlayerReplicationInfo);
  66. Momentum = vect(0.0, 0.0, 0.0);
  67. if((InstigatorPRI != none) && InstigatorPRI.bOnlySpectator)
  68. {
  69. return;
  70. }
  71. }
  72. }
  73. }
  74. super(xPawn).TakeDamage(Damage, instigatedBy, HitLocation, Momentum, DamageType);
  75.  
  76. if( class<DamTypeVomit>(DamageType)!=none ) {
  77. BileCount=7;
  78. BileInstigator = instigatedBy;
  79. LastBileDamagedByType=class<DamTypeVomit>(DamageType);
  80. if(NextBileTime< Level.TimeSeconds )
  81. NextBileTime = Level.TimeSeconds+BileFrequency;
  82.  
  83. if ( Level.Game != none && Level.Game.GameDifficulty >= 4.0 && KFPlayerController(Controller) != none &&
  84. !KFPlayerController(Controller).bVomittedOn)
  85. {
  86. KFPlayerController(Controller).bVomittedOn = true;
  87. KFPlayerController(Controller).VomittedOnTime = Level.TimeSeconds;
  88.  
  89. if ( Controller.TimerRate == 0.0 )
  90. Controller.SetTimer(10.0, false);
  91. }
  92. }
  93. else if ( class<SirenScreamDamage>(DamageType) != none ) {
  94. if ( Level.Game != none && Level.Game.GameDifficulty >= 4.0 && KFPlayerController(Controller) != none &&
  95. !KFPlayerController(Controller).bScreamedAt)
  96. {
  97. KFPlayerController(Controller).bScreamedAt = true;
  98. KFPlayerController(Controller).ScreamTime = Level.TimeSeconds;
  99.  
  100. if ( Controller.TimerRate == 0.0 )
  101. Controller.SetTimer(10.0, false);
  102. }
  103. }
  104.  
  105.  
  106. //Bloody Overlays
  107. if ( Health <= 50 )
  108. SetOverlayMaterial(InjuredOverlay,0, true);
  109.  
  110. // SERVER-SIDE ONLY
  111. if ( Role < ROLE_Authority )
  112. return;
  113.  
  114. if ( KFDamType != none ) {
  115. if ( KFDamType.default.bDealBurningDamage ) {
  116. // Do burn damage if the damage was significant enough
  117. if( Damage > 2 ) {
  118. // If we are already burning, and this damage is more than our current burn amount, add more burn time
  119. if( BurnDown == 0 || OriginalDamage > LastBurnDamage ) {
  120. if ( InstigatedBy != self && KFPawn(InstigatedBy) != none )
  121. BurnDown = 8;
  122. else
  123. BurnDown = 5;
  124. BurnInstigator = InstigatedBy;
  125. LastBurnDamage = OriginalDamage;
  126. bBurnified = true;
  127. }
  128. }
  129. }
  130. }
  131.  
  132. // added null check for Instigator -- PooSH
  133. if ( Level.Game.NumPlayers > 1 && Instigator != none && PlayerController(Instigator.Controller) != none
  134. && Health < 25 && Level.TimeSeconds - LastDyingMessageTime > DyingMessageDelay )
  135. {
  136. // Tell everyone we're dying
  137. PlayerController(Instigator.Controller).Speech('AUTO', 6, "");
  138.  
  139. LastDyingMessageTime = Level.TimeSeconds;
  140. }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment