SarkBall
Class SarkBall

source: c:\runehov\SarkBall\Classes\SarkBall.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Weapon
            |
            +--RuneI.NonStow
               |
               +--SarkBall.SarkBall
Direct Known Subclasses:SarkBallGoblinTorch, SarkBallKeg, SarkBallRuneLogo, SarkBallSarkHead, SarkBallScriptPawn

class SarkBall
extends RuneI.NonStow

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 Pawn AssistingPlayer
 Pawn CarriedBy
 int CarriedByTeam
 SarkBallGameReplicationInfo GR
 Weapon PreviousWeapon
 Pawn ThrowingPlayer
 Vector ThrowingPlayerLocation

States
Throw, Carried, BeingPickedUp, Pickup, Stow, Active, Settling, Drop, Swinging

Function Summary
 int ArmorAbsorbDamage(int Damage, name DamageType, vector HitLocation)
 int CalculateDamage(Actor Victim)
     
//=============================================================================
//
// CalculateDamage
//
// Calculates damage amount, based on strength modifier.
// Override with logic for rune powers
//=============================================================================
 bool DamageBodyPart(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, name DamageType, int BodyPart)
 void FellOutOfWorld()
 void NotifyBots(Pawn BallCarrier)
 void PickUpSarkBall(Pawn Other)
 void PreBeginPlay()
 void ScoreEffect()
 void StartRound()
 void TakeDamage(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, name DamageType)
 void Tick(float DeltaTime)
 SarkBallGameReplicationInfo fGR()


State Throw Function Summary
 void Bump(Actor Other)
 void HitShield(Actor Other)
 void HitSword(Actor Other)
 void HitGoal(Actor Other)
 void Touch(Actor Other)
 void Touch(Actor Other)
 void EndState()
 void BeginState()


State Carried Function Summary
 void Touch(Actor Other)
 void Activate()
 void EndState()
 void BeginState()


State BeingPickedUp Function Summary
 void EndState()
 void BeginState()


State Pickup Function Summary
 void Landed(vector HitNormal, Actor HitActor)
 void Touch(Actor Other)
 void EndState()


State Stow Function Summary
 void BeginState()


State Active Function Summary
 void BeginState()


State Settling Function Summary
 void Touch(Actor Other)
 void BeginState()


State Drop Function Summary
 void Destroyed()
     
//=============================================================================
//
// Destroyed
//
//=============================================================================
 void Touch(Actor Other)
 void EndState()
 void BeginState()


