/// <summary> /// Method to create cargo plane that drops our custom airdrops /// </summary> /// <param name="supplySignal">Supply signal that has initiated the custom airdrop (used for position & to cancel default airdrop)</param> /// <param name="cargoType">The type of cargo to drop (custom airdrop)</param> private void CallSpecializedCargoPlane(SupplySignal supplySignal, CargoType cargoType) { // Stop the normal cargo plane var cargoPlane = supplySignal.GetComponent <CargoPlane>(); if (cargoPlane == null) { Interface.Oxide.LogDebug("Cargo plane not found"); } NextTick(() => { cargoPlane?.Kill(); }); // REMOVE WHEN FINISHED<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< var planes = UnityEngine.Object.FindObjectsOfType <CargoPlane>().ToList(); Interface.Oxide.LogDebug($"Found {planes?.Count ?? 0} active cargo planes"); foreach (var plane in planes) { Interface.Oxide.LogDebug($"Killing plane: {plane.name}"); NextTick(() => { plane?.Kill(); }); } // Service to create custom airdrops (type defined in constructor) var vehicleDroppingService = new VehicleDroppingService(cargoType); // Put the special cargo plane into action vehicleDroppingService.CallPlane(supplySignal.transform.position); }
private void CallRHIBAirdrop(BasePlayer player, string command, string[] args) { // Setup vehicle dropping service and call plane var vehicleDroppingService = new VehicleDroppingService(CargoType.RHIB); vehicleDroppingService.CallPlane(player.transform.position); }
private void CallRandomAirdrop(BasePlayer player, string command, string[] args) { try { // Parse argument (as enum) var cargoType = (CargoType)Enum.Parse(typeof(CargoType), args.FirstOrDefault()); // Setup vehicle dropping service and call plane var vehicleDroppingService = new VehicleDroppingService(cargoType); vehicleDroppingService.CallPlane(player.transform.position); } catch (Exception ex) { // Log exception? } }