Skip to content

Commit

Permalink
Merge pull request #235 from iv4xr-project/grid-fixes
Browse files Browse the repository at this point in the history
Grid fixes
  • Loading branch information
hovi authored Dec 3, 2022
2 parents a786e2d + f66d78c commit b6975b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ interface BlocksAdmin {
fun placeAt(
blockDefinitionId: DefinitionId,
position: Vec3F,
orientationForward: Vec3F,
orientationUp: Vec3F,
orientationForward: Vec3F= Vec3F.FORWARD,
orientationUp: Vec3F = Vec3F.UP,
color: Vec3F? = null,
): CubeGrid

fun placeInGrid(
blockDefinitionId: DefinitionId,
gridId: String,
minPosition: Vec3I,
orientationForward: Vec3I,
orientationUp: Vec3I,
orientationForward: Vec3I = Vec3I.FORWARD,
orientationUp: Vec3I = Vec3I.UP,
color: Vec3F? = null,
): String

Expand Down
7 changes: 2 additions & 5 deletions Source/Ivxr.SePlugin/Control/BlockPlacer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ public class BlockPlacer
private MyObjectBuilder_CubeBlock CubeBlockBuilderByBlockType(long ownerId, DefinitionId blockDefinitionId,
Vector3 colorMask)
{
var definitionBase = MyDefinitionManager.Static
.GetAllDefinitions()
.First(definition => definition.ToDefinitionId().Type == blockDefinitionId.Type);

var obj = (MyObjectBuilder_CubeBlock)MyObjectBuilderSerializer.CreateNewObject(definitionBase.Id);

var obj = (MyObjectBuilder_CubeBlock)MyObjectBuilderSerializer.CreateNewObject(blockDefinitionId.ToMyDefinitionId());
obj.Min = new SerializableVector3I(0, 0, 0);
obj.SubtypeName = blockDefinitionId.Type;
obj.BlockOrientation = new SerializableBlockOrientation(Base6Directions.Direction.Forward,
Expand Down
8 changes: 1 addition & 7 deletions Source/Ivxr.SePlugin/Control/LowLevelObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,7 @@ public MyCubeGrid GetGridById(string gridId)

public CubeGrid GetCubeGridById(string gridId)
{
var grid = GetGridById(gridId);
return new CubeGrid()
{
Mass = grid.Mass,
Parked = grid.IsParked,
Blocks = grid.CubeBlocks.Select(EntityBuilder.CreateGridBlock).ToList(),
};
return EntityBuilder.CreateSeGrid(GetGridById(gridId));
}

public Block GetBlockDtoById(string blockId)
Expand Down

0 comments on commit b6975b3

Please sign in to comment.