-
Notifications
You must be signed in to change notification settings - Fork 125
The Program Wrapper And Why You Need It
Again let's look at the program wrapper used in MDK projects.
namespace IngameScript
{
partial class Program : MyGridProgram
{
// Your Script Goes Here
}
}
This wrapper class has two purposes: Firstly to provide access to the game specific constructs like GridTerminalSystem and Echo. Secondly it's here to simulate the environment your script executes in when the programmable block is running your script.
All your code, even classes and other types, should be wrapped this way to make sure that Visual Studio behaves the same way the Programmable Block will. If you don't, you risk getting compiler errors in Visual Studio that will not happen in the programmable block, and vice versa. The only exception to this wrapping rule are the officially sanctioned "exploit" that are extension classes.
Do you have questions, comments, suggestions for improvements? Is there something I can do better? Did I make a mistake? Please add an issue here, and prefix your issue title with Wiki. Thank you, your help will be very appreciated!