Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void AttachChains()
- {
- if (!this.Player.Character.isRagdoll)
- {
- if (this.Player.Character.isGettingUp)
- {
- return;
- }
- bool flag = false;
- short arg_32_0 = 2;
- short num = this.maxChainObj;
- for (short num2 = arg_32_0; num2 <= num; num2 += 1)
- {
- if (this.Exists(this.objChain[(int)num2]))
- {
- if (Conversions.ToBoolean(NewLateBinding.LateGet(this.objChain[(int)num2].Metadata, null, "isAttToPl", new object[0], null, null, null)))
- {
- this.objChain[(int)num2].Detach();
- NewLateBinding.LateSetComplex(this.objChain[(int)num2].Metadata, null, "isAttToPl", new object[]
- {
- false
- }, null, null, false, true);
- }
- if (!this.objChain[(int)num2].isAttachedSomewhere)
- {
- flag = true;
- this.chainAttackMode = 0;
- this.pChainTargetGrab = null;
- this.vChainTargetGrab = null;
- Function.Call("ATTACH_OBJECT_TO_OBJECT_PHYSICALLY", new Parameter[]
- {
- this.objChain[(int)num2],
- this.objChain[(int)checked(num2 - 1)],
- false,
- 0,
- this.vecChainDim.X / 2f,
- this.vecChainDim.Y / 2f,
- this.vecChainDim.Z / 2f,
- 0.05,
- 0.05,
- 0.05,
- 0,
- 0
- });
- }
- }
- }
- if (flag)
- {
- short arg_1D9_0 = 2;
- short num3 = this.maxChainObj;
- for (short num4 = arg_1D9_0; num4 <= num3; num4 += 1)
- {
- if (this.Exists(this.objChain[(int)num4]))
- {
- this.objChain[(int)num4].Visible = true;
- }
- }
- }
- }
- }
- private object moveChainToVec(Vector3 v, double speed, short freezeTime)
- {
- if (!this.Exists(this.objChain[(int)this.maxChainObj]))
- {
- return false;
- }
- if (this.timeOutMoveChain > 700)
- {
- this.chainAttackMode = 0;
- return true;
- }
- if (this.chainAttackMode > 0)
- {
- this.Player.Character.Heading = Game.CurrentCamera.Heading;
- }
- if (this.objChain[(int)this.maxChainObj].Position.DistanceTo(v) > 2f)
- {
- this.timeOutMoveChain = checked((short)((int)this.timeOutMoveChain + this.Interval));
- this.vecVelocityGeneral = (v - this.objChain[(int)this.maxChainObj].Position) * v.DistanceTo(this.objChain[(int)this.maxChainObj].Position) * 2f * (float)speed;
- GTA.Object arg_118_0 = this.objChain[(int)this.maxChainObj];
- object expr_107 = this.ControlVelocity(this.vecVelocityGeneral, 100.0, 0.0);
- Vector3 vector;
- arg_118_0.Velocity = ((expr_107 != null) ? ((Vector3)expr_107) : vector);
- if (this.Exists(this.pChainTargetGrab))
- {
- this.vecVelocityGeneral = (v - this.pChainTargetGrab.Position) * 10f * (float)speed;
- Ped arg_18B_0 = this.pChainTargetGrab;
- object expr_17A = this.ControlVelocity(this.vecVelocityGeneral, 100.0, 0.0);
- arg_18B_0.Velocity = ((expr_17A != null) ? ((Vector3)expr_17A) : vector);
- if (freezeTime == 0 && this.pChainTargetGrab.Position.DistanceTo(v) <= 1f)
- {
- return true;
- }
- }
- if (this.Exists(this.vChainTargetGrab))
- {
- 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))
- {
- if (this.vChainTargetGrab.Position.DistanceTo(this.Player.Character.Position) > this.vChainTargetGrab.Position.DistanceTo(this.vChainTarget.Position))
- {
- NewLateBinding.LateSetComplex(this.vChainTarget.Metadata, null, "hit", new object[]
- {
- true
- }, null, null, false, true);
- }
- if (this.vChainTargetGrab.Position.DistanceTo(this.vChainTarget.Position) < 20f)
- {
- this.vChainTargetGrab.ApplyForce(Vector3.Normalize(this.vChainTarget.Position - this.vChainTargetGrab.Position) * 50f);
- }
- }
- else
- {
- this.vChainTargetGrab.ApplyForce(Vector3.Normalize(v - this.vChainTargetGrab.Position) * 10f);
- }
- if (freezeTime == 0 && this.vChainTargetGrab.Position.DistanceTo(v) <= 3f)
- {
- return true;
- }
- }
- return false;
- }
- if (this.Exists(this.pChainTargetGrab))
- {
- this.pChainTargetGrab.Velocity = Vector3.Zero;
- }
- while (freezeTime >= 0)
- {
- freezeTime = Conversions.ToShort(Operators.SubtractObject(freezeTime, this.getInterval()));
- this.objChain[(int)this.maxChainObj].Velocity = (v - this.objChain[(int)this.maxChainObj].Position) * v.DistanceTo(this.objChain[(int)this.maxChainObj].Position) * 2f * (float)speed;
- if (this.Exists(this.pChainTargetGrab))
- {
- this.pChainTargetGrab.Velocity = Vector3.WorldUp / 2f;
- }
- if (this.Exists(this.vChainTargetGrab))
- {
- this.vChainTargetGrab.ApplyForce(Vector3.WorldUp / 3f, Vector3.WorldEast * 3f);
- }
- this.Wait(Conversions.ToInteger(this.getInterval()));
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment