public void replicate()
    {
        if (this.battery < 5)
        {
            return; // Solar cells need to recharge.
        }
        IMyProjector   myProjector = this.myProjector;
        IMyShipGrinder grinder     = this.getGrinder();

        if (grinder != null)
        {
            if (myProjector != null)
            {
                if (this.grinderStart != 0 && Communication.getTimestamp() - this.grinderStart > 30)
                {
                    this.grinderStart = 0;
                    grinder.Enabled   = false;
                }

                if (this.replicatingInProgress == true)   // Acceptable loss
                {
                    if (myProjector.RemainingBlocks == myProjector.RemainingArmorBlocks)
                    {
                        // Turn on other drone logic block.
                        this.turnOnDrones();
                        // Cut it free
                        grinder.Enabled   = true; // release the new ship.
                        this.grinderStart = Communication.getTimestamp();
                        this.commHandle.sendMasterFinishedSignal(this.id);
                        this.replicatingInProgress = false;
                        this.status = "finishing-replication";
                        // @TODO: switch to another projector?
                    }
                    else
                    {
                        this.status = "non-armor-blocks-remainig";
                    }
                }
                else
                {
                    this.replicatingInProgress = true;
                    this.status         = "replicating";
                    grinder.Enabled     = false;
                    myProjector.Enabled = true;
                }
            }
            else
            {
                grinder.Enabled = false;
                this.status     = "missing-projector";
            }
        }
        else
        {
            this.status = "unable-to-replicate";
        }
    }
Beispiel #2
0
 bool FuncTest(IMyShipGrinder block)
 {
     //Grinder
     //Interface name: IMyShipGrinder
     //Parent: IMyShipToolBase
     //Parent: IMyFunctionalBlock
     //Fields: None
     return(true);
 }