
ALoreShot
By: a guest on
Aug 11th, 2012 | syntax:
C | size: 0.70 KB | hits: 20 | expires: Never
class ALoreShot : public AActor
{
DECLARE_CLASS (ALoreShot, AActor)
public:
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
};
IMPLEMENT_CLASS (ALoreShot)
int ALoreShot::DoSpecialDamage (AActor *target, int damage, FName damagetype)
{
FVector3 thrust;
if (this->target != NULL)
{
thrust.X = float(this->target->x - target->x);
thrust.Y = float(this->target->y - target->y);
thrust.Z = float(this->target->z - target->z);
thrust.MakeUnit();
thrust *= float((255*50*FRACUNIT) / (target->Mass ? target->Mass : 1));
target->velx += fixed_t(thrust.X);
target->vely += fixed_t(thrust.Y);
target->velz += fixed_t(thrust.Z);
}
return damage;
}