public void Init(ZACommons commons, EventDriver eventDriver, ZACustomData customData,
                  Action <ZACommons, EventDriver> postLaunch)
 {
     PostLaunch   = postLaunch;
     ReleaseDelay = customData.GetDouble("releaseDelay");
     eventDriver.Schedule(0, Prime);
 }
    private void GetShellParameters(ZACommons commons)
    {
        // Some defaults
        ShellSpeed     = 100.0;
        ShellFireDelay = ShellOffset = 0.0;

        var group = commons.GetBlockGroupWithName(FC_FIRE_GROUP);

        if (group != null)
        {
            foreach (var block in group.Blocks)
            {
                if (block is IMyProgrammableBlock)
                {
                    var shellCustomData = new ZACustomData();
                    shellCustomData.Parse(block);
                    ShellSpeed     = shellCustomData.GetDouble("speed");
                    ShellFireDelay = shellCustomData.GetDouble("delay");
                    ShellOffset    = shellCustomData.GetDouble("offset");
                    // Only bother with the 1st one for now
                    return;
                }
            }
        }
    }
 public void Init(ZACommons commons, EventDriver eventDriver, ZACustomData customData)
 {
     TransponderID = customData.GetString("transponderID");
     if (TransponderID.Length > 0)
     {
         eventDriver.Schedule(0, Run);
     }
     eventDriver.Schedule(RunDelay, Cleanup);
 }
Beispiel #4
0
    public void Init(ZACommons commons, EventDriver eventDriver,
                     ZACustomData customData,
                     Func <ZACommons, EventDriver, bool> livenessCheck = null)
    {
        BurnDirection   = customData.GetDirection("burnDirection", VTVLHELPER_BURN_DIRECTION);
        BrakeDirection  = customData.GetDirection("brakeDirection", VTVLHELPER_BRAKE_DIRECTION);
        LaunchDirection = customData.GetDirection("launchDirection", VTVLHELPER_LAUNCH_DIRECTION);

        LivenessCheck = livenessCheck;

        var lastCommand = commons.GetValue(LastCommandKey);

        if (lastCommand != null)
        {
            HandleCommand(commons, eventDriver, lastCommand);
        }
    }