Advertisement
Guest User

Untitled

a guest
Nov 24th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function TakeDamageBase(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType,
  2.                         bool bPlayAnim)
  3. {
  4.     local int          actualDamage;
  5.     local Vector       offset;
  6.     local float        origHealth;
  7.     local EHitLocation hitPos;
  8.     local float        shieldMult;
  9.  
  10.     // use the hitlocation to determine where the pawn is hit
  11.     // transform the worldspace hitlocation into objectspace
  12.     // in objectspace, remember X is front to back
  13.     // Y is side to side, and Z is top to bottom
  14.     offset = (hitLocation - Location) << Rotation;
  15.  
  16.     if (!CanShowPain())
  17.         bPlayAnim = false;
  18.  
  19.     // Prevent injury if the NPC is intangible
  20.     if (!bBlockActors && !bBlockPlayers && !bCollideActors)
  21.         return;
  22.  
  23.     // No damage + no damage type = no reaction
  24.     if ((Damage <= 0) && (damageType == 'None'))
  25.         return;
  26.  
  27.     // Block certain damage types; perform special ops on others
  28.     if (!FilterDamageType(instigatedBy, hitLocation, offset, damageType))
  29.         return;
  30.  
  31.     // Impart momentum
  32.     ImpartMomentum(momentum, instigatedBy);
  33.  
  34.     actualDamage = ModifyDamage(Damage, instigatedBy, hitLocation, offset, damageType);
  35.  
  36.     if (actualDamage > 0)
  37.     {
  38.         shieldMult = ShieldDamage(damageType);
  39.         if (shieldMult > 0)
  40.             actualDamage = Max(int(actualDamage*shieldMult), 1);
  41.         else
  42.             actualDamage = 0;
  43.         if (shieldMult < 1.0)
  44.             DrawShield();
  45.     }
  46.  
  47.     origHealth = Health;
  48.  
  49.     hitPos = HandleDamage(actualDamage, hitLocation, offset, damageType);
  50.     if (!bPlayAnim || (actualDamage <= 0))
  51.         hitPos = HITLOC_None;
  52.  
  53.     if (bCanBleed)
  54.         if ((damageType != 'Stunned') && (damageType != 'TearGas') && (damageType != 'HalonGas') &&
  55.             (damageType != 'PoisonGas') && (damageType != 'Radiation') && (damageType != 'EMP') &&
  56.             (damageType != 'NanoVirus') && (damageType != 'Drowned') && (damageType != 'KnockedOut') &&
  57.             (damageType != 'Poison') && (damageType != 'PoisonEffect'))
  58.             bleedRate += (origHealth-Health)/(0.3*Default.Health);  // 1/3 of default health = bleed profusely
  59.  
  60.     if (CarriedDecoration != None)
  61.         DropDecoration();
  62.  
  63.     if ((actualDamage > 0) && (damageType == 'Poison'))
  64.         StartPoison(Damage, instigatedBy);
  65.  
  66.     if (Health <= 0)
  67.     {
  68.         ClearNextState();
  69.         //PlayDeathHit(actualDamage, hitLocation, damageType);
  70.         if ( actualDamage > mass )
  71.             Health = -1 * actualDamage;
  72.         SetEnemy(instigatedBy, 0, true);
  73.  
  74.         // gib us if we get blown up
  75.         if (DamageType == 'Exploded')
  76.             Health = -10000;
  77.         else
  78.             Health = -1;
  79.  
  80.         Died(instigatedBy, damageType, HitLocation);
  81.  
  82.         if ((DamageType == 'Flamed') || (DamageType == 'Burned'))
  83.         {
  84.             bBurnedToDeath = true;
  85.             ScaleGlow *= 0.1;  // blacken the corpse
  86.         }
  87.         else
  88.             bBurnedToDeath = false;
  89.  
  90.         return;
  91.     }
  92.  
  93.     // play a hit sound
  94.     if (DamageType != 'Stunned')
  95.         PlayTakeHitSound(actualDamage, damageType, 1);
  96.  
  97.     if ((DamageType == 'Flamed') && !bOnFire)
  98.         CatchFire();
  99.  
  100.     ReactToInjury(instigatedBy, damageType, hitPos);
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement