RuneI
Class Table

source: c:\runehov\RuneI\Classes\Table.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Decoration
         |
         +--RuneI.DecorationRune
            |
            +--RuneI.Table
Direct Known Subclasses:TableDwarfLong, TableDwarfShort

class Table
extends RuneI.DecorationRune

//============================================================================= // Table. //=============================================================================
States
BrokenTable, SolidTable

Function Summary
 void BreakTable()
     
/*

 void DisableCollision()
     
{
	SkelMesh = 1;
	SetRotation(Rotation + Rot(5680, 0, 0));
	SetLocation(Location - Vect(0, 0, 34));
}

 void EnableCollision()
     
{
	SetCollision(false, false, false);
	bCollideWorld = false;
	bJointsBlock = false;
}

 EMatterType MatterForJoint(int joint)
     
//============================================================
//
// MatterForJoint
//
// Returns what kind of material joint is associated with
//============================================================


State BrokenTable Function Summary


State SolidTable Function Summary
 void Attach(Actor other)
     
	{
		local Table t;
		local actor A;

		TableStrength -= Damage;

		if(TableStrength < 0)
		{
			DisableCollision();
			t = spawn(class'Table',,,, Rotation+Rot(0, 32768, 0));
			t.DisableCollision();
			BreakTable();
			t.BreakTable();
			EnableCollision();
			t.EnableCollision();
			GotoState('BrokenTable');
			t.GotoState('BrokenTable');

			foreach BasedActors(class'actor', A)
			{
				slog("throwing "$A.name);
				A.SetPhysics(PHYS_Falling);
				A.Velocity += VRand()*30;
			}
		}
	}

	
 bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)
     
	{
		TableStrength = 60.0;
	}

	
 void BeginState()
     
{
	



Source Code


00001	//=============================================================================
00002	// Table.
00003	//=============================================================================
00004	class Table expands DecorationRune;
00005	
00006	// INSTANCE VARIABLES ---------------------------------------------------------
00007	
00008	//var float TableStrength;
00009	
00010	// FUNCTIONS ------------------------------------------------------------------
00011	
00012	//============================================================
00013	//
00014	// MatterForJoint
00015	//
00016	// Returns what kind of material joint is associated with
00017	//============================================================
00018	function EMatterType MatterForJoint(int joint)
00019	{
00020		return MATTER_WOOD;
00021	}
00022	
00023	/*
00024	
00025	function BreakTable()
00026	{
00027		SkelMesh = 1;
00028		SetRotation(Rotation + Rot(5680, 0, 0));
00029		SetLocation(Location - Vect(0, 0, 34));
00030	}
00031	
00032	function DisableCollision()
00033	{
00034		SetCollision(false, false, false);
00035		bCollideWorld = false;
00036		bJointsBlock = false;
00037	}
00038	
00039	function EnableCollision()
00040	{
00041		SetCollision(true, true, true);
00042		bCollideWorld = true;
00043		bJointsBlock = true;
00044	}
00045	
00046	// STATES ---------------------------------------------------------------------
00047	auto state SolidTable
00048	{
00049		function BeginState()
00050		{
00051			TableStrength = 60.0;
00052		}
00053	
00054		function bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)
00055		{
00056			local Table t;
00057			local actor A;
00058	
00059			TableStrength -= Damage;
00060	
00061			if(TableStrength < 0)
00062			{
00063				DisableCollision();
00064				t = spawn(class'Table',,,, Rotation+Rot(0, 32768, 0));
00065				t.DisableCollision();
00066				BreakTable();
00067				t.BreakTable();
00068				EnableCollision();
00069				t.EnableCollision();
00070				GotoState('BrokenTable');
00071				t.GotoState('BrokenTable');
00072	
00073				foreach BasedActors(class'actor', A)
00074				{
00075					slog("throwing "$A.name);
00076					A.SetPhysics(PHYS_Falling);
00077					A.Velocity += VRand()*30;
00078				}
00079			}
00080		}
00081	
00082		function Attach(actor other)
00083		{
00084			if (Other.Mass > 200)
00085				JointDamaged(TableStrength, Pawn(other), Location, vect(0,0,0), 'crushed', 1);
00086			else if (Other.Mass > 50)
00087				JointDamaged(Abs(other.Velocity.Z)*other.mass/1000, Pawn(other), Location, vect(0,0,0), 'crushed', 1);
00088		}
00089	}
00090	
00091	state BrokenTable
00092	{
00093	}
00094	*/
00095	
00096	defaultproperties
00097	{
00098	     DrawType=DT_SkeletalMesh
00099	     LODCurve=LOD_CURVE_CONSERVATIVE
00100	     CollisionRadius=105.000000
00101	     CollisionHeight=23.000000
00102	     bCollideActors=True
00103	     bCollideWorld=True
00104	     bBlockActors=True
00105	     bBlockPlayers=True
00106	     bJointsBlock=True
00107	     Skeletal=SkelModel'objects.Table'
00108	}

End Source Code