## XIII
Class ProjectileInHead

source: C:\XIII\XIII\Classes\ProjectileInHead.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Effects
             |
             +--XIII.ProjectileInHead

Direct Known Subclasses:None

class ProjectileInHead
extends Engine.Effects

    //-----------------------------------------------------------
    //
    //-----------------------------------------------------------

Source Code

    00001	//-----------------------------------------------------------
    00002	//
    00003	//-----------------------------------------------------------
    00004	class ProjectileInHead extends Effects;
    00005
    00006	//_____________________________________________________________________________
    00007	event PostBeginPlay()
    00008	{
    00009	    local vector RelativeLoc;
    00010	    local rotator RelativeRot;
    00011	    Local BloodOnHead BOH;
    00012	    Local Emitter HBTE;
    00013
    00014	//    Log(self@"spawned");
    00015	    RelativeLoc = normal(Location - Owner.GetBoneCoords('X Head').Origin)*11.0;
    00016	    if ( vector(Rotation) dot RelativeLoc > -0.7 ) // then projectile is too far behind, bring it a little in front
    00017	    {
    00018	      RelativeLoc -= vector(Rotation)*11.0; // Move it back along its path
    00019	      RelativeLoc *= 0.8; // make it nearer the head to avoid being suspended in void
    00020	    }
    00021	    RelativeRot = rotator(Vector(Rotation) << Owner.GetBoneRotation('X Head')); // Anyway to do this faster ?
    00022	    RelativeRot.Roll = Rand(32767);
    00023	    RelativeLoc = RelativeLoc << Owner.GetBoneRotation('X Head');
    00024
    00025	    Owner.AttachToBone(self, 'X Head');
    00026	    SetRelativeLocation(RelativeLoc);
    00027	    SetRelativeRotation(RelativeRot);
    00028
    00029	    Owner.SetBoneRotation('X Jaw', rot(0,0,-2000), 0, 1.0 );
    00030
    00031	//::TODO:: bring back when projectors are allowed on cartoon meshes
    00032	    HBTE = Spawn(class'XIIIDamageType'.Default.HeadBloodTrailEmitterClass, Owner);
    00033	    if ( HBTE != none )
    00034	    {
    00035	      Owner.AttachToBone(HBTE, 'X Head');
    00036	      HBTE.SetRelativeLocation(RelativeLoc);
    00037	      HBTE.SetRelativeRotation(RelativeRot);
    00038	    }
    00039
    00040	    BOH = Spawn(class'BloodOnHead',Owner);
    00041	    if ( BOH != none )
    00042	    {
    00043	      Owner.AttachToBone(BOH, 'X Head');
    00044	      BOH.SetRelativeLocation(RelativeLoc - vector(RelativeRot) * 30.0);
    00045	      BOH.SetRelativeRotation(RelativeRot);
    00046	    }
    00047	}
    00048
    00049
    00050
    00051	defaultproperties
    00052	{
    00053	     bHidden=True
    00054	     DrawType=DT_StaticMesh
    00055	     LifeSpan=60.000000
    00056	     CollisionRadius=10.000000
    00057	     CollisionHeight=10.000000
    00058	}

End Source Code