using Sandbox.ModelEditor.Nodes;
namespace Sandbox;
public partial class Model
{
public class CommonData
{
///
/// If the prop is destructable this is its start health
///
public float Health { get; } = -1;
///
/// Should this prop explode when destroyed? If so, this is the radius of the damage from it.
///
public bool Flammable { get; }
///
/// Should this prop explode when destroyed? If so, this is the radius of the damage from it.
///
public bool Explosive { get; }
///
/// Should this prop explode when destroyed? If so, this is the radius of the damage from it.
///
public float ExplosionRadius { get; } = -1;
///
/// Should this prop explode when destroyed? If so, this is the radius of the damage from it.
///
public float ExplosionDamage { get; } = -1;
///
/// Should this prop explode when destroyed? If so, this is the physics push force from it.
///
public float ExplosionForce { get; } = -1;
internal void Dispose()
{
// nothing needed
}
internal CommonData( Model model )
{
if ( model.TryGetData( out var propData ) )
{
Health = propData.Health;
Flammable = propData.Flammable;
if ( propData.Explosive )
{
Explosive = propData.Explosive;
ExplosionRadius = propData.ExplosionRadius;
ExplosionDamage = propData.ExplosionDamage;
ExplosionForce = propData.ExplosionForce;
}
}
}
}
CommonData _data;
public CommonData Data => _data ??= new CommonData( this );
}