So. I've seen a few plugins do this before but I am unaware of how it works. I am wanting to understand how to make the CargoPlane maybe dive down and then egress upwards and fly out of the map. I see that there are a few variables I might want to use:
Such as endPos, startPos, secondsToTake, Etc. How would I use these to make the plane dive?Code:// Decompiled with JetBrains decompiler // Type: CargoPlane // Assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: DA3DCAB1-4D28-4522-B9B6-DB2D2641EAA1 // Assembly location: C:\Users\tract\Desktop\Assembly-CSharp.dllusing Oxide.Core; using UnityEngine;public class CargoPlane : BaseEntity { private Vector3 dropPosition = Vector3.get_zero(); public GameObjectRef prefabDrop; public SpawnFilter filter; private Vector3 startPos; private Vector3 endPos; private float secondsToTake; private float secondsTaken; private bool dropped; public void InitDropPosition(Vector3 newDropPosition) { this.dropPosition = newDropPosition; this.dropPosition.y = (__Null) 0.0; } public override void ServerInit() { base.ServerInit(); if (Vector3.op_Equality(this.dropPosition, Vector3.get_zero())) this.dropPosition = this.RandomDropPosition(); this.UpdateDropPosition(this.dropPosition); } public Vector3 RandomDropPosition() { Vector3.get_zero(); float num1 = 100f; float num2 = (float) TerrainMeta.Size.x; Vector3 worldPos; do { worldPos = Vector3Ex.Range((float) -((double) num2 / 3.0), num2 / 3f); } while ((double) this.filter.GetFactor(worldPos) == 0.0 && (double) --num1 > 0.0); worldPos.y = (__Null) 0.0; return worldPos; } public void UpdateDropPosition(Vector3 newDropPosition) { float num1 = (float) TerrainMeta.Size.x; float num2 = (float) (TerrainMeta.HighestPoint.y + 250.0); this.startPos = Vector3Ex.Range(-1f, 1f); this.startPos.y = (__Null) 0.0; // ISSUE: explicit reference operation ((Vector3) @this.startPos).Normalize(); CargoPlane cargoPlane1 = this; Vector3 vector3_1 = Vector3.op_Multiply(cargoPlane1.startPos, num1 * 2f); cargoPlane1.startPos = vector3_1; this.startPos.y = (__Null) (double) num2; this.endPos = Vector3.op_Multiply(this.startPos, -1f); this.endPos.y = this.startPos.y; CargoPlane cargoPlane2 = this; Vector3 vector3_2 = Vector3.op_Addition(cargoPlane2.startPos, newDropPosition); cargoPlane2.startPos = vector3_2; CargoPlane cargoPlane3 = this; Vector3 vector3_3 = Vector3.op_Addition(cargoPlane3.endPos, newDropPosition); cargoPlane3.endPos = vector3_3; this.secondsToTake = Vector3.Distance(this.startPos, this.endPos) / 50f; this.secondsToTake *= Random.Range(0.95f, 1.05f); ((Component) this).get_transform().set_position(this.startPos); ((Component) this).get_transform().set_rotation(Quaternion.LookRotation(Vector3.op_Subtraction(this.endPos, this.startPos))); this.dropPosition = newDropPosition; Interface.CallHook("OnAirdrop", (object) this, (object) newDropPosition); } private void Update() { if (!this.isServer) return; this.secondsTaken += Time.get_deltaTime(); float num = Mathf.InverseLerp(0.0f, this.secondsToTake, this.secondsTaken); if (!this.dropped && (double) num >= 0.5) { this.dropped = true; BaseEntity entity = GameManager.server.CreateEntity(this.prefabDrop.resourcePath, ((Component) this).get_transform().get_position(), (Quaternion) null, true); if (Object.op_Implicit((Object) entity)) { entity.globalBroadcast = true; entity.Spawn(); } } ((Component) this).get_transform().set_position(Vector3.Lerp(this.startPos, this.endPos, num)); ((Component) this).get_transform().set_hasChanged(true); if ((double) num < 1.0) return; this.Kill(BaseNetworkable.DestroyMode.None); } }
Making cargo plane dive and such?
Discussion in 'Rust Development' started by DylanSMR, Oct 16, 2016.
-
Wulf Community Admin
Trying to recreate @k1lly0u's private plugin?
-
Haha no. Wouldn't do that to him. Had a different idea in mind actually. Much different then that
-
I won't give away any info on how I made that plugin but for some very basic info on moving a plane you can look at Airstrike, specifically the squad strike feature. It's not much but it's a start
-
Yeah I can understand you would not want to give much away haha. Thanks though
-
booooooooooooooooooooooo
-
Hmmmmm?
