Core.Object | +--Engine.Actor | +--Engine.Decoration | +--RuneI.DecorationRune | +--RuneI.HangingChain
name
AttachmentTag
float
LastSoundPlayed
TimeBetweenBrushes
void
AddVelocity(vector NewVelocity)
simulated
ApplyPropogatedForce(vector force, int joint)
Debug(Canvas canvas, int mode)
bool
JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint)
JointTouchedBy(Actor Other, int joint)
EMatterType
MatterForJoint(int joint)
PlayBrushSound(Actor Other)
PostBeginPlay()
00001 //============================================================================= 00002 // HangingChain. 00003 //============================================================================= 00004 class HangingChain extends DecorationRune; 00005 00006 var(Dynamics) float Dampening; 00007 var(Dynamics) int RotAngle; 00008 var(Dynamics) float AccelMag; 00009 var(Dynamics) float TouchFactor; 00010 var(Dynamics) float HitFactor; 00011 var(Dynamics) float PropogationFactor; 00012 00013 var() float TimeBetweenBrushes; 00014 00015 var(Sounds) sound BrushSound; 00016 var() name AttachmentTag; 00017 00018 var float LastSoundPlayed; 00019 00020 00021 simulated event GetAccelJointParms(int joint, out float DampFactor, out float RotThreshold) 00022 { 00023 DampFactor = Dampening; 00024 RotThreshold = RotAngle; 00025 } 00026 00027 simulated event float GetAccelJointMagnitude(int joint) 00028 { 00029 return AccelMag; 00030 } 00031 00032 function EMatterType MatterForJoint(int joint) 00033 { 00034 return MATTER_NONE; 00035 } 00036 00037 function PostBeginPlay() 00038 { 00039 local actor A; 00040 00041 foreach AllActors(class'actor', A, AttachmentTag) 00042 { 00043 if (A!=self) 00044 { 00045 A.SetCollision(false, false, false); 00046 AttachActorToJoint(A, JointNamed('rope_tip')); 00047 break; 00048 } 00049 } 00050 00051 LastSoundPlayed = Level.TimeSeconds; 00052 Super.PreBeginPlay(); 00053 } 00054 00055 function PlayBrushSound(actor Other) 00056 { 00057 if (Level.TimeSeconds - LastSoundPlayed > TimeBetweenBrushes) 00058 { 00059 PlaySound(BrushSound, SLOT_None); 00060 LastSoundPlayed = Level.TimeSeconds; 00061 if (Pawn(Other) != None || Other.Instigator != None) 00062 { 00063 Other.MakeNoise(1.0); 00064 } 00065 } 00066 } 00067 00068 simulated function ApplyPropogatedForce(vector force, int joint) 00069 { 00070 local vector vel; 00071 local int j; 00072 00073 vel = force; 00074 j = joint; 00075 while ((JointFlags[j] & JOINT_FLAG_ACCELERATIVE)!=0) 00076 { 00077 ApplyJointForce(j, vel); 00078 vel *= PropogationFactor; 00079 j--; 00080 } 00081 } 00082 00083 function bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Momentum, name DamageType, int joint) 00084 { 00085 if (joint != 0) 00086 { 00087 ApplyPropogatedForce(Momentum*HitFactor, joint); 00088 PlayBrushSound(EventInstigator); 00089 } 00090 00091 Super.JointDamaged(Damage, EventInstigator, HitLoc, Momentum, DamageType, joint); 00092 return true; 00093 } 00094 00095 simulated function JointTouchedBy(actor Other, int joint) 00096 { 00097 ApplyPropogatedForce(Other.Velocity*TouchFactor, joint); 00098 PlayBrushSound(Other); 00099 } 00100 00101 function AddVelocity(vector NewVelocity) 00102 { 00103 ApplyPropogatedForce(NewVelocity*TouchFactor, JointNamed('ropem')); 00104 } 00105 00106 simulated function Debug(Canvas canvas, int mode) 00107 { 00108 Super.Debug(canvas, mode); 00109 00110 Canvas.DrawText("Dynamics:"); 00111 Canvas.CurY -= 8; 00112 Canvas.DrawText(" Dampening: "$Dampening); 00113 Canvas.CurY -= 8; 00114 Canvas.DrawText(" RotAngle: "$RotAngle); 00115 Canvas.CurY -= 8; 00116 Canvas.DrawText(" AccelMag: "$AccelMag); 00117 Canvas.CurY -= 8; 00118 Canvas.DrawText(" TouchFactor: "$TouchFactor); 00119 Canvas.CurY -= 8; 00120 Canvas.DrawText(" HitFactor: "$HitFactor); 00121 Canvas.CurY -= 8; 00122 Canvas.DrawText(" PropogationFactor: "$PropogationFactor); 00123 Canvas.CurY -= 8; 00124 } 00125 00126 defaultproperties 00127 { 00128 Dampening=0.010000 00129 RotAngle=8000 00130 AccelMag=1000.000000 00131 TouchFactor=0.002000 00132 HitFactor=0.020000 00133 PropogationFactor=0.900000 00134 TimeBetweenBrushes=1.500000 00135 BrushSound=Sound'FootstepsSnd.Bridge.footbridge01' 00136 bStatic=False 00137 AnimSequence=feetfirst 00138 DrawType=DT_SkeletalMesh 00139 CollisionRadius=5.000000 00140 CollisionHeight=134.399994 00141 bCollideActors=True 00142 bCollideWorld=True 00143 bJointsTouch=True 00144 Skeletal=SkelModel'objects.Rope' 00145 }