State Swinging Function Summary
 void EndState()



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class SarkBall expands NonStow;              //
00005	
00006	//
00007	var SarkBallGameReplicationInfo   GR;
00008	var(Sounds)     Sound             PowerUpSound;
00009	var Pawn                          CarriedBy;
00010	var int                           CarriedByTeam;
00011	var Weapon                        PreviousWeapon;
00012	var Pawn                          ThrowingPlayer;
00013	
00014	var Pawn                          AssistingPlayer;
00015	
00016	var Vector                        ThrowingPlayerLocation;
00017	
00018	Function StartRound(){
00019	
00020	}
00021	
00022	Function FellOutOfWorld(){
00023	     //BroadcastMessage("I Fell out of the world!");
00024	     //Broadcastmessage("CarriedBy:"$CarriedBy.Name);
00025	     //BroadcastMessage("CarriedBy_Weapon:"$CarriedBy.Weapon);
00026	     //PickUpSarkBall(CarriedBy);
00027	     //Super.FellOutOfWorld();
00028	     CarriedBy.AddInventory(self);
00029	    CarriedBy.AcquireInventory(self);
00030	    SetPhysics(Phys_None);
00031	}
00032	
00033	
00034	Function ScoreEffect(){
00035	  local actor F;
00036	  local int i;
00037	  local vector v;
00038	  local rotator r;
00039	  local actor puff;
00040	
00041	  local actor myblood;
00042	
00043	  PlaySound(Sound'CreaturesSnd.Zombie.zombiearmimp01', SLOT_Talk);
00044	
00045	  for(i = 0; i<randrange(5,10); i++){
00046	    F=Spawn(Class'RuneI.DebrisFlesh',,,Self.Location);
00047	    DebrisFlesh(F).SetSize(1);
00048	
00049	    myblood=Spawn(Class'RuneI.BloodSpray',,,Self.Location);
00050	
00051	   }
00052	  //F=Spawn(Class'RuneI.HugeSplash',,,Self.Location);
00053	     //F.LifeSpanMin=0.200000;
00054	          //F.LifeSpanMax=0.500000;
00055	     //F.bAlphaFade=False;
00056	
00057	     //AttachActorToJoint(F, 0);
00058	  //F=Spawn(Class'RuneI.BloodSpray',,,Self.Location);
00059	  //BloodSpray(F).ParticleCount=50;
00060	
00061	}
00062	
00063	Function NotifyBots(Pawn BallCarrier){
00064	  local Pawn P;
00065	  //Notify bots of change in possession
00066	   foreach RadiusActors(class'Pawn', P, 2000){
00067	    if (P==self)
00068	      continue;
00069	    If (P.ISA('SarkBallBot'))
00070	      SarkBallBot(P).ChangeInPossession(BallCarrier);
00071	
00072	  }
00073	
00074	}
00075	
00076	function int ArmorAbsorbDamage(int Damage, name DamageType, vector HitLocation){
00077	
00078	  //BroadcastMessage("ArmorAbsorbDamage",True);
00079	  Super.ArmorAbsorbDamage(Damage,DamageType,HitLocation);
00080	}
00081	
00082	Function Tick(float DeltaTime){
00083	  If (AttachParent!=None){
00084	    //BroadcastMessage("Loose ball!",True);
00085	    If (ThrowingPlayer!=None){
00086	      If (AttachParent.Name==ThrowingPlayer.Name){
00087	        //BroadcastMessage("Found Mismatch of AttachParent and ThrowingPlayer",True);
00088	      }
00089	    }
00090	  }
00091	  Super.Tick(DeltaTime);
00092	
00093	}
00094	
00095	Function SarkBallGameReplicationInfo fGR(){
00096	  Return SarkBallGameReplicationInfo(Level.Game.GameReplicationInfo);
00097	}
00098	
00099	Function TakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, name DamageType)
00100	{
00101	     //BroadcastMessage("SarkBall TakeDamage: "$EventInstigator.Name);
00102	}
00103	
00104	
00105	// All damage functionality comes through this instead of TakeDamage()
00106	// Returns true if the swipe can continue through this joint, false if the swipe should stop
00107	event bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)
00108	{
00109	     //BroadcastMessage("SarkBall JointDamaged: "$EventInstigator.Name);
00110	     return(False);
00111	}
00112	
00113	
00114	
00115	
00116	//=============================================================================
00117	//
00118	// CalculateDamage
00119	//
00120	// Calculates damage amount, based on strength modifier.
00121	// Override with logic for rune powers
00122	//=============================================================================
00123	
00124	function int CalculateDamage(actor Victim)
00125	{
00126	     local int newDamage;
00127	
00128	     //newDamage = Damage;
00129	
00130	     //if(Owner != None && Pawn(Owner) != None)
00131	          //newDamage *= Pawn(Owner).PawnDamageModifier(self);
00132	
00133	//     if (Owner != None && Pawn(Owner) != None)
00134	//          newDamage += Pawn(Owner).Strength * 0.25;
00135	
00136	     return 0;
00137	}
00138	
00139	
00140	Function PickUpSarkBall(Pawn Other){
00141	  local int iBallDistance;
00142	
00143	  If (Other==None)
00144	    Return;
00145	
00146	  If (GR.ThrowingPlayer!=None && GR.ThrowingPlayer==Other)
00147	    Return;
00148	
00149	  If (GR.PlayerWithPossession!=None && GR.PlayerWithPossession==Other)
00150	    Return;
00151	
00152	  If (ThrowingPlayer!=None && ThrowingPlayer==Other){
00153	    //BroadcastMessage("Skipping SarkBall.ThrowingPlayerTouch;",True);
00154	    Return;
00155	  }
00156	  //BroadcastMessage("PickUpSarkBall:"$Other.PlayerReplicationInfo.PlayerName,True);
00157	
00158	
00159	
00160	   //PlaySound(Sound'SarkBallSnd.cartman.donkeyballs');
00161	
00162	  If (Other.ISA('SarkBallBot')){
00163	      //BroadcastMessage("PickUpSarkBall_HitABot:"$Other.PlayerReplicationInfo.PlayerName$",State:"$SarkBallBot(Other).GetStateName(),True);
00164	      //BroadcastMessage("ThrowingPlayer:"$Pawn(GR.ThrowingPlayer).PlayerReplicationInfo.PlayerName,True);
00165	      //BroadcastMessage("SarkBall_ThrowingPlayer:"$ThrowingPlayer.PlayerReplicationInfo.PlayerName,True);
00166	      //BroadcastMessage("SarkBall_CarriedBy:"$CarriedBy.PlayerReplicationInfo.PlayerName,True);
00167	
00168	      //If (ThrowingPlayer.Name==Other.Name){
00169	        //BroadcastMessage("PickUpSarkBall_pawn is the pawn who threw the ball!",True);
00170	      //  Return;
00171	      //}
00172	      If (SarkBallBot(Other).GetStateName()=='IHaveTheBall'){
00173	        //BroadcastMessage("Skipping touch of bot who threw:"$Other.Name,True);
00174	        Return;
00175	      }
00176	      If (SarkBallBot(Other).Weapon!=None){
00177	        //BroadcastMessage("Weapon:"$SarkBallBot(Other).Weapon.Name,True);
00178	        If (SarkBallBot(Other).Weapon.ISA('SarkBall')){
00179	          //BroadcastMessage("Skipping Pickup...already have the ball",True);
00180	          Return;
00181	        }
00182	      }
00183	  }
00184	
00185	  Other.GroundSpeed=SarkBallGame(level.game).iPlayerWithBallSpeed;
00186	  //BroadcastMessage("Ball Carrying Speed:"$Other.GroundSpeed,True);
00187	  //BroadcastMessage("PickUpSarkBall:"$Other.PlayerReplicationInfo.PlayerName,True);
00188	
00189	    //BroadcastMessage("Other Weapon:"$Other.Weapon.Name,True);
00190	  If (Other.Weapon!=None && Other.Weapon.ISA('SarkBall')){
00191	    //BroadcastMessage("PickUpSarkBall_Canceling due to already have ball",true);
00192	    //Log("PickUpSarkBall_Canceling due to already have ball");
00193	    GR.ThrowingPlayer=None;
00194	    ThrowingPlayer=None;
00195	    Gr.PlayerWithPossession=Other;
00196	    Gr.PlayerWithBallName=Other.PlayerReplicationInfo.PlayerName;
00197	    CarriedBy=Other;
00198	    //BroadcastMessage("Setting Groundspeed to:"$SarkBallGame(level.game).iPlayerWithBallSpeed,True);
00199	
00200	
00201	
00202	
00203	    GotoState('Carried');
00204	    Return;
00205	  }
00206	
00207	
00208	  iBallDistance=VSize(Location-ThrowingPlayerLocation);
00209	  //BroadcastMessage("PickUpSarkBall_Not already having SarkBall",True);
00210	
00211	  If (ThrowingPlayer!=None && GetStateName()=='Throw'){
00212	
00213	    If (Pawn(GR.ThrowingPlayer).PlayerReplicationInfo.Team!=Other.PlayerReplicationInfo.Team){
00214	
00215	
00216	      If (int(iBallDistance * 0.025)<=2){
00217	        //BroadcastMessage("Take Away from "$ThrowingPlayer.PlayerReplicationInfo.PlayerName$" by "$Other.PlayerReplicationInfo.PlayerName,True);
00218	        GR.fGameMessage2(Other.PlayerReplicationInfo.Team,"Take Away from "$ThrowingPlayer.PlayerReplicationInfo.PlayerName$" by "$Other.PlayerReplicationInfo.PlayerName);
00219	      }else{
00220	        //BroadcastMessage(int(iBallDistance * 0.025)$" yd Interception of "$ThrowingPlayer.PlayerReplicationInfo.PlayerName$" by "$Other.PlayerReplicationInfo.PlayerName,True);
00221	        GR.fGameMessage2(Other.PlayerReplicationInfo.Team,int(iBallDistance * 0.025)$" yd Interception of "$ThrowingPlayer.PlayerReplicationInfo.PlayerName$" by "$Other.PlayerReplicationInfo.PlayerName);
00222	      }
00223	    }else{
00224	      //BroadcastMessage("Beautiful pass from "$Pawn(GR.ThrowingPlayer).PlayerReplicationInfo.PlayerName$" to "$Other.PlayerReplicationInfo.PlayerName,True);
00225	      //BroadcastMessage(int(iBallDistance * 0.025)$" yd pass from "$ThrowingPlayer.PlayerReplicationInfo.PlayerName$" to "$Other.PlayerReplicationInfo.PlayerName,True);
00226	      GR.fGameMessage2(ThrowingPlayer.PlayerReplicationInfo.Team,int(iBallDistance * 0.025)$" yd pass from "$ThrowingPlayer.PlayerReplicationInfo.PlayerName$" to "$Other.PlayerReplicationInfo.PlayerName);
00227	    }
00228	  }
00229	
00230	  AssistingPlayer=ThrowingPlayer;
00231	
00232	  //If (GetStateName()=='Pickup')
00233	  //BroadcastMessage("SarkBall picked up by "$Other.PlayerReplicationInfo.PlayerName,True);
00234	
00235	  //If (GetStateName()=='Drop')
00236	  //BroadcastMessage("Jumpshot won by "$Other.PlayerReplicationInfo.PlayerName,True);
00237	
00238	  //BroadcastMessage("PickUpSarkBall_Reset_BallPlayerInfo",True);
00239	
00240	  GR.PlayerWithPossession=Other;
00241	  GR.PlayerWithBallName=Other.PlayerReplicationInfo.PlayerName;
00242	
00243	  //BroadcastMessage("SarkBall now in possession of "$Other.PlayerReplicationInfo.PlayerName,true);
00244	  CarriedBy=Other;
00245	  CarriedByTeam=Other.PlayerReplicationInfo.Team;
00246	
00247	  Other.AddInventory(self);
00248	  Other.AcquireInventory(self);
00249	  SetPhysics(Phys_None);
00250	
00251	  GR.PlayerWithBallIndex=Other.PlayerReplicationInfo.PlayerID;
00252	  GR.PlayerWithBallName=Other.PlayerReplicationInfo.PlayerName;
00253	  GR.ThrowingPlayer=None;
00254	  ThrowingPlayer=None;
00255	  //Other.Weapon=self;
00256	  DesiredColorAdjust.X = 100;
00257	  DesiredColorAdjust.Y = 100;
00258	  DesiredColorAdjust.Z = 0;
00259	
00260	  AmbientGlow=200;
00261	
00262	  sarkballgame(level.game).bDeadBallCounting=False;
00263	
00264	  If (Other.ISA('SarkBallBot')){
00265	    //broadcastmessage("sarkballbot picked up the ball",true);
00266	    SarkBallBot(Other).bThrowing=False;
00267	    SarkBallBot(Other).GotoState('IHaveTheBall','PickedUp');
00268	  }
00269	  //BroadcastMessage("PickUpSarkBall_End",True);
00270	  //GotoState('Active');
00271	  SetOwner(Other);
00272	
00273	  NotifyBots(CarriedBy);
00274	
00275	  GotoState('Carried');
00276	}
00277	
00278	function bool DamageBodyPart(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, name DamageType, int BodyPart)
00279	{
00280	     return(false);
00281	}
00282	
00283	
00284	function PreBeginPlay()
00285	{
00286	     DesiredColorAdjust.X = 100;
00287	     DesiredColorAdjust.Y = 100;
00288	     DesiredColorAdjust.Z = 0;
00289	
00290	     Super.PreBeginPlay();
00291	}
00292	
00293	
00294	//-----------------------------------------------------------------------------
00295	//
00296	// Swinging State
00297	//
00298	//-----------------------------------------------------------------------------
00299	
00300	state Swinging{
00301	  function EndState(){
00302	     local Fire F;
00303	
00304	     //F=Spawn(Class'RuneI.Fire',,,Self.Location);
00305	     //F.LifeSpanMin=0.200000;
00306	          //F.LifeSpanMax=0.500000;
00307	     //F.bAlphaFade=False;
00308	
00309	     //AttachActorToJoint(F, 0);
00310	
00311	  }
00312	
00313	  //function Bump(actor Other){
00314	  //  BroadcastMessage("SarkBall_Swinging_Bump:"$Other.Name$",State:"$GetStateName(),True);
00315	    //Super.Bump(Other);
00316	  //}
00317	
00318	}
00319	
00320	//-----------------------------------------------------------------------------
00321	//
00322	// State Drop
00323	//
00324	// Melee weapon was dropped
00325	//-----------------------------------------------------------------------------
00326	
00327	state Drop{
00328	
00329	  function BeginState(){
00330	    //BroadcastMessage("Drop_BeginState",True);
00331	    GR.ThrowingPlayer=None;
00332	    ThrowingPlayer=None;
00333	    Super.BeginState();
00334	  }
00335	
00336	  function EndState(){
00337	    //BroadcastMessage("SarkBall.Drop.EndState",True);
00338	    local Pawn OtherPlayer;
00339	
00340	    If (SarkBallGame(level.Game).bBallDropping){
00341	      //BroadcastMessage("Ball Dropped",True);
00342	      SarkBallGame(level.Game).bBallDropping=False;
00343	      for ( OtherPlayer=Level.PawnList; OtherPlayer!=None; OtherPlayer=OtherPlayer.NextPawn){
00344	        If (!OtherPlayer.ISA('Spectator')){
00345	          //Log("Adding Inventory for:"$OtherPlayer.PlayerReplicationInfo.PlayerName);
00346	          SarkBallGame(level.Game).AddDefaultInventory(OtherPlayer);
00347	        }
00348	      }
00349	    }
00350	    Super.EndState();
00351	  }
00352	
00353	  function Touch(Actor Other){
00354	    Global.Touch(Other);
00355	  }
00356	
00357	  //function Bump(actor Other){
00358	  //  BroadcastMessage("SarkBall_Drop_Bump:"$Other.Name$",State:"$GetStateName(),True);
00359	    //Super.Bump(Other);
00360	  //}
00361	}
00362	
00363	
00364	//=============================================================================
00365	//
00366	// Destroyed
00367	//
00368	//=============================================================================
00369	
00370	function Destroyed()
00371	{
00372	     //BroadcastMessage("The SarkBall was Destroyed!",True);
00373	     GR.bSarkBallDestroyed=True;
00374	     GR.CurrentSarkBall=None;
00375	     GR.CurrentCount=30;
00376	     GR.StartCountDownCompleted=False;
00377	     sarkballgame(level.game).bDeadBallCounting=False;
00378	     //GR.RespawnAllPlayers();
00379	
00380	     //Super.Destroyed();
00381	
00382	
00383	     //GR.RelocateSarkBall();
00384	     
00385	}
00386	
00387	
00388	
00389	//-----------------------------------------------------------------------------
00390	//
00391	// State
00392	//
00393	// Weapon has hit ground, settle into rest position/orientation
00394	//-----------------------------------------------------------------------------
00395	state Settling
00396	{
00397	
00398	  function BeginState()
00399	    {
00400	    //BroadcastMessage("Settling_BeginState",True);
00401	    //Log("SarkBall_Settling_BeginState_Begin");
00402	    SarkBallGame(level.Game).SetBallDead();
00403	    ThrowingPlayer=None;
00404	    AssistingPlayer=None;
00405	
00406	    Super.BeginState();
00407	    //Log("SarkBall_Settling_BeginState_End");
00408	
00409	    }
00410	
00411	  function Touch(Actor Other){
00412	    Global.Touch(Other);
00413	  }
00414	
00415	 // function Bump(actor Other){
00416	  //  BroadcastMessage("SarkBall_Settling_Bump:"$Other.Name$",State:"$GetStateName(),True);
00417	    //Super.Bump(Other);
00418	  //}
00419	
00420	}
00421	
00422	
00423	
00424	
00425	state Active{
00426	
00427	     function BeginState(){
00428	     //BroadcastMessage( "Active_BeginState", true );
00429	     Super.BeginState();
00430	     SetCollision(true,true,true);
00431	      }
00432	     //Pawn(Owner).GroundSpeed=500;
00433	
00434	     
00435	    // function Bump(actor Other){
00436	   // BroadcastMessage("SarkBall_Active_Bump:"$Other.Name$",State:"$GetStateName(),True);
00437	    //Super.Bump(Other);
00438	  //}
00439	
00440	     
00441	}
00442	
00443	//-----------------------------------------------------------------------------
00444	//
00445	// State Stow
00446	//
00447	// Melee Weapon is non-active and stowed on the actor
00448	//-----------------------------------------------------------------------------
00449	
00450	state Stow{
00451	     function BeginState()
00452	     {
00453	     //BroadcastMessage("The SarkBall was Stowed!",True);
00454	     Super.BeginState();
00455	     }
00456	
00457	   //  function Bump(actor Other){
00458	  //  BroadcastMessage("SarkBall_Stow_Bump:"$Other.Name$",State:"$GetStateName(),True);
00459	    //Super.Bump(Other);
00460	  //}
00461	
00462	}
00463	
00464	//-----------------------------------------------------------------------------
00465	//
00466	// State Pickup
00467	//
00468	// Melee Weapon is sitting on the ground waiting to be picked up
00469	//-----------------------------------------------------------------------------
00470	auto state Pickup{
00471	
00472	  Function EndState(){
00473	
00474	    Super.EndState();
00475	    //bCollideWorld = true;
00476	    //SetCollision( true, true, true );
00477	  }
00478	
00479	  function Touch(Actor Other){
00480	    Global.Touch(Other);
00481	  }
00482	
00483	 // function Bump(actor Other){
00484	 //   BroadcastMessage("SarkBall_Pickup_Bump:"$Other.Name$",State:"$GetStateName(),True);
00485	    //Super.Bump(Other);
00486	  //}
00487	
00488	}
00489	
00490	event Spawned(){
00491	     local PlayerPawn PlayerOwner;
00492	     //Log("New SarkBall Spawned!");
00493	
00494	     PlayerOwner = PlayerPawn(Owner);
00495	
00496	     //Log( "The SarkBall has Spawned at"$Self.Location);
00497	     Super.Spawned();
00498	}
00499	
00500	function Landed(vector HitNormal, actor HitActor){
00501	  //BroadcastMessage("SarkBall_Global_Landed:"$HitActor.name$"State:"$GetStateName(),true);
00502	     //Log("SarkBall_Global_Landed");
00503	     Super.Landed(HitNormal,HitActor);
00504	}
00505	
00506	
00507	simulated function HitWall(vector HitNormal, actor HitWall){
00508	     //BroadcastMessage( "The SarkBall has Hit The Wall! "$HitWall.Name, true );
00509	     //Log("SarkBall_Global_HitWall");
00510	     Super.HitWall(HitNormal,HitWall);
00511	
00512	}
00513	
00514	
00515	state BeingPickedUp{
00516	
00517	  function BeginState(){
00518	    BroadcastMessage( "BeingPickedup_BeginState", true );
00519	
00520	    Super.BeginState();
00521	  }
00522	     
00523	     function EndState()
00524	     {
00525	     //BroadcastMessage( "BeingPickup_EndState", true );
00526	     }
00527	
00528	   //  function Bump(actor Other){
00529	   // BroadcastMessage("SarkBall_BeingPickedUp_Bump:"$Other.Name$",State:"$GetStateName(),True);
00530	    //Super.Bump(Other);
00531	  //}
00532	
00533	begin:
00534	
00535	}
00536	
00537	State Carried{
00538	     function BeginState(){
00539	          bActive = true;
00540	          if ( Pawn(Owner).bIsPlayer && (ProtectionType1 != '') )
00541	               Pawn(Owner).ReducedDamageType = ProtectionType1;
00542	     }
00543	
00544	     function EndState(){
00545	          bActive = false;
00546	          if ( (Pawn(Owner) != None)
00547	               && Pawn(Owner).bIsPlayer && (ProtectionType1 != '') )
00548	               Pawn(Owner).ReducedDamageType = '';
00549	     }
00550	
00551	     function Activate(){
00552	          if ( (Pawn(Owner) != None) && (M_Deactivated != "") )
00553	               Pawn(Owner).ClientMessage(ItemName$M_Deactivated);     
00554	          GoToState('DeActivated');     
00555	     }
00556	
00557	
00558	
00559	  function Touch(Actor Other){
00560	    local vector X,Y,Z;
00561	
00562	    If (Other.IsA('Pawn')){
00563	      If (Frand()<0.10){
00564	        //BroadcastMessage("Goto Takeaway:"$Pawn(Other).PlayerReplicationInfo.PlayerName,True);
00565	        //GR.fGameMessage2(Pawn(Other).PlayerReplicationInfo.Team,"Snatched from "$CarriedBy.PlayerReplicationInfo.PlayerName$" by "$Pawn(Other).PlayerReplicationInfo.PlayerName);
00566	        //GetAxes(Rotation,X,Y,Z);
00567	        //DetachActorFromJoint(JointNamed(Pawn(Owner).WeaponJoint));
00568	        //Velocity = Y * 100 - X * 50;
00569	        //DropFrom(Location);
00570	      }
00571	      //PickUpSarkBall(Pawn(Other));
00572	    }else if(Other.IsA('Weapon')){
00573	      If (Frand()<0.10){
00574	        //BroadcastMessage("Goto Fumble!",True);
00575	      }
00576	    }else{
00577	      //BroadcastMessage("Carried_Touch_Other:"$Other.Name,True);
00578	    }
00579	  }
00580	
00581	
00582	}
00583	
00584	state Throw{
00585	  function BeginState(){
00586	     local SarkBallGame game;
00587	     local PlayerPawn PlayerOwner;
00588	     local Pawn PlayerWithPossession;
00589	     //BroadcastMessage("-------------------------------------------",True);
00590	     //BroadcastMessage("Throw_BeginState:"$GetStateName(),True);
00591	     PlayerWithPossession=GR.PlayerWithPossession;
00592	     //PlayerOwner = PlayerPawn(Owner);
00593	
00594	     //BroadcastMessage("Throw_BeginState_CarriedBy:"$CarriedBy.PlayerReplicationInfo.PlayerName,True);
00595	
00596	     //PlaySound(ThroughAirBerserk[Rand(NumThroughAirBerserkSounds)], SLOT_None,,,, 1.0 + (FRand()-0.5)*2.0*PitchDeviation);
00597	
00598	    if (PlayerWithPossession!=None){
00599	      //BroadcastMessage( "SarkBall thrown By "$PlayerWithPossession.PlayerReplicationInfo.PlayerName, true );
00600	      GR.ThrowingPlayer=PlayerWithPossession;
00601	
00602	      ThrowingPlayer=PlayerWithPossession;
00603	      ThrowingPlayerLocation=ThrowingPlayer.Location;
00604	      CarriedBy=PlayerWithPossession;
00605	
00606	      If (SarkBallGame(level.game).bAdvancedThrowing){
00607	        //BroadcastMessage("Advanced Throwing On",True);
00608	        self.velocity=self.velocity+PlayerWithPossession.velocity;
00609	        //BroadcastMessage("Adding Rotation:"$PlayerWithPossession.Rotation,True);
00610	        //SetRotation(self.rotation+ PlayerWithPossession.Rotation);
00611	      }else{
00612	        //BroadcastMessage("Advanced Throwing Off",True);
00613	      }
00614	
00615	      NotifyBots(None);
00616	
00617	    };
00618	    Super.BeginState();
00619	    //BroadcastMessage("SarkBall_Throw_BeginState_End",True);
00620	
00621	  }
00622	
00623	  Function EndState()
00624	    {
00625	    local int joint;
00626	    //BroadcastMessage("Throw_EndState",True);
00627	    //Self.SetRotation(rot(0, 0, 0));
00628	    //BroadcastMessage("Throw_EndState, Restoring Weapon:"$PreviousWeapon$" TO "$GR.PlayerWithPossession,True);
00629	    //GR.PlayerWithPossession.SwitchToBestWeapon();
00630	    //GR.PlayerWithPossession.Weapon=PreviousWeapon;
00631	    //PlayWeaponSwitch(PreviousWeapon);
00632	    //joint = JointNamed(GR.PlayerWithPossession.WeaponJoint);
00633	    //GR.PlayerWithPossession.AttachActorToJoint(joint);
00634	
00635	    //PreviousWeapon.GotoState('Active');
00636	    //If (PreviousWeapon!=None){
00637	    //CarriedBy.AcquireInventory(PreviousWeapon);
00638	    //CarriedBy.Weapon = PreviousWeapon;
00639	    //CarriedBy.Weapon.GotoState('Active');
00640	   // }
00641	
00642	    If (self.attachparent!=None){
00643	      //BroadcastMessage("Throw_EndState_StillHasBall:"$Pawn(self.attachparent).PlayerReplicationInfo.Playername,true);
00644	      fGR().ThrowingPlayer=None;
00645	      fGR().PlayerWithPossession=None;
00646	      PickUpSarkBall(Pawn(self.attachparent));
00647	      //Self.Attachparent.GotoState('IHaveTheBall','ThrowBallAtGoal');
00648	
00649	      //GR.PlayerWithPossession=Pawn(self.attachparent);
00650	      //CarriedBy=Pawn(self.attachparent);
00651	      //GR.PlayerWithPossession.Weapon=self;
00652	    }else{
00653	      CarriedBy=None;
00654	    }
00655	
00656	
00657	    fGR().ThrowingPlayer=None;
00658	    Super.EndState();
00659	    //BroadcastMessage("============================================",True);
00660	  }
00661	
00662	
00663	
00664	  simulated function HitWall(vector HitNormal, actor HitWall){
00665	    local PlayerPawn PlayerOwner;
00666	
00667	    //Log("SarkBall_HitWall_Begin");
00668	
00669	    PlayerOwner = PlayerPawn(Owner);
00670	
00671	    //BroadcastMessage( "The SarkBall has Hit The Wall! "$HitWall.Name, true );
00672	
00673	    SarkBallGame(level.Game).SetBallDead();
00674	    Super.HitWall(HitNormal,HitWall);
00675	
00676	    //Log("SarkBall_HitWall_End");
00677	
00678	    }
00679	
00680	  function Touch(Actor Other){
00681	    Global.Touch(Other);
00682	  }
00683	
00684	  //function Bump(actor Other){
00685	  //  BroadcastMessage("SarkBall_Throw_Bump:"$Other.Name$",State:"$GetStateName(),True);
00686	    //Super.Bump(Other);
00687	  //}
00688	}
00689	
00690	function Touch(Actor Other){
00691	  //BroadcastMessage("SarkBall_Global_Touch:"$Other.Name$",State:"$GetStateName());
00692	
00693	  If (Other.IsA('Pawn')){
00694	    PickUpSarkBall(Pawn(Other));
00695	  }else If (Other.IsA('SarkBallGong')){
00696	    HitGoal(Other);
00697	  }else If (Other.IsA('Sword')){
00698	    HitSword(Other);
00699	  }else If (Other.IsA('Shield')){
00700	    HitShield(Other);
00701	  }else If (Other.IsA('sbPlayerTool')){
00702	    //HitShield(Other);
00703	  }else{
00704	    //BroadcastMessage("SarkBall_Global_Touch_Other:"$Other.Name,True);
00705	    Super.Touch(Other);
00706	  }
00707	
00708	}
00709	
00710	Function HitGoal(Actor Other){
00711	  //BroadcastMessage("SarkBall_HitGoal",True);
00712	}
00713	
00714	Function HitSword(Actor Other){
00715	  //BroadcastMessage("SarkBall_HitSword",True);
00716	}
00717	
00718	Function HitShield(Actor Other){
00719	  BroadcastMessage("SarkBall_HitShield",True);
00720	}
00721	
00722	function Bump(actor Other){
00723	  If (Other.IsA('Pawn')){
00724	    //PickUpSarkBall(Pawn(Other));
00725	  }else If (Other.IsA('SarkBallGong')){
00726	    //HitGoal(Other);
00727	  }else If (Other.IsA('Sword')){
00728	    //HitSword(Other);
00729	  }else If (Other.IsA('Shield')){
00730	    //HitShield(Other);
00731	  }else If (Other.IsA('sbPlayerTool')){
00732	    //HitShield(Other);
00733	  }else{
00734	    //BroadcastMessage("SarkBall_Global_Bump_Other:"$Other.Name,True);
00735	    Super.Touch(Other);
00736	  }
00737	    //BroadcastMessage("SarkBall_Global_Bump:"$Other.Name$",State:"$GetStateName(),True);
00738	    //Super.Bump(Other);
00739	  }
00740	
00741	defaultproperties
00742	{
00743	    Damage=10
00744	    rating=999
00745	    A_Taunt=T_OUTTaunt
00746	    PickupMessage="You've Got The SarkBall! Hit the enemy team's GONG with it!"
00747	    ExpireTime=0.00
00748	    bCanTeleport=True
00749	    AmbientGlow=200
00750	    bGameRelevant=True
00751	    SoundRadius=100
00752	    CollisionRadius=12.00
00753	    CollisionHeight=20.00
00754	    bCollideWorld=True
00755	    Mass=10.00
00756	    Buoyancy=50.00
00757	    NetPriority=3.00
00758	    Skeletal=SkelModel'objects.Barrel'
00759	}

End Source Code