Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions CustomMapVehicleVendorFix.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Facepunch;
using Facepunch;
using System.Linq;
using UnityEngine;
using System.Collections.Generic;

namespace Oxide.Plugins
{
[Info("Custom Map Vehicle Vendor Fix", "Pinkstink", "1.0.4")]
[Info("Custom Map Vehicle Vendor Fix", "Pinkstink", "1.0.5")]
[Description("Links all of the VehicleVendor NPC with the VehicleSpawner entity for custom maps")]
public class CustomMapVehicleVendorFix : RustPlugin
{
Expand All @@ -25,12 +26,12 @@ void OnServerInitialized()
if (vehicleVendor.GetVehicleSpawner() != null && vehicleVendor.vehicleSpawner != null)
continue;

var vehicleSpawners = Pool.GetList<VehicleSpawner>();
var vehicleSpawners = Pool.Get<List<VehicleSpawner>>();
Vis.Entities(vehicleVendor.transform.position, 100f, vehicleSpawners);
if (vehicleSpawners == null || vehicleSpawners.Count < 1)
{
PrintError($"Failed to find Vehicle Spawner for Vendor @ {vehicleVendor.transform.position}");
Pool.FreeList(ref vehicleSpawners);
Pool.FreeUnmanaged(ref vehicleSpawners);
continue;
}

Expand All @@ -47,14 +48,14 @@ void OnServerInitialized()
if (vehicleSpawner == null)
{
PrintError($"Failed to find a nearby Vehicle Spawner for Vendor @ {vehicleVendor.transform.position}");
Pool.FreeList(ref vehicleSpawners);
Pool.FreeUnmanaged(ref vehicleSpawners);
continue;
}

vehicleVendor.spawnerRef.Set(vehicleSpawner);
vehicleVendor.vehicleSpawner = vehicleSpawner;
Puts($"Set Vehicle Spawner for Vehicle Vendor @ {vehicleVendor.transform.position}");
Pool.FreeList(ref vehicleSpawners);
Pool.FreeUnmanaged(ref vehicleSpawners);
}
}
}
Expand Down