SarkBall
Class SarkBallShield

source: c:\runehov\SarkBall\Classes\SarkBallShield.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Shield
            |
            +--SarkBall.SarkBallShield
Direct Known Subclasses:None

class SarkBallShield
extends Engine.Shield

//----------------------------------------------------------- // SarkBallShield //-----------------------------------------------------------
States
Bashing, Drop, Active, Activated

Function Summary
 void Bump(Actor Other)
     
//-----------------------------------------------------------------------------
//
// DestroyEffect
//
// Used when Armor is destroyed
//-----------------------------------------------------------------------------
 void DestroyEffect()
 void DoBuffet(Actor Other)
 bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)


State Bashing Function Summary
 void TouchJointOf(Actor Other, int joint)
 void Touch(Actor Other)
 void Spawned()
 void Tick(float DeltaTime)
 void BashActors()
     
//-----------------------------------------------------------------------------
 void EndState()
 void BeginState()


State Drop Function Summary
 void HitWall(vector HitNormal, Actor HitActor)
 void BeginState()


State Active Function Summary
 void touch(Actor Other)
     
//};


State Activated Function Summary
 void touch(Actor Other)
 void Activate()
 void EndState()
 void BeginState()



Source Code


00001	//-----------------------------------------------------------
00002	// SarkBallShield
00003	//-----------------------------------------------------------
00004	class SarkBallShield expands Shield;
00005	
00006	//-----------------------------------------------------------------------------
00007	//
00008	// DestroyEffect
00009	//
00010	// Used when Armor is destroyed
00011	//-----------------------------------------------------------------------------
00012	
00013	function Bump( Actor Other ){
00014	   BroadcastMessage("Bump:"$Other.Name,True);
00015	   //DoBuffet(Other);
00016	    Super.Bump(Other);
00017	}
00018	
00019	function DoBuffet(Actor Other)
00020	     {
00021	          local vector vel;
00022	          local vector X, Y, Z;
00023	
00024	          BroadcastMessage("Doing Buffet",True);
00025	          Other.GetAxes(Rotation, X, Y, Z);
00026	
00027	          vel = -200 * X + vect(0, 0, 75);
00028	          Other.AddVelocity(vel);
00029	          Other.SetPhysics(PHYS_Falling);
00030	     }
00031	
00032	
00033	function DestroyEffect()
00034	{
00035	     local int i, numchunks, NumSourceGroups;
00036	     local debris d;
00037	     local debriscloud c;
00038	     local vector loc;
00039	     local float scale;
00040	
00041	     // Spawn cloud
00042	     c = Spawn(class'DebrisCloud');
00043	     if(c != None)
00044	          c.SetRadius(Max(CollisionRadius,CollisionHeight));
00045	
00046	     // Spawn debris
00047	     numchunks = Clamp(Mass/10, 2, 15);
00048	
00049	     // Find appropriate size of chunks
00050	     scale = (CollisionRadius*CollisionRadius*CollisionHeight) / (numchunks*500);
00051	     scale = scale ** 0.3333333;
00052	     for (NumSourceGroups=1; NumSourceGroups<16; NumSourceGroups++)
00053	     {
00054	          if (SkelGroupSkins[NumSourceGroups] == None)
00055	               break;
00056	     }
00057	
00058	     for (i=0; i<numchunks; i++)
00059	     {
00060	          loc = Location;
00061	          loc.X += (FRand()*2-1)*CollisionRadius;
00062	          loc.Y += (FRand()*2-1)*CollisionRadius;
00063	          loc.Z += (FRand()*2-1)*CollisionHeight;
00064	          d = Spawn(class'debriswood',,,loc);
00065	          if(d != None)
00066	          {
00067	               d.SetSize(scale);
00068	               d.SetTexture(SkelGroupSkins[i%NumSourceGroups]);
00069	          }
00070	     }
00071	}
00072	
00073	
00074	function bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)
00075	{
00076	  //BroadcastMessage("Shield_JointDamaged:"$EventInstigator.Name,True);
00077	  Super.JointDamaged(Damage,EventInstigator,Hitloc,Momentum,DamageType,joint);
00078	}
00079	
00080	
00081	state Activated
00082	{
00083	     function BeginState()
00084	     {
00085	      BroadcastMessage("Activated_BeginState",True);
00086	          Super.BeginState();
00087	     }
00088	
00089	     function EndState()
00090	     {
00091	      BroadcastMessage("Activated_EndState",True);
00092	          Super.EndState();
00093	     }
00094	
00095	     function Activate()
00096	     {
00097	    BroadcastMessage("Activated_Activate",True);
00098	          Super.Activate();
00099	     }
00100	
00101	     function touch(Actor Other)
00102	     {
00103	     BroadcastMessage( "Shield_Activated_Touch:"$Other.Name, true );
00104	     Super.Touch(Other);
00105	
00106	     }
00107	
00108	
00109	
00110	}
00111	
00112	state Active{
00113	
00114	  //Function BeginState(){
00115	    //BroadcastMessage("Shield Active",True);
00116	 //   Super.BeginState();
00117	     //SetCollision(true,true,true);
00118	 //};
00119	
00120	
00121	
00122	
00123	  function touch(Actor Other){
00124	     BroadcastMessage( "Shield_Active_Touch:"$Other.Name, true );
00125	     Super.Touch(Other);
00126	
00127	  }
00128	
00129	}
00130	//modify state drop to destroy shield when dropped
00131	state Drop{
00132	  ignores JointDamaged;
00133	
00134	  Function BeginState(){
00135	    //BroadcastMessage("Shield Drop",True);
00136	  }
00137	
00138	
00139	  function HitWall(vector HitNormal, actor HitActor){
00140	    local float speed;
00141	
00142	    if (!bMadeDropSound && !Region.Zone.bWaterZone){
00143	      bMadeDropSound=true;
00144	//        PlaySound(DropSound, SLOT_Interact);
00145	//        MakeNoise(1.0);
00146	      DestroyEffect();
00147	      PlaySound(DestroyedSound, SLOT_Pain);
00148	      Destroy(); // remove self!
00149	    }
00150	  }
00151	}
00152	
00153	
00154	//-----------------------------------------------------------------------------
00155	//
00156	// State Bashing
00157	//
00158	// Shield is bashing anything in front of it
00159	//-----------------------------------------------------------------------------
00160	
00161	state Bashing
00162	{
00163	     function BeginState()
00164	     {
00165	          Enable('Tick');
00166	     }
00167	
00168	     function EndState()
00169	     {
00170	          Disable('Tick');
00171	     }
00172	
00173	     //-----------------------------------------------------------------------------
00174	     //
00175	     // BashActors
00176	     //
00177	     //-----------------------------------------------------------------------------
00178	
00179	     function BashActors()
00180	     {
00181	          local actor a;
00182	          local vector hitLoc, hitNorm;
00183	          local vector extent;
00184	
00185	          extent.x = 10;
00186	          extent.y = 10;
00187	          extent.z = 10;
00188	
00189	          foreach TraceActors(class'actor', a, hitLoc, hitNorm,
00190	               Location + vector(Owner.Rotation) * 80,, extent)
00191	          {
00192	               a.JointDamaged(2, Pawn(Owner), hitLoc, vect(0, 0, 0), 'blunt', 0);
00193	          }
00194	     }
00195	
00196	     function Tick(float DeltaTime)
00197	     {
00198	          BashActors();
00199	          
00200	     }
00201	
00202	begin:
00203	}
00204	
00205	
00206	
00207	
00208	
00209	Function Spawned(){
00210	  SetCollision(true,true,true);
00211	}
00212	
00213	function Touch( Actor Other ){
00214	   BroadcastMessage("Shield_Global_Touch:"$Other.Name,True);
00215	    Super.Touch(Other);
00216	
00217	}
00218	
00219	function TouchJointOf  (Actor Other, int joint){
00220	  //BroadcastMessage("SarkBallShield_TouchJointOf:"$Other.Name$",Joint:"$joint,True);
00221	  Super.TouchJointof(Other,joint);
00222	
00223	}
00224	
00225	defaultproperties
00226	{
00227	    Health=100
00228	    rating=4
00229	    DestroyedSound=Sound'WeaponsSnd.Shields.xtroy06'
00230	    PickupMessage="You have claimed a Dwarven Battle Shield"
00231	    RespawnSound=Sound'OtherSnd.Respawns.respawn01'
00232	    DropSound=Sound'WeaponsSnd.Shields.xdrop06'
00233	    PickupMessageClass=Class'RuneI.PickupMessage'
00234	    LODCurve=LOD_CURVE_ULTRA_CONSERVATIVE
00235	    bCollideWhenPlacing=True
00236	    CollisionRadius=25.00
00237	    bCollideWorld=True
00238	    bBlockActors=True
00239	    bBlockPlayers=True
00240	    bJointsBlock=True
00241	    bJointsTouch=True
00242	    Skeletal=SkelModel'weapons.VikingShield'
00243	    SkelGroupSkins(0)=Texture'weapons.VikingShieldviking_shield'
00244	    SkelGroupSkins(1)=Texture'weapons.VikingShieldviking_shield'
00245	}

End Source Code