Don't like ads? PRO users don't see any ads ;-)
Guest

ALoreShot

By: a guest on Aug 11th, 2012  |  syntax: C  |  size: 0.70 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class ALoreShot : public AActor
  2. {
  3.         DECLARE_CLASS (ALoreShot, AActor)
  4. public:
  5.         int DoSpecialDamage (AActor *target, int damage, FName damagetype);
  6. };
  7.  
  8. IMPLEMENT_CLASS (ALoreShot)
  9.  
  10. int ALoreShot::DoSpecialDamage (AActor *target, int damage, FName damagetype)
  11. {
  12.         FVector3 thrust;
  13.        
  14.         if (this->target != NULL)
  15.         {
  16.                 thrust.X = float(this->target->x - target->x);
  17.                 thrust.Y = float(this->target->y - target->y);
  18.                 thrust.Z = float(this->target->z - target->z);
  19.        
  20.                 thrust.MakeUnit();
  21.                 thrust *= float((255*50*FRACUNIT) / (target->Mass ? target->Mass : 1));
  22.        
  23.                 target->velx += fixed_t(thrust.X);
  24.                 target->vely += fixed_t(thrust.Y);
  25.                 target->velz += fixed_t(thrust.Z);
  26.         }
  27.         return damage;
  28. }