Exemple #1
0
 public void PlaceStaticModules(List <StaticDeclarationBlock> staticDeclarations)
 {
     foreach (var staticDeclaration in staticDeclarations)
     {
         if (staticDeclaration is DropletDeclaration dropletDeclaration)
         {
             throw new NotImplementedException();
             BoardFluid fluidType     = RecordCompletlyNewFluidType(dropletDeclaration);
             Droplet    droplet       = (Droplet)dropletDeclaration.getAssociatedModule();
             bool       couldBePlaced = board.FastTemplatePlace(droplet);
             if (!couldBePlaced)
             {
                 throw new RuntimeException("The input module couldn't be placed. The module is: " + droplet.ToString());
             }
             //It is not really static, and thus must does not need to be registered as such.
         }
         else if (staticDeclaration is InputDeclaration input)
         {
             BoardFluid  fluidType     = RecordCompletlyNewFluidType(input);
             InputModule inputModule   = new InputModule(fluidType, (int)input.Amount);
             bool        couldBePlaced = board.FastTemplatePlace(inputModule);
             if (!couldBePlaced)
             {
                 throw new RuntimeException("The input module couldn't be placed. The module is: " + inputModule.ToString());
             }
             input.BoundModule = inputModule;
             inputModule.RepositionLayout();
             StaticModules.Add(staticDeclaration.ModuleName, inputModule);
             NameOfInputFluids.Add(fluidType.FluidName);
         }
         else
         {
             Module staticModule = getAndPlaceFirstPlaceableModule(staticDeclaration, board);
             StaticModules.Add(staticDeclaration.ModuleName, staticModule);
         }
     }
     if (SHOULD_DO_GARBAGE_COLLECTION)
     {
         WasteModule waste         = new WasteModule();
         bool        couldBePlaced = board.FastTemplatePlace(waste);
         if (!couldBePlaced)
         {
             throw new RuntimeException("The waste module couldn't be placed. The module is: " + waste.ToString());
         }
         waste.GetInputLayout().Reposition(waste.Shape.x, waste.Shape.y);
         StaticModules.Add(WASTE_MODULE_NAME, waste);
     }
 }