Nebula
Loading...
Searching...
No Matches
Nebula.Game.World Class Reference

Detailed Description

Worlds hold entities.

<remark> Note that the managed side of Nebula Worlds (C# worlds) is basically a mirror of the native side, which has authority. </remark>

Public Member Functions

bool IsSimulating ()
 Whether this world is simulating.
Entity CreateEntity ()
Entity GetEntity (UInt64 id)
 Get an entity by id, or null if it doesn't exist.
void RefreshMode ()
 Reads the mode from the native world and runs the activation pass when it changed.
void DeregisterEntity (Entity entity)
void CollectGarbage ()
 Removes entities that no longer exist in the native world.
void Clear ()
 Drops the world on the managed side.

Static Public Member Functions

static bool HasWorld (uint id)
 Check if a world id exists in the native game server.
static World Get (uint id)
 Get a world by its native world id.

Static Public Attributes

static readonly uint DEFAULT_WORLD = Api.GetDefaultWorldId()

Package Functions

Entity RegisterEntityFromNative (UInt64 id)
 Add an entity reported by the native entity callback.
List< Entity > GetEntities ()
void ClearProperties ()

Static Package Functions

static IReadOnlyCollection< World > AllWorlds ()
 The worlds the managed runtime has seen.
static void ClearAllProperties ()
 Detaches properties from every world the managed runtime knows about.

Properties

uint Id [get]
IReadOnlyList< Entity > Entities [get]
 The entities in the world.

Private Member Functions

void RegisterEntity (Entity entity)
 World (uint id)

Static Private Member Functions

static World ()

Private Attributes

readonly uint id
readonly List< Entity > entities
readonly Dictionary< UInt64, Entity > entityMap
bool lastSimulating

Static Private Attributes

static readonly Dictionary< uint, World > worlds = []

Constructor & Destructor Documentation

◆ World() [1/2]

Nebula.Game.World.World ( )
inlinestaticprivate

◆ World() [2/2]

Nebula.Game.World.World ( uint id)
inlineprivate

Member Function Documentation

◆ AllWorlds()

IReadOnlyCollection< World > Nebula.Game.World.AllWorlds ( )
inlinestaticpackage

The worlds the managed runtime has seen.

A native world the plugin has not looked at is not in here, and cannot hold a managed property.

◆ Clear()

void Nebula.Game.World.Clear ( )
inline

Drops the world on the managed side.

Called when the native world is destroyed

◆ ClearAllProperties()

void Nebula.Game.World.ClearAllProperties ( )
inlinestaticpackage

Detaches properties from every world the managed runtime knows about.

A property can only be attached from C#, so the worlds the runtime has seen are the only ones that can hold one.

◆ ClearProperties()

void Nebula.Game.World.ClearProperties ( )
inlinepackage

◆ CollectGarbage()

void Nebula.Game.World.CollectGarbage ( )
inline

Removes entities that no longer exist in the native world.

◆ CreateEntity()

Entity Nebula.Game.World.CreateEntity ( )
inline

◆ DeregisterEntity()

void Nebula.Game.World.DeregisterEntity ( Entity entity)
inline

◆ Get()

World Nebula.Game.World.Get ( uint id)
inlinestatic

Get a world by its native world id.

Returns null if the world does not exist.

◆ GetEntities()

List< Entity > Nebula.Game.World.GetEntities ( )
inlinepackage

◆ GetEntity()

Entity Nebula.Game.World.GetEntity ( UInt64 id)
inline

Get an entity by id, or null if it doesn't exist.

<remark> Entities created in native code become available once the entity queue has been flushed at the beginning of the frame, so an entity created during the frame is not in the mirror until the next one. </remark>

◆ HasWorld()

bool Nebula.Game.World.HasWorld ( uint id)
inlinestatic

Check if a world id exists in the native game server.

◆ IsSimulating()

bool Nebula.Game.World.IsSimulating ( )
inline

Whether this world is simulating.

◆ RefreshMode()

void Nebula.Game.World.RefreshMode ( )
inline

Reads the mode from the native world and runs the activation pass when it changed.

This is where a property is activated when its world starts simulating and deactivated when it stops, because a property that was asked to be active only actually runs in a simulating world.

◆ RegisterEntity()

void Nebula.Game.World.RegisterEntity ( Entity entity)
inlineprivate

◆ RegisterEntityFromNative()

Entity Nebula.Game.World.RegisterEntityFromNative ( UInt64 id)
inlinepackage

Add an entity reported by the native entity callback.

Entities that are already mirrored are skipped, which is what keeps entities created from C# from being added twice.

Member Data Documentation

◆ DEFAULT_WORLD

readonly uint Nebula.Game.World.DEFAULT_WORLD = Api.GetDefaultWorldId()
static

◆ entities

readonly List<Entity> Nebula.Game.World.entities
private

◆ entityMap

readonly Dictionary<UInt64, Entity> Nebula.Game.World.entityMap
private

◆ id

readonly uint Nebula.Game.World.id
private

◆ lastSimulating

bool Nebula.Game.World.lastSimulating
private

◆ worlds

readonly Dictionary<uint, World> Nebula.Game.World.worlds = []
staticprivate

Property Documentation

◆ Entities

IReadOnlyList<Entity> Nebula.Game.World.Entities
get

The entities in the world.

◆ Id

uint Nebula.Game.World.Id
get

The documentation for this class was generated from the following file:
  • /github/workspace/code/addons/nsharp/NebulaEngine/engine/World.cs