void cmdConsoleAirdropMassDrop(ConsoleSystem.Arg arg) { if (arg.connection != null) { if (arg.connection.authLevel < 1) { SendReply(arg, "You are not allowed to use this command"); return; } } if (arg.Args == null || arg.Args.Length < 1) { SendReply(arg, "You must select the number of airdrops that you want"); return; } for (int i = 0; i < Convert.ToInt32(arg.Args[0]); i++) { AllowNextDrop(); Vector3 dropposition = RandomDropPoint(); BaseEntity entity = GameManager.server.CreateEntity("assets/bundled/prefabs/events/cargo_plane.prefab", new Vector3(), defaultRot); if (entity != null) { CargoPlane plane = entity.GetComponent <CargoPlane>(); plane.InitDropPosition(dropposition); entity.Spawn(true); CPsecondsToTake.SetValue(plane, Vector3.Distance((Vector3)CPendPos.GetValue(plane), (Vector3)CPstartPos.GetValue(plane)) / airdropSpeed); } } }
void cmdConsoleAirdropToPos(ConsoleSystem.Arg arg) { if (arg.connection != null) { if (arg.connection.authLevel < 1) { SendReply(arg, "You are not allowed to use this command"); return; } } if (arg.Args == null || arg.Args.Length < 3) { SendReply(arg, "You must give coordinates of destination ex: airdrop.topos 124 200 -453"); return; } AllowNextDrop(); BaseEntity entity = GameManager.server.CreateEntity("assets/bundled/prefabs/events/cargo_plane.prefab", new Vector3(), defaultRot); if (entity != null) { var targetPos = new Vector3(); targetPos.x = Convert.ToSingle(arg.Args[0]); targetPos.y = Convert.ToSingle(arg.Args[1]); targetPos.z = Convert.ToSingle(arg.Args[2]); CargoPlane plane = entity.GetComponent <CargoPlane>(); plane.InitDropPosition(targetPos); entity.Spawn(true); CPsecondsToTake.SetValue(plane, Vector3.Distance((Vector3)CPendPos.GetValue(plane), (Vector3)CPstartPos.GetValue(plane)) / airdropSpeed); } }
void SpawnAirdrop(Vector3 position) { BaseEntity planeEntity = GameManager.server.CreateEntity("assets/prefabs/npc/cargo plane/cargo_plane.prefab", new Vector3(), new Quaternion(1f, 0f, 0f, 0f)); if (planeEntity != null) { CargoPlane plane = planeEntity.GetComponent <CargoPlane>(); plane.InitDropPosition(position); planeEntity.Spawn(); } }
public void SpawnPlane(CargoPlane plane, Vector3 position, float speed, bool isSquad = false, Vector3 offset = new Vector3()) { enabled = true; Plane = plane; TargetPosition = position; Plane.InitDropPosition(position); Plane.Spawn(); if (isSquad) { Vector3 SpawnPos = CalculateSpawnPos(offset); StartPos.SetValue(Plane, SpawnPos); EndPos.SetValue(Plane, SpawnPos - new Vector3(0, 0, TerrainMeta.Size.x)); Plane.transform.position = SpawnPos; Plane.transform.rotation = new Quaternion(0, 180, 0, 0); } TimeToTake.SetValue(Plane, Vector3.Distance((Vector3)StartPos.GetValue(Plane), (Vector3)EndPos.GetValue(Plane)) / speed); InvokeRepeating("CheckDistance", 3, 3); }
private void callDrop(int num = 1) { int i = 0; while (i < num) { BaseEntity entity = GameManager.server.CreateEntity("assets/prefabs/npc/cargo plane/cargo_plane.prefab", new Vector3(), new Quaternion(), true); if (!(bool)((UnityEngine.Object)entity)) { return; } CargoPlane cargoI = entity.GetComponent <CargoPlane>(); cargoI.InitDropPosition(GetRandomWorldPos()); entity.Spawn(true); i++; } }
void cmdConsoleAirdropToPlayer(ConsoleSystem.Arg arg) { if (arg.connection != null) { if (arg.connection.authLevel < 1) { SendReply(arg, "You are not allowed to use this command"); return; } } if (arg.Args == null || arg.Args.Length < 1) { SendReply(arg, "You must select a player to check"); return; } var target = BasePlayer.Find(arg.Args[0].ToString()); if (target == null || target.net == null || target.net.connection == null) { SendReply(arg, "Target player not found"); } else { AllowNextDrop(); BaseEntity entity = GameManager.server.CreateEntity("assets/bundled/prefabs/events/cargo_plane.prefab", new Vector3(), defaultRot); if (entity != null) { var targetPos = target.transform.position; targetPos.y = Convert.ToSingle(GetRandomNumber((int)dropMinY, (int)dropMaxY + 1)); CargoPlane plane = entity.GetComponent <CargoPlane>(); plane.InitDropPosition(targetPos); entity.Spawn(true); CPsecondsToTake.SetValue(plane, Vector3.Distance((Vector3)CPendPos.GetValue(plane), (Vector3)CPstartPos.GetValue(plane)) / airdropSpeed); } } }