Programmable block: IMyLaserAntenna API completely broken

FatalError420 shared this bug 18 months ago
Solved

It's come to my attention while attempting to make a script that the API for laser antennas are broken and potentially incomplete.

I found that I could only set target twice before the laser antenna basically just refused to accept the changes (I checked this using the. TargetCoords property, as well as checking the input string).

On top of this, there's several key shortcomings in the API, you cannot set the status to idle, or otherwise disconnect. You also need to transform your world coordinate vector into the GPS data string format to set the target in the first place. This makes little sense as the laser antenna block just needs to parse it back into a Vector3D.

I want to note, that all of these bugs have wasted 3 days of my free time as I've been trying to get my script to work, thinking that I was going insane and my script was simply bugged beyond belief.

Please fix T_T

Replies (3)

photo
1

Hello, FatalError420,


I am sorry you are experiencing this issue. Can you please share the script you are writing with me so I can have a look at the code?


Thank you in advance.


Kind regards,

Keen Software House: QA Department

photo
1

Hi, I actually made a test case script for this where an antenna alternates between three positions. While it has no problems with alternating between 3 empty positions, you'll see that it completely breaks down when attempting to alternate between three positions containing antennas.

You will see comments where I tried to make numerous changes to attempt to correct it's behavior; I spent several hours trying to get it to work.

It seems to revert back to previously established connections after receiving new coordinates. (sorry the code looks so bad)

You'll have to enter your own GPSs to test this (of course), I also took a video of the behavior (as I was communicating with other scripters on discord trying to debug)


namespace IngameScript
{
    partial class Program : MyGridProgram
    {
        public string[] gps_list = { "GPS:LAT1:33.75:-1.07:60:", "GPS:LAT2:33.75:-1.07:65:", "GPS:LAT3:33.75:-1.07:70:" };
        public Vector3D[] vec_list = {new Vector3D(33.75, -1.07, 60), new Vector3D(33.75, -1.07, 65), new Vector3D(33.75, -1.07, 70)};
        public int timer = 0;
        public int selected = 0;
        public Vector3D last_target = new Vector3D(0,0,0);
        public IMyLaserAntenna antenna;
        public Program()
        {
            Runtime.UpdateFrequency = UpdateFrequency.Update1;
            antenna = GridTerminalSystem.GetBlockWithName("Designated Testing Antenna") as IMyLaserAntenna;
            antenna.SetTargetCoords(gps_list[selected]);
            antenna.Connect();
        }
        public void Main(string argument, UpdateType updateSource)
        {
            //if (antenna.TargetCoords.ToString() == vec_list[selected].ToString())
            //{
                //antenna.Connect();
                timer++; 
            //}
            /*else if ((antenna.Status.ToString()!="SearchingTargetForAntenna") && (antenna.Status.ToString()!="RotatingToTarget") && (antenna.Status.ToString() != "Connecting"))
            {
                antenna.SetTargetCoords(gps_list[selected]);
                timer = 0;
                antenna.Connect();
            }*/
            if (timer % (60 * 10) == 0)
            {
                selected = (selected + 1) % 3;
                antenna.SetTargetCoords(gps_list[selected]);
                antenna.Connect();
            }
            //antenna.Connect();
        }
    }
}

photo
1

been a few days now and you haven't responded to the submission, just wondering if the response was recorded or what

photo
photo
1

Hello, FatalError420,


thank you for the code. I reported it into our internal system.


Kind regards,

Keen Software House: QA Department

photo
1

Hello, Engineer,

happy to inform you that this problem is now fixed in v204.

However, please keep in mind, that it's not fixed in a way that the script would start to work by itself in the PC block when on the fixed version.

Please investigate added script file to see what changes need to be done in order to work properly.

Will close this thread now.

If you are experiencing any other problem with the game, please let us know by opening new thread here on the forum.

Happy Engineering!

Kind Regards

Keen Software House: QA Department

Leave a Comment
 
Attach a file