Core/PrototypeFactory.cs
namespace Prototype;

public static class PrototypeFactory
{
	public static GameObject Box( string name, Vector3 position, Vector3 size, Color color, bool collider = true, GameObject parent = null )
	{
		var go = new GameObject( true, name );
		go.WorldPosition = position;
		// The shipped dev box is 50 units wide in this S&box build.
		go.WorldScale = size / 50f;
		// Preserve the requested world transform. Parenting before assigning world scale
		// compounds the scale of procedural children and creates giant geometry.
		if ( parent is not null ) go.SetParent( parent, true );
		var renderer = go.Components.Create<ModelRenderer>();
		renderer.Model = Model.Load( "models/dev/box.vmdl" );
		renderer.MaterialOverride = Material.Load( "materials/prototype/ruin_stone.vmat" );
		renderer.Tint = color;
		if ( collider )
		{
			var box = go.Components.Create<BoxCollider>();
			box.Scale = new Vector3( 50f );
		}
		return go;
	}

	public static GameObject Disc( string name, Vector3 position, float radius, float height, Color color, GameObject parent = null )
	{
		var go = Box( name, position, new Vector3( radius * 2f, radius * 2f, height ), color, false, parent );
		go.WorldRotation = Rotation.FromYaw( 45f );
		return go;
	}
}