Assembly: VRage.Game.dll

public interface IMyEntities

Provides API, that granting access to enitities (mods interface)

Events

Member Description
OnCloseAll Called when session unloads, before grids are closed
OnEntityAdd Called when AddEntity(IMyEntity, bool) called on entity
OnEntityNameSet Called when entity gets Name . First string - old name, Second - new name
OnEntityRemove Called when RemoveEntity(IMyEntity) called on entity

Methods

Member Description
AddEntity(IMyEntity, bool) Registers entity
CreateFromObjectBuilder(MyObjectBuilder_EntityBase) Create entity from object builder
CreateFromObjectBuilderAndAdd(MyObjectBuilder_EntityBase) Create entity from object builder, and then call AddEntity(IMyEntity, bool)
CreateFromObjectBuilderNoinit(MyObjectBuilder_EntityBase) Create new entity from objectBuilder, but doesn't call
CreateFromObjectBuilderParallel(MyObjectBuilder_EntityBase, bool, Action) Creates and asynchronously initializes and entity.
EnableEntityBoundingBoxDraw(IMyEntity, bool, Vector4?, float, Vector3?) Draw bounding box around entity
EntityExists(string) Returns if entity with provided name exists
EntityExists(long) Returns if entity with provided name exists
EntityExists(long?) Returns if entity with provided name exists
Exist(IMyEntity) Checks if entity is registered entity
FindFreePlace(Vector3D, float, int, int, float) Use to find place that doesn't have any voxels, grids, or physical bodies. If original position can't fill check sphere, new position in some distance is picked. Distance grows each testsPerDistance attempts. Maximum distance from BasePos that can be used is calculated by formula: maxTestCount / testsPerDistance * radius * stepSize
GetElementsInBox(ref BoundingBoxD) Returns list of entities that intersects with BoundingBox. This function will return CubeBlocks. This function works slower than GetTopMostEntitiesInBox(ref BoundingBoxD)
GetEntities(HashSet, Func<IMyEntity, bool>) Get all entities matching condition
GetEntitiesInAABB(ref BoundingBoxD) Returns list of entities that intersects with BoundingBox. This function will return CubeBlocks. This function works slower than GetTopMostEntitiesInBox(ref BoundingBoxD)
GetEntitiesInSphere(ref BoundingSphereD) Returns list of entities that intersects with sphere. This function will return CubeBlocks. This function works slower than GetTopMostEntitiesInSphere(ref BoundingSphereD)
GetEntity(Func<IMyEntity, bool>) Get first entity that matching condition
GetEntityById(long) Returns entity with provided entityId
GetEntityById(long?) Returns entity with provided entityId
GetEntityByName(string) Returns entity with provided name
GetInflatedPlayerBoundingBox(ref BoundingBoxD, float) Making playerBox include all connected players
GetIntersectionWithSphere(ref BoundingSphereD) Returns first found (not closest) entity that intersects with sphere
GetIntersectionWithSphere(ref BoundingSphereD, IMyEntity, IMyEntity) Returns first found (not closest) entity that intersects with sphere
GetIntersectionWithSphere(ref BoundingSphereD, IMyEntity, IMyEntity, bool, bool, bool, bool, bool) Returns first found (not closest) entity that intersects with sphere
GetIntersectionWithSphere(ref BoundingSphereD, IMyEntity, IMyEntity, bool, bool) Returns list of entities that intersects with sphere
GetTopMostEntitiesInBox(ref BoundingBoxD) Returns list of TopMost entities that intersects with bounding box. This function won't return CubeBlocks. Use GetElementsInBox(ref BoundingBoxD) to retrieve CubeBlocks also.
GetTopMostEntitiesInSphere(ref BoundingSphereD) Returns list of TopMost entities that intersects with sphere. This function won't return CubeBlocks. Use GetEntitiesInSphere(ref BoundingSphereD) to retrieve CubeBlocks also.
IsInsideVoxel(Vector3D, Vector3D, out Vector3D) Return true if line between pos and hintPosition doesn't intersect any voxel, or intersects it even number of times Does inside physical ray casting inside
IsInsideWorld(Vector3D) Returns true if distance from 0,0,0 to provided position is less than WorldHalfExtent()
IsNameExists(IMyEntity, string) Checks if registered name belongs to this entity
IsRaycastBlocked(Vector3D, Vector3D) Returns true if raycast hits anything (with raycast layer=0)
IsSpherePenetrating(ref BoundingSphereD) Checks if sphere hits any HkRigidBodyprohibited
IsTypeHidden(Type) Gets whether entities that inherit type is visible or not. Example:csharp<br />IsTypeHidden(typeof (IMyCubeGrid))<br /><br />
IsVisible(IMyEntity) Gets whether entity is visible or not because of SetTypeHidden(Type, bool)
IsWorldLimited() Return whether world has limited size in kilometers
MarkForClose(IMyEntity) Mark entity as closed. Soon it would be deleted. Doesn't call Close()
RegisterForDraw(IMyEntity) Make entity receive PrepareForDraw and sending to it's Render Draw call
RegisterForUpdate(IMyEntity) Make entity receive UpdateBeforeSimulation, UpdateBefore10Simulation, UpdateBefore100Simulation, UpdateAfterSimulation, UpdateAfter10Simulation, UpdateAfter100Simulation, Simulate, UpdateBeforeNextFrame depending on it's NeedsUpdate flags. Physics are still simulated
RemapObjectBuilder(MyObjectBuilder_EntityBase) Remaps this entity's EntityId and Name to a new values.
RemapObjectBuilderCollection(IEnumerable<MyObjectBuilder_EntityBase>) Remaps this entity's EntityId and Name to a new values.
RemoveEntity(IMyEntity) Unregisters entity
RemoveFromClosedEntities(IMyEntity) Remove entity from lists of closed entities
RemoveName(IMyEntity) Removes registered name from entity.
SetEntityName(IMyEntity, bool) Apply Name for entity
SetTypeHidden(Type, bool) Entities that inherit that type would be visible/invisible.
TryGetEntityById(long, out IMyEntity) Returns entity with provided id
TryGetEntityById(long?, out IMyEntity) Returns entity with provided id
TryGetEntityByName(string, out IMyEntity) Returns entity with provided name
UnhideAllTypes() Revert all changes to default. Make all entities visible, that were hidden because of SetTypeHidden(Type, bool)
UnregisterForDraw(IMyEntity) Unregistering entity from PrepareForDraw events and it Render from Draw calls. Entity may still be rendered
UnregisterForUpdate(IMyEntity, bool) Unregistering entity from following updates: UpdateBeforeSimulation, UpdateBefore10Simulation, UpdateBefore100Simulation, UpdateAfterSimulation, UpdateAfter10Simulation, UpdateAfter100Simulation, Simulate, UpdateBeforeNextFrame Physics are still simulated
WorldHalfExtent() Returns shortest distance (i.e. axis-aligned) to the world border from the world center. Will be 0 if world is borderless
WorldSafeHalfExtent() Returns shortest distance (i.e. axis-aligned) to the world border from the world center, minus 600m to make spawning somewhat safer. Will be 0 if world is borderless
GetInflatedPlayerBoundingBox(ref BoundingBox, float) Obsolete
IsInsideVoxel(Vector3, Vector3, out Vector3) Obsolete

Inheritors: