mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-02 11:28:19 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
37 lines
716 B
C#
37 lines
716 B
C#
namespace Sandbox;
|
|
|
|
public partial class Component
|
|
{
|
|
private Guid _id = Guid.NewGuid();
|
|
public Guid Id
|
|
{
|
|
get => _id;
|
|
private set
|
|
{
|
|
if ( _id == value ) return;
|
|
|
|
var oldId = _id;
|
|
_id = value;
|
|
|
|
Scene?.Directory?.Add( this, oldId );
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Should only be called by <see cref="GameObjectDirectory.Add( Component )"/>.
|
|
/// </summary>
|
|
internal void ForceChangeId( Guid guid )
|
|
{
|
|
_id = guid;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Allows overriding the ID of this object. This should be used sparingly, and only when necessary.
|
|
/// This is generally used for network reasons, to make something deterministic.
|
|
/// </summary>
|
|
internal void SetDeterministicId( Guid id )
|
|
{
|
|
Id = id;
|
|
}
|
|
}
|