conkor

GhostRider Chain Weapon

Feb 18th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.81 KB | None | 0 0
  1. private void AttachChains()
  2.     {
  3.         if (!this.Player.Character.isRagdoll)
  4.         {
  5.             if (this.Player.Character.isGettingUp)
  6.             {
  7.                 return;
  8.             }
  9.             bool flag = false;
  10.             short arg_32_0 = 2;
  11.             short num = this.maxChainObj;
  12.             for (short num2 = arg_32_0; num2 <= num; num2 += 1)
  13.             {
  14.                 if (this.Exists(this.objChain[(int)num2]))
  15.                 {
  16.                     if (Conversions.ToBoolean(NewLateBinding.LateGet(this.objChain[(int)num2].Metadata, null, "isAttToPl", new object[0], null, null, null)))
  17.                     {
  18.                         this.objChain[(int)num2].Detach();
  19.                         NewLateBinding.LateSetComplex(this.objChain[(int)num2].Metadata, null, "isAttToPl", new object[]
  20.                         {
  21.                             false
  22.                         }, null, null, false, true);
  23.                     }
  24.                     if (!this.objChain[(int)num2].isAttachedSomewhere)
  25.                     {
  26.                         flag = true;
  27.                         this.chainAttackMode = 0;
  28.                         this.pChainTargetGrab = null;
  29.                         this.vChainTargetGrab = null;
  30.                         Function.Call("ATTACH_OBJECT_TO_OBJECT_PHYSICALLY", new Parameter[]
  31.                         {
  32.                             this.objChain[(int)num2],
  33.                             this.objChain[(int)checked(num2 - 1)],
  34.                             false,
  35.                             0,
  36.                             this.vecChainDim.X / 2f,
  37.                             this.vecChainDim.Y / 2f,
  38.                             this.vecChainDim.Z / 2f,
  39.                             0.05,
  40.                             0.05,
  41.                             0.05,
  42.                             0,
  43.                             0
  44.                         });
  45.                     }
  46.                 }
  47.             }
  48.             if (flag)
  49.             {
  50.                 short arg_1D9_0 = 2;
  51.                 short num3 = this.maxChainObj;
  52.                 for (short num4 = arg_1D9_0; num4 <= num3; num4 += 1)
  53.                 {
  54.                     if (this.Exists(this.objChain[(int)num4]))
  55.                     {
  56.                         this.objChain[(int)num4].Visible = true;
  57.                     }
  58.                 }
  59.             }
  60.         }
  61.     }
  62.  
  63. private object moveChainToVec(Vector3 v, double speed, short freezeTime)
  64.     {
  65.         if (!this.Exists(this.objChain[(int)this.maxChainObj]))
  66.         {
  67.             return false;
  68.         }
  69.         if (this.timeOutMoveChain > 700)
  70.         {
  71.             this.chainAttackMode = 0;
  72.             return true;
  73.         }
  74.         if (this.chainAttackMode > 0)
  75.         {
  76.             this.Player.Character.Heading = Game.CurrentCamera.Heading;
  77.         }
  78.         if (this.objChain[(int)this.maxChainObj].Position.DistanceTo(v) > 2f)
  79.         {
  80.             this.timeOutMoveChain = checked((short)((int)this.timeOutMoveChain + this.Interval));
  81.             this.vecVelocityGeneral = (v - this.objChain[(int)this.maxChainObj].Position) * v.DistanceTo(this.objChain[(int)this.maxChainObj].Position) * 2f * (float)speed;
  82.             GTA.Object arg_118_0 = this.objChain[(int)this.maxChainObj];
  83.             object expr_107 = this.ControlVelocity(this.vecVelocityGeneral, 100.0, 0.0);
  84.             Vector3 vector;
  85.             arg_118_0.Velocity = ((expr_107 != null) ? ((Vector3)expr_107) : vector);
  86.             if (this.Exists(this.pChainTargetGrab))
  87.             {
  88.                 this.vecVelocityGeneral = (v - this.pChainTargetGrab.Position) * 10f * (float)speed;
  89.                 Ped arg_18B_0 = this.pChainTargetGrab;
  90.                 object expr_17A = this.ControlVelocity(this.vecVelocityGeneral, 100.0, 0.0);
  91.                 arg_18B_0.Velocity = ((expr_17A != null) ? ((Vector3)expr_17A) : vector);
  92.                 if (freezeTime == 0 && this.pChainTargetGrab.Position.DistanceTo(v) <= 1f)
  93.                 {
  94.                     return true;
  95.                 }
  96.             }
  97.             if (this.Exists(this.vChainTargetGrab))
  98.             {
  99.                 if (Conversions.ToBoolean((!Conversions.ToBoolean(freezeTime == 0 && this.Exists(this.vChainTarget) && this.vChainTarget.Model.isHelicopter) || !Conversions.ToBoolean(Operators.NotObject(NewLateBinding.LateGet(this.vChainTarget.Metadata, null, "hit", new object[0], null, null, null)))) ? false : true))
  100.                 {
  101.                     if (this.vChainTargetGrab.Position.DistanceTo(this.Player.Character.Position) > this.vChainTargetGrab.Position.DistanceTo(this.vChainTarget.Position))
  102.                     {
  103.                         NewLateBinding.LateSetComplex(this.vChainTarget.Metadata, null, "hit", new object[]
  104.                         {
  105.                             true
  106.                         }, null, null, false, true);
  107.                     }
  108.                     if (this.vChainTargetGrab.Position.DistanceTo(this.vChainTarget.Position) < 20f)
  109.                     {
  110.                         this.vChainTargetGrab.ApplyForce(Vector3.Normalize(this.vChainTarget.Position - this.vChainTargetGrab.Position) * 50f);
  111.                     }
  112.                 }
  113.                 else
  114.                 {
  115.                     this.vChainTargetGrab.ApplyForce(Vector3.Normalize(v - this.vChainTargetGrab.Position) * 10f);
  116.                 }
  117.                 if (freezeTime == 0 && this.vChainTargetGrab.Position.DistanceTo(v) <= 3f)
  118.                 {
  119.                     return true;
  120.                 }
  121.             }
  122.             return false;
  123.         }
  124.         if (this.Exists(this.pChainTargetGrab))
  125.         {
  126.             this.pChainTargetGrab.Velocity = Vector3.Zero;
  127.         }
  128.         while (freezeTime >= 0)
  129.         {
  130.             freezeTime = Conversions.ToShort(Operators.SubtractObject(freezeTime, this.getInterval()));
  131.             this.objChain[(int)this.maxChainObj].Velocity = (v - this.objChain[(int)this.maxChainObj].Position) * v.DistanceTo(this.objChain[(int)this.maxChainObj].Position) * 2f * (float)speed;
  132.             if (this.Exists(this.pChainTargetGrab))
  133.             {
  134.                 this.pChainTargetGrab.Velocity = Vector3.WorldUp / 2f;
  135.             }
  136.             if (this.Exists(this.vChainTargetGrab))
  137.             {
  138.                 this.vChainTargetGrab.ApplyForce(Vector3.WorldUp / 3f, Vector3.WorldEast * 3f);
  139.             }
  140.             this.Wait(Conversions.ToInteger(this.getInterval()));
  141.         }
  142.         return true;
  143.     }
Advertisement
Add Comment
Please, Sign In to add comment