mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-15 01:39:39 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
69 lines
1.6 KiB
C#
69 lines
1.6 KiB
C#
using Sandbox.ModelEditor.Nodes;
|
|
|
|
namespace Sandbox;
|
|
|
|
public partial class Model
|
|
{
|
|
public class CommonData
|
|
{
|
|
/// <summary>
|
|
/// If the prop is destructable this is its start health
|
|
/// </summary>
|
|
public float Health { get; } = -1;
|
|
|
|
/// <summary>
|
|
/// Should this prop explode when destroyed? If so, this is the radius of the damage from it.
|
|
/// </summary>
|
|
public bool Flammable { get; }
|
|
|
|
/// <summary>
|
|
/// Should this prop explode when destroyed? If so, this is the radius of the damage from it.
|
|
/// </summary>
|
|
public bool Explosive { get; }
|
|
|
|
/// <summary>
|
|
/// Should this prop explode when destroyed? If so, this is the radius of the damage from it.
|
|
/// </summary>
|
|
public float ExplosionRadius { get; } = -1;
|
|
|
|
/// <summary>
|
|
/// Should this prop explode when destroyed? If so, this is the radius of the damage from it.
|
|
/// </summary>
|
|
public float ExplosionDamage { get; } = -1;
|
|
|
|
/// <summary>
|
|
/// Should this prop explode when destroyed? If so, this is the physics push force from it.
|
|
/// </summary>
|
|
public float ExplosionForce { get; } = -1;
|
|
|
|
|
|
|
|
internal void Dispose()
|
|
{
|
|
// nothing needed
|
|
}
|
|
|
|
internal CommonData( Model model )
|
|
{
|
|
if ( model.TryGetData<ModelPropData>( 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 );
|
|
}
|
|
|