Precision Mode Control in Programmable Block interface

DragonsKin shared this feedback 5 years ago
Submitted

As the title states it appears we do not have access to Precision Control at this time.


Given that it is in the same area as Collision Avoidance I would expect to access it the same way:


// Like
_remoteControl.ApplyAction("CollisionAvoidance_Off");
_remoteControl.ApplyAction("PrecisionMode_Off");
// And
_remoteControl.GetValueBool("CollisionAvoidance")
_remoteControl.GetValueBool("PrecisionMode")

But the former (Precision Mode not Collision Avoidance in the example above) throws the following exception:

System.NullReferenceException: Object reference not set to an instance of an object.

Thank you,


DragonsKin

Best Answer
photo

You shouldn't be using the terminal actions and -properties at all. You should be using the members on the interfaces for performance reasons. The terminal actions and -properties are deprecated for anything but mod extensions - except where there are still missing C# members.


If you don't already I strongly recommend using an IDE like Visual Studio to write code. It will allow you to discover the available members. My plugin for Visual Studio 2017 will help.


I don't have access to the game here so I can't tell you the member you should be using, but to directly answer your question though: You're looking for the "DockingMode" terminal property.

List Of Terminal Properties and Actions


[Add.] Asked someone on the Discord channel to look it up for me. You should be using the method void IMyRemoteControl.SetDockingMode(boolean enabled). I would then assume there's a DockingMode get-only property to read it then.

Replies (1)

photo
3

You shouldn't be using the terminal actions and -properties at all. You should be using the members on the interfaces for performance reasons. The terminal actions and -properties are deprecated for anything but mod extensions - except where there are still missing C# members.


If you don't already I strongly recommend using an IDE like Visual Studio to write code. It will allow you to discover the available members. My plugin for Visual Studio 2017 will help.


I don't have access to the game here so I can't tell you the member you should be using, but to directly answer your question though: You're looking for the "DockingMode" terminal property.

List Of Terminal Properties and Actions


[Add.] Asked someone on the Discord channel to look it up for me. You should be using the method void IMyRemoteControl.SetDockingMode(boolean enabled). I would then assume there's a DockingMode get-only property to read it then.

photo
2

From "The Man" himself :). Thank you for all this. I currently use a simple text editor, but will definitely explore your plugin.


Your LIST. My god! I was still scouring SE wiki, github, and spaceengineers.io (until recently it seems access is blocked) for insight into accessible properties/methods.


Just out of curiosity, can you give some more insight into what performance gains I could get out of the switch? I have a few scripts out there and this could warrant a massive overhaul/rewrite of all of them, so just looking to get an idea of underlying architecture affected.


Again thanks for the time Mr. Malware ;).

photo
3

Orders of magnitude performance gains. Terminal properties and actions needs to be retrieved by name, involving many operations, while direct member invocations skip all that and go straight to the metal.

photo
2

It has been a while since your offered this advice to me. I have rather enjoyed the experience since then. So much so that I made a framework that I use as a base for all of my scripts. The documentation is a work in progress, but will have diagrams and more to add clarity. I reference your MDK a lot in it so I hope it is OK:


https://github.com/isaiahgrant/CodeInSE


Probably not the best place to contact you, but it felt appropriate to close this out this way :).

photo
Leave a Comment
 
Attach a file