Utility/VehicleSpawnResource.cs

A GameResource asset type for vehicle spawn entries used by the Road Tool. It stores a prefab GameObject and a spawn probability, and provides a simple icon for the asset browser.

using Sandbox;

namespace RedSnail.RoadTool;

[AssetType(Name = "Vehicle Spawn", Extension = "vspawn", Category = "Road Tool")]
public sealed class VehicleSpawnResource : GameResource
{
	[Property] public GameObject Prefab { get; set; }

	[Property, Range(0.0f, 10.0f)] public float Probability { get; set; } = 1.0f;
	
	
	
	protected override Bitmap CreateAssetTypeIcon(int _Width, int _Height)
	{
		return CreateSimpleAssetTypeIcon("car_rental", _Width, _Height, "#00ccff", "black");
	}
}