VRage.Game.ModAPI
IMyCubeGrid
Assembly: VRage.Game.dll
public interface IMyCubeGrid: IMyEntity, IMyEntity, IMyCubeGrid
Declares grid interface. (mods interface) Grid - an entity that consist of IMySlimBlock . Blocks like rotor, piston, hinge, motor suspension, on their creation creates top part, that belongs to another grid. Player created ships, can consist of many grids.
Events
| Member | Description |
|---|---|
| GridPresenceTierChanged | Triggered when grid presence tier is changed |
| OnBlockAdded | Called when a block is added to the grid |
| OnBlockIntegrityChanged | Triggered when block integrity changes (construction) |
| OnBlockOwnershipChanged | Called when a block on the grid changes owner |
| OnBlockRemoved | Called when a block is removed from the grid |
| OnGridBlockDamaged | Called when one of blocks on grid is taking damage |
| OnGridChanged | Called when a grid is taken control of by a player |
| OnGridMerge | Called, when 2 grids are merged with merge block. First grid - grid that will stay, second - will be merged into first, and deleted. Called for both grids |
| OnGridSplit | Triggered when grid is split |
| OnIsStaticChanged | Triggered when grid changes to or from static (station) |
| OnMaxThrustChanged | Triggered when max thrust in one of directions was changed. Maybe called from parralel thread |
| OnNaturalGravityChanged | Triggered when natural gravity changes around the grid |
| OnTargetLocked | Called when grid was target locked |
| PlayerPresenceTierChanged | Triggered when player presence tier is changed |
| SpeedChanged | Triggered when speed of the grid is changed |
| OnClose | Called when Close() is called. Order 1) OnMarkForClose 2) OnClosing 3) OnClose . Inherited from IMyEntity |
| OnClosing | Called when Close() is called. Order 1) OnMarkForClose 2) OnClosing 3) OnClose . Inherited from IMyEntity |
| OnMarkForClose | Called when Close() is called. Order 1) OnMarkForClose 2) OnClosing 3) OnClose . Inherited from IMyEntity |
| OnPhysicsChanged | Called when havok rigid body physics are changed: inited, closed, modified. Inherited from IMyEntity |
Properties
| Member | Description |
|---|---|
| BigOwners | List of players with majority of blocks on grid |
| ControlSystem | Gets grid-group control system |
| ConveyorSystem | Gets grid-group conveyor system |
| CustomName | Display name of the grid (as seen in Info terminal tab) |
| GasSystem | Gets grid-group gas system |
| GridPresenceTier | Gets grid presence tier |
| IsBlockTrasferInProgress | Gets whether the move block transfer from one grid to another is in progress. This happens during the split operation. |
| IsNpcSpawnedGrid | Gets if this grid is NPC spawned grid by the system (cargo ship, encounter, etc) |
| IsRespawnGrid | Gets or sets if this grid is a respawn grid (can be cleaned up automatically when player leaves) |
| IsStatic | Gets or sets if the grid is static (station) |
| JumpSystem | Gets grid-group jump system |
| NaturalGravity | Gets natural gravity around the grid |
| PlayerPresenceTier | Gets player presence tier |
| ResourceDistributor | Gets grid-group resource distributor |
| RvoAgentId | Gets RVO Agent ID used for collision avoidance algorithm |
| SmallOwners | List of players with any blocks on grid |
| WeaponSystem | Gets grid-group weapon system |
| XSymmetryOdd | Gets or sets if the symmetry plane is offset from the block center |
| XSymmetryPlane | Gets or sets X-Axis build symmetry plane |
| YSymmetryOdd | Gets or sets if the symmetry plane is offset from the block center |
| YSymmetryPlane | Gets or sets Y-Axis build symmetry plane |
| ZSymmetryOdd | Gets or sets if the symmetry plane is offset from the block center |
| ZSymmetryPlane | Gets or sets Z-Axis build symmetry plane |
| CastShadows | Gets or sets flag CastShadows Inherited from IMyEntity |
| Closed | True if the block has been removed from the world. Inherited from IMyEntity |
| Components | Gets blocks component logic container Inherited from IMyEntity |
| CustomName | Getter and setter for display name of the grid (as seen in Info terminal tab) Inherited from IMyCubeGrid |
| DebugAsyncLoading | Used for internal usage. Modders should not use it. Will be eventually removed Inherited from IMyEntity |
| DisplayName | Gets user friendly name of entity. May be null For block terminal name use DisplayNameText Inherited from IMyEntity |
| DisplayName | Gets or sets user friendly name of entity Inherited from IMyEntity |
| EntityId | Id of entity Inherited from IMyEntity |
| EntityId | Uniq id of entity. Inherited from IMyEntity |
| FastCastShadowResolve | Gets or sets flag CastShadows Inherited from IMyEntity |
| Flags | Gets or set some behavior of entity. EntityFlags Inherited from IMyEntity |
| GameLogic | Gets or sets game logic for object. If there is more than 1 game logic attached it should be wrapped into. Inherited from IMyEntity |
| GridSize | Getter of grid size in meters Inherited from IMyCubeGrid |
| GridSizeEnum | Getter for grid size enum Inherited from IMyCubeGrid |
| HasInventory | Returns true if this entity has got at least one inventory. Note that one aggregate inventory can contain zero simple inventories => zero will be returned even if GetInventory() != null. Inherited from IMyEntity |
| Hierarchy | Gets or sets Hierarchy component Inherited from IMyEntity |
| InScene | Gets or set if grid is InScene. Objects that are not in scene are not updated and drawn. Inherited from IMyEntity |
| InvalidateOnMove | Gets if entity is invalidated on move When visual look of entity depends on position - then InvalidateOnMove should be true Inherited from IMyEntity |
| InventoryCount | Returns the count of the number of inventories this entity has. Inherited from IMyEntity |
| IsStatic | Determines if the grid is static (unmoveable) Inherited from IMyCubeGrid |
| IsVolumetric | Always returns false Inherited from IMyEntity |
| LinearVelocity | Gets linear velocity of the grid Inherited from IMyCubeGrid |
| LocalAABB | Gets or sets local axis aligned bounding box. Same as LocalAABBHr , LocalAABB Inherited from IMyEntity |
| LocalAABBHr | Gets local axis aligned bounding box. Same as LocalAABB , LocalAABB Inherited from IMyEntity |
| LocalMatrix | Gets or sets local matrix. When entity, has parent, it's world coordinates are calculated from localMatrix and parent world matrix Inherited from IMyEntity |
| LocalVolume | Gets or sets local volume. Same as LocalVolume Inherited from IMyEntity |
| LocalVolumeOffset | Gets or sets local volume offset. Same as LocalVolumeOffset Inherited from IMyEntity |
| MarkedForClose | Checked if Close() was called Inherited from IMyEntity |
| Max | Maximum coordinates of blocks in grid Inherited from IMyCubeGrid |
| MaxGlassDistSq | Not used in game anymore Inherited from IMyEntity |
| Min | Minimum coordinates of blocks in grid Inherited from IMyCubeGrid |
| Model | Gets model of block Inherited from IMyEntity |
| ModelCollision | Gets collision model of block Inherited from IMyEntity |
| Name | Some entities can have uniq name, and game can find them by name TryGetEntityByName(string, out IMyEntity) Inherited from IMyEntity |
| Name | Uniq name of entity. Can be used to find entity by name Inherited from IMyEntity |
| NearFlag | Gets or sets flag Near Inherited from IMyEntity |
| NeedsDraw | Gets or sets flag NeedsDraw Inherited from IMyEntity |
| NeedsDrawFromParent | Gets or sets flag NeedsDrawFromParent Inherited from IMyEntity |
| NeedsResolveCastShadow | Gets or sets flag NeedsResolveCastShadow Inherited from IMyEntity |
| NeedsUpdate | Gets or sets how often the entity should be updated. Inherited from IMyEntity |
| NeedsWorldMatrix | Gets or sets if WorldMatrix should be calculated when parent WorldMatrix is changed. Inherited from IMyEntity |
| Parent | Gets parent of entity or null, if this entity doesn't have parent. Ex: character sitting in cockpit, has parent - cockpit, cockpit has parent - cube grid, connected grids also has main grid, which would be parent for other grids. Inherited from IMyEntity |
| PersistentFlags | Gets or sets persistent flags that are used in rendering. Inherited from IMyEntity |
| Physics | Gets or sets physics for object Inherited from IMyEntity |
| PositionComp | Gets or sets position provider logic Inherited from IMyEntity |
| Render | Gets or sets render logic Inherited from IMyEntity |
| Save | Gets or sets Save . Entity won't be saved if Save is false Inherited from IMyEntity |
| ShadowBoxLod | Gets or sets flag ShadowBoxLod Inherited from IMyEntity |
| SkipIfTooSmall | Gets or sets flag SkipIfTooSmall Inherited from IMyEntity |
| Speed | Gets speed of the grid calculated from Linear Velocity. Rounded to two decimal places. Inherited from IMyCubeGrid |
| StopPhysicsActivation | Inherited from IMyEntity |
| Storage | Custom storage for mods. Shared with all mods. Inherited from IMyEntity |
| Synchronized | Gets or sets if the entity should be synced. Inherited from IMyEntity |
| SyncObject | Gets SyncObject used for synchronizing data over network with Inherited from IMyEntity |
| Transparent | Gets or sets Transparency . When setting true entity would be 25% transparent Inherited from IMyEntity |
| Visible | Gets or sets flag Visible Inherited from IMyEntity |
| WorldAABB | Gets world axis-aligned bounding box Inherited from IMyEntity |
| WorldAABBHr | Gets world axis-aligned bounding box Inherited from IMyEntity |
| WorldMatrix | Gets world matrix of this entity Inherited from IMyEntity |
| WorldMatrix | Gets or sets world matrix. Inherited from IMyEntity |
| WorldMatrixInvScaled | Get scaled, inverted world matrix. Same as GetViewMatrix() , GetWorldMatrixNormalizedInv() , WorldMatrixNormalizedInv , but not normalized Inherited from IMyEntity |
| WorldMatrixNormalizedInv | Get normalized, inverted world matrix. Same as GetViewMatrix() , WorldMatrixNormalizedInv Inherited from IMyEntity |
| WorldVolume | Gets bounding sphere of this entity Inherited from IMyEntity |
| WorldVolumeHr | Gets bounding sphere of this entity Inherited from IMyEntity |
| IsCCDForProjectiles | Obsolete Inherited from IMyEntity |
| LocationForHudMarker | Obsolete Inherited from IMyEntity |
Methods
| Member | Description |
|---|---|
| AddBlock(MyObjectBuilder_CubeBlock, bool) | Add a cubeblock to the grid |
| ApplyDeformation(float, float, float, Vector3, Vector3, MyStringHash, out int, float, float, long) | |
| ApplyDestructionDeformation(IMySlimBlock) | Applies random deformation to given block |
| CalculateMergeTransform(IMyCubeGrid, Vector3I) | Transformation matrix that has to be applied to grid blocks to correctly merge it used because ie. ships can be turned 90 degrees along X axis when being merged |
| CanAddCube(Vector3I) | Tests if a cubeblock can be added at the specific location |
| CanAddCubes(Vector3I, Vector3I) | Test if the range of positions are not occupied by any blocks |
| CanMergeCubes(IMyCubeGrid, Vector3I) | Determines if merge between grids is possible with given offset |
| ChangeGridOwnership(long, MyOwnershipShareModeEnum) | Changes owner of all blocks on grid Call only on server! |
| ClearSymmetries() | Clears symmetry planes |
| ColorBlocks(Vector3I, Vector3I, Vector3) | Sets given color mask to range of blocks |
| FixTargetCube(out Vector3I, Vector3) | Clamps fractional grid position to nearest cell (prefers neighboring occupied cell before empty) |
| GetBlocks(List |
Returns blocks in grid |
| GetBlocksInsideSphere(ref BoundingSphereD) | Returns blocks intersects with given sphere (world space) |
| GetClosestCorner(Vector3I, Vector3) | Gets position of closest cell corner |
| GetCubeBlock(Vector3I) | Get cube block at given position |
| GetFatBlocks |
|
| GetGridGroup(GridLinkTypeEnum) | Gets grid group of grids connected by provided link type |
| GetLineIntersectionExactAll(ref LineD, out double, out IMySlimBlock) | Returns point of intersection with line |
| GetLineIntersectionExactGrid(ref LineD, ref Vector3I, ref double) | Same as GetLineIntersectionExactAll just without intersected block |
| GetMaxThrustInDirection(Direction) | |
| InvokeDepressurizeEffect(Vector3I, Vector3I) | Invokes de-pressurize effect on clients |
| IsInSameLogicalGroupAs(IMyCubeGrid) | Determines whether this grid is in the same logical group as the other, meaning they're connected either mechanically or via blocks like connectors. Be aware that using merge blocks combines grids into one, so this function will not filter out grids connected that way. |
| IsRoomAtPositionAirtight(Vector3I) | Is room at specified position airtight |
| IsSameConstructAs(IMyCubeGrid) | Determines whether this grid is mechanically connected to the other. This is any grid connected with rotors or pistons or other mechanical devices, but not things like connectors. This will in most cases constitute your complete construct. Be aware that using merge blocks combines grids into one, so this function will not filter out grids connected that way. Also be aware that detaching the heads of pistons and rotors will cause this connection to change. |
| IsTouchingAnyNeighbor(Vector3I, Vector3I) | Finds out if given area has any neighboring block Checking only cube sides. Example: for vectors Min (0,0,0) and Max (10,10,10), Space (1,1,1)-(9,9,9) won't be checked |
| MergeGrid_MergeBlock(IMyCubeGrid, Vector3I) | Merge used by merge blocks |
| RayCastBlocks(Vector3D, Vector3D) | Obtains first block position intersected with line. |
| RayCastCells(Vector3D, Vector3D, List |
Obtains positions of grid cellsof whether these cells are taken up by blocks or not. |
| RazeBlock(Vector3I) | Remove block at given position |
| RazeBlocks(ref Vector3I, ref Vector3UByte) | Remove blocks in given area |
| RazeBlocks(List |
Remove blocks at given positions |
| RemoveBlock(IMySlimBlock, bool) | Removes given block |
| RemoveDestroyedBlock(IMySlimBlock) | Removes block and deformates neighboring blocks |
| SkinBlocks(Vector3I, Vector3I, Vector3?, string) | Sets given skin to range of blocks |
| Split(List |
Split grid |
| SplitByPlane(PlaneD) | Split grid along a plane |
| UpdateBlockNeighbours(IMySlimBlock) | Refreshes block neighbors (checks connections) |
| UpdateOwnership(long, bool) | Called when functional block lost or gained owner. Triggers, grid ownership recalculation |
| WillRemoveBlockSplitGrid(IMySlimBlock) | Checks if removing a block will cause the grid to split |
| BeforeSave() | Called before method GetObjectBuilder, when saving sector Inherited from IMyEntity |
| Close() | This method marks this entity for close which means, that Close will be called after all entities are updated Inherited from IMyEntity |
| CubeExists(Vector3I) | Returns true if there is any block occupying given position Inherited from IMyCubeGrid |
| DebugDraw() | Calls debug draw of entity Inherited from IMyEntity |
| DebugDrawInvalidTriangles() | Calls special debug draw, that highlighting invalid triangles in model Inherited from IMyEntity |
| Delete() | Performs real cleaning of entity. Should be called by game. Modders should prefer Close() method. Inherited from IMyEntity |
| DoOverlapSphereTest(float, Vector3D) | Checks if intersects Works only with IMyVoxelBase Inherited from IMyEntity |
| EnableColorMaskForSubparts(bool) | Allows subparts have different color than their parent Inherited from IMyEntity |
| GetChildren(List |
Gets children of entity. Child - entity, who's Parent is this entity Inherited from IMyEntity |
| GetCubeBlock(Vector3I) | Get cube block at given position Inherited from IMyCubeGrid |
| GetDiffuseColor() | Gets render diffuse color Inherited from IMyEntity |
| GetDistanceBetweenCameraAndBoundingSphere() | Distance from camera to bounding sphere of this phys object. Result is always positive, even if camera is inside the sphere. (in meters) Inherited from IMyEntity |
| GetDistanceBetweenCameraAndPosition() | Distance from camera to position of entity. Inherited from IMyEntity |
| GetFriendlyName() | Not used. Actually not a friendly name Inherited from IMyEntity |
| GetIntersectionWithAABB(ref BoundingBoxD) | Return true if object intersects specified bounding box. Inherited from IMyEntity |
| GetIntersectionWithLine(ref LineD, out MyIntersectionResultLineTriangleEx?, IntersectionFlags) | Get intersection of model with provided line Inherited from IMyEntity |
| GetIntersectionWithLineAndBoundingSphere(ref LineD, float) | Calculates intersection of line with any bounding sphere in this model instance. Center of the bounding sphere will be returned. It takes boundingSphereRadiusMultiplier argument which serves for extending the influence (radius) for interaction with line. Inherited from IMyEntity |
| GetIntersectionWithSphere(ref BoundingSphereD) | Return true if object intersects specified sphere. Inherited from IMyEntity |
| GetInventory() | Simply get the MyInventoryBase component stored in this entity. Inherited from IMyEntity |
| GetInventory(int) | Search for inventory component with maching index. Inherited from IMyEntity |
| GetInventory() | Simply get the MyInventoryBase component stored in this entity. Inherited from IMyEntity |
| GetInventory(int) | Search for inventory component with matching index. Inherited from IMyEntity |
| GetLargestDistanceBetweenCameraAndBoundingSphere() | Largest distance from camera to bounding sphere of this phys object. Result is always positive, even if camera is inside the sphere. It's actually distance between camera and opposite side of the sphere Inherited from IMyEntity |
| GetObjectBuilder(bool) | Returns object builder - object representing block state, and allows restore it. Used in game save, or syncing over network. Inherited from IMyEntity |
| GetPosition() | Gets position in world coordinates Inherited from IMyEntity |
| GetSmallestDistanceBetweenCameraAndBoundingSphere() | Smallest distance between camera and bounding sphere of this phys object. Result is always positive, even if camera is inside the sphere. Inherited from IMyEntity |
| GetSubpart(string) | Gets subpart by subpart name Inherited from IMyEntity |
| GetTopMostParent(Type) | Gets top most Parent of specified type. Top most is entity that doesn't have parent (of specified type) Inherited from IMyEntity |
| GetTrianglesIntersectingSphere(ref BoundingSphere, Vector3?, float?, List<MyTriangle_Vertex_Normals>, int) | Return list of triangles intersecting specified sphere. Angle between every triangleVertexes normal vector and 'referenceNormalVector' is calculated, and if more than 'maxAngle', we ignore such triangleVertexes. Triangles are returned in 'retTriangles', and this list must be preallocated! IMPORTANT: Sphere must be in model space, so don't transform it! Inherited from IMyEntity |
| GetViewMatrix() | Get normalized, inverted world matrix. Same as GetWorldMatrixNormalizedInv() , WorldMatrixNormalizedInv Inherited from IMyEntity |
| GetWorldMatrixNormalizedInv() | Get normalized, inverted world matrix. Same as GetViewMatrix() , WorldMatrixNormalizedInv Inherited from IMyEntity |
| GridIntegerToWorld(Vector3I) | Converts grid coordinates to world space Inherited from IMyCubeGrid |
| IsSameConstructAs(IMyCubeGrid) | Determines whether this grid is Mechanical connected to the other. This is any grid connected with rotors or pistons or other mechanical devices, but not things like connectors. This will in most cases constitute your complete construct. Be aware that using merge blocks combines grids into one, so this function will not filter out grids connected that way. Also be aware that detaching the heads of pistons and rotors will cause this connection to change. Inherited from IMyCubeGrid |
| IsVisible() | Gets or result of function IsVisible() . Function inside check for IsVisible(IMyEntity) Inherited from IMyEntity |
| OnAddedToScene(object) | Adds entity to scene: init updates, render physics Inherited from IMyEntity |
| OnRemovedFromScene(object) | Remove entity and it's children from scene: stops updates and render, deactivates physics. Usually called when entity deleted Inherited from IMyEntity |
| SetColorMaskForSubparts(Vector3) | Sets subparts custom col Inherited from IMyEntity |
| SetEmissiveParts(string, Color, float) | Sets the emissive value of a specific emissive material on entity. Inherited from IMyEntity |
| SetEmissivePartsForSubparts(string, Color, float) | Sets the emissive value of a specific emissive material on all entity subparts. Inherited from IMyEntity |
| SetLocalMatrix(Matrix, object) | Sets local matrix. When entity, has parent, it's world coordinates are calculated from localMatrix and parent world matrix Inherited from IMyEntity |
| SetPosition(Vector3D) | Set WorldMatrix's Translation . Moves entity. Inherited from IMyEntity |
| SetTextureChangesForSubparts(Dictionary<MyStringId, MyTextureChange>) | Sets subparts custom skinning. Copy values from TextureChanges , then change needed keys. You can retrieve values for exact skin with following code:csharp<br />MyDefinitionManager.Static.GetAssetModifierDefinitionForRender(skinId);<br /><br />Inherited from IMyEntity |
| SetWorldMatrix(MatrixD, object) | Sets world matrix of entity. Inherited from IMyEntity |
| Teleport(MatrixD, object, bool) | When moving entity over large distances or when entity has children, using this method preferred over SetPosition(Vector3D) Inherited from IMyEntity |
| TryGetSubpart(string, out MyEntitySubpart) | Gets subpart by subpart name Inherited from IMyEntity |
| UpdateGamePruningStructure() | Update position of entity in MyGamePruningStructure. Calls:csharp<br />MyGamePruningStructure.Move(this)<br /><br />Inherited from IMyEntity |
| WorldToGridInteger(Vector3D) | Converts world coordinates to grid space cell coordinates Inherited from IMyCubeGrid |
| OnConvertToDynamic() | Obsolete: Use IMyCubeGrid.Static instead. Converts station to ship |
| AddToGamePruningStructure() | Obsolete: Only used during Sandbox removal. Inherited from IMyEntity |
| RemoveFromGamePruningStructure() | Obsolete: Only used during Sandbox removal. Inherited from IMyEntity |
| SetTextureChangesForSubparts(Dictionary<string, MyTextureChange>) | Obsolete This calling is obsolete, use another version. Inherited from IMyEntity |
Implements:
Inheritors: