This object is in archive! 

IMyShipMergeBlock.IsConnected

Michael Quinn shared this bug 3 years ago
Solved

I see that this issue has been reported before, but just wanted to reup it. IMyShipMergeBlock.IsConnected does not work as intended, and returns true when it shouldn't. Please add Enum MergeStatus similar to Enum DoorStatus, Enum ConnectorStatus, etc. and a Status function for IMyShipMergeBlock. Thanks.

Replies (7)

photo
1

Hello, Michael,

thanks for sharing this issue with us. Is it shill happening to you? Can you reproduce it it the game as well, does it show anywhere it the game, meaning something is not working as it should - some action, production, building... ?

I would need more info about how did you get to know this. Is there any way how to prove it in game as well, or did you red it out of the code itself? I would need some more info how to reproduce it, rather than mere info that it is broken.

Can you please elaborate more on this issue? It would be great help :)

Kind Regards

Keen Software House: QA Department

photo
1

Hello Engineer,

Since there are no new comments in this topic and we are still not able to reproduce it, we are closing this thread as outdated.

In case anyone is encountering the same or similar bug, which is not already posted in a different thread, please feel free to create a new thread with all relevant information.

Thank you.

Kind Regards

Keen Software House: QA Department

photo
1

Hello :)

Hello, I came to see if this problem could finally be resolved. I see that no :'( .

To reproduce (a very simple mini script):

public void Main(string argument, UpdateType updateSource)
{
    Runtime.UpdateFrequency = UpdateFrequency.Update1;
    var Piston = new List<IMyPistonBase>();
    var MergeBlock = new List<IMyShipMergeBlock>();
    float velocity = 1;
    GridTerminalSystem.GetBlocksOfType(Piston);
    GridTerminalSystem.GetBlocksOfType(MergeBlock);
    if (MergeBlock.Any(item => item.IsConnected))
        velocity = 0;

    foreach (var item in Piston)
    {
        item.Velocity = velocity;
    }
}
The piston stop when "connecting" et no when "connected"


a0cf1e0d9d8bb98c619a569a6ec6dfdb


Old reports :

https://support.keenswh.com/spaceengineers/pc/topic/merge-block-isconnected-in-programmable-block-returns-true-on-yellow-state

https://support.keenswh.com/spaceengineers/pc/topic/merge-block-incorrectly-reports-itself-as-connected-when-its-touching-another-merge-block

photo
1

I forgot, my solution (which I hope is temporary):

public static class BugContournement
    {
        public static IMyGridTerminalSystem thisGridTerminalSystem;
        //find on "https://forum.keenswh.com/threads/1-176-002-dev-imyshipmergeblock-isconnected.7393234/" many thanks to I2317 (https://forum.keenswh.com/members/i23i7.3974816/)
        //and optimised by me (Polack77)
        public static bool IsMbConnected(IMyShipMergeBlock SourceMB, bool SafeMode = true)
        {
            //No powered or no "IsConnected" (= connecting or connected)
            if (!SourceMB.Enabled || !SourceMB.IsConnected)
                return false;

            Quaternion aQuaternion;
            Vector3I TargetMbLoc;
            System.Collections.Generic.List<IMyShipMergeBlock> TargetMBs = new List<IMyShipMergeBlock>(1);
            //Find target location
            SourceMB.Orientation.GetQuaternion(out aQuaternion);
            TargetMbLoc = SourceMB.Position + Vector3I.Transform(new Vector3I(1, 0, 0), aQuaternion);
            IMyCubeGrid CubeGrid = SourceMB.CubeGrid;
            //Find TargetMB will only be found if "IsConnected" and on target position
            thisGridTerminalSystem.GetBlocksOfType<IMyShipMergeBlock>(TargetMBs, x => (x.IsConnected && x.Enabled && (x.Position == TargetMbLoc) && (x.CubeGrid == CubeGrid)));
            //No target find
            if (!TargetMBs.Any())
                return false;

            if (SafeMode)
            {
                //We have a powered MB at source merge location
                //Find target's merge location
                TargetMBs[0].Orientation.GetQuaternion(out aQuaternion);
                TargetMbLoc = TargetMBs[0].Position + Vector3I.Transform(new Vector3I(1, 0, 0), aQuaternion);
                //Check that targets merge location is source's location
                if (TargetMbLoc != SourceMB.Position)
                    return false;
            }
            return true;
        }
    }

photo
2

Hello, Polack77,

thanks for coming back. Eventually :)

Even though this thread was already closed, with the information you provided it was really easy to reproduce the issue you are experiencing. It is now listed in our internal system.

Kind Regards

Keen Software House: QA Department

photo
1

Hello, Engineers!

I´m happy to announce you that this issue is already fixed and will be introduced to the game in upcoming major update.

Kind Regards

Keen Software House: QA Department

photo
1

Hello, Engineers!

I´m happy to inform you that this issue will be fixed in upcoming game update v200.

Kind Regards

Keen Software House: QA Department

Replies have been locked on this page!