Add 4 lane balancer
This commit is contained in:
		
							parent
							
								
									7fd42f45c7
								
							
						
					
					
						commit
						d89c8136f7
					
				
					 19 changed files with 6384 additions and 1 deletions
				
			
		
							
								
								
									
										1
									
								
								blueprints/3train.bp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								blueprints/3train.bp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| 0eNqVkmFuwjAMhe/i32FipV3XXgWhKgRTLFKHNWk3hHL3OS0TaEOTkCpVSezv+dm+wNYOeOqJA9QXIOPYQ72+gKeWtU13rDuEGnpNFqIC4h1+Qf0a1YMg64zrXKAR70KzuFGAHCgQzvDpcG546LbYC0v95PsgMu0hLCY1BSfnJctxkkikslBwlv9qFZP+L06mHtTxDyR/eS+LmGrTW4uNdS35QMY3nweSc+dG4hbqvbYeFbieRE/PpKW4C9jNdmh33ydnjhgW+wGTgY9BWykxlYQt8k7356kzc66kckM8CtfJw8S6naQtPmhznNSMG9KIsmXcRPn+ml8938TiURPz5zllTBP2QZw3skCMJoVd9yjdXncguRbubeMUjNj7CVm8ZVVeVUVeVmVRyni/ARwe37c= | ||||
							
								
								
									
										78
									
								
								blueprints/3train.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								blueprints/3train.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,78 @@ | |||
| { | ||||
|   "blueprint": { | ||||
|     "entities": [ | ||||
|       { | ||||
|         "entity_number": 1, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 275, | ||||
|           "y": 233 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "enable_logistics_while_moving": false, | ||||
|         "entity_number": 2, | ||||
|         "items": [ | ||||
|           { | ||||
|             "id": { | ||||
|               "name": "rocket-fuel", | ||||
|               "quality": "legendary" | ||||
|             }, | ||||
|             "items": { | ||||
|               "in_inventory": [ | ||||
|                 { | ||||
|                   "count": 20, | ||||
|                   "inventory": 1, | ||||
|                   "stack": 0 | ||||
|                 } | ||||
|               ] | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "name": "locomotive", | ||||
|         "orientation": 0, | ||||
|         "position": { | ||||
|           "x": 275, | ||||
|           "y": 234.875 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "entity_number": 3, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 275, | ||||
|           "y": 235 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "entity_number": 4, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 275, | ||||
|           "y": 237 | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "icons": [ | ||||
|       { | ||||
|         "index": 1, | ||||
|         "signal": { | ||||
|           "name": "rail" | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "index": 2, | ||||
|         "signal": { | ||||
|           "name": "locomotive" | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "item": "blueprint", | ||||
|     "stock_connections": [ | ||||
|       { | ||||
|         "stock": 2 | ||||
|       } | ||||
|     ], | ||||
|     "version": 562949954797573 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										1
									
								
								blueprints/4train.bp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								blueprints/4train.bp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| 0eNqN000KwjAQBeC7zDpdaJvG5Coi0p+hDrTTkkRRSu9u2iIuRJhlyHtfApPMUPd3nDxxBDdD4GrK4ph1ntp1/QR3KBW8wBWLAmpGDuDOKUcdV/2a4GpAcOAr6mGNcItrabkoQI4UCffGtnhd+T7U6FNAfZohpm53i9lGKJjGkFojf47fTs8T3ZLHZt9Jl/kRj1Ixl4q5VNRSsZCKRipqqWilYimejHg0RkyKZ3MSk3+Gk94nRRwS8P0ACh7owxbQ5dEW1urCWKNNvixvl10L0w== | ||||
							
								
								
									
										92
									
								
								blueprints/4train.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								blueprints/4train.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,92 @@ | |||
| { | ||||
|   "blueprint": { | ||||
|     "entities": [ | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 1, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 1, | ||||
|           "y": 3 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 2, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 3, | ||||
|           "y": 3 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 3, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 5, | ||||
|           "y": 3 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 4, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 7, | ||||
|           "y": 3 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 5, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 9, | ||||
|           "y": 3 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 6, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 11, | ||||
|           "y": 3 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 7, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 13, | ||||
|           "y": 3 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 8, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 15, | ||||
|           "y": 3 | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "icons": [ | ||||
|       { | ||||
|         "index": 1, | ||||
|         "signal": { | ||||
|           "name": "rail" | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "item": "blueprint", | ||||
|     "snap-to-grid": { | ||||
|       "x": 16, | ||||
|       "y": 4 | ||||
|     }, | ||||
|     "version": 562949954797573 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										1
									
								
								blueprints/balancer.bp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								blueprints/balancer.bp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| 0eNqdlttugzAMht/F12mVhBgIrzJNUw9RFYkGFMI0VPHuC0Xa2kHWkCsEsr/Y/m2cGxzrXrVWGwfVDfSpMR1Ubzfo9MUc6umbOVwVVODswXRtY93uqGoHIwFtzuoLKjaSFfOurbVzyj4Y8vGdgDJOO63mQ+4vw4fpr0dvWTGy8CbQNp13aMzE9hCkBAaodozSPY7T0X8gPAbCX0AyEkh7gRJyjzNMlusskcKS6yz8YfW+pvZiG/8M0JA+RUbADe3k2fSu7ScBF/R8C51tpRcxwrD/8y+ja4n8lS4yhRWIi9EUkYsAjG2pVB6A8Pj06FNEBM7aqtNswPgaO348HtpkwRZraJGiSqiQmKKKCMDyFBhGJV2kjbV4HDxtAnPHyrSxjqTLlF7AwL+bpjRtCMZSWimgPucpMIwaJ55t2HsyCwQoNuy9GeK3sXbq6j1+7wAEPpXt7h6YcymkRMzKIpPZOH4DJhSmag== | ||||
							
								
								
									
										1
									
								
								blueprints/orientation.bp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								blueprints/orientation.bp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| 0eNrFlPFqgzAQxt/l/s6kNbFOX2UUSe3VHY1JZ6JbKb77LrqthVHoOthAyF2S++77YbgTbEyPh45sgPIEVDvroXw6gafGahP3rG4RSug0GRgFkN3iG5TLcS0AbaBAOFdMybGyfbvBji+Iz0rjate6QAOCgIPzXOJsVGaZNON7R16lStLlY56NUVVvDFbGNeQD1b56fSbOWzeQbaDcaeNRgOuIO+pZa8G+ArazEdpe2nb1HsPDrkfD3V96bdhkNIUN2q3ujhPTXMultiI7sK7jg0nrnLFRH3S9527jeuRPfGNOb2NWMlkx6gyu5J3ISVT4S2oBtevjO1HX+OWN/7xICvl7/vS/+NNr/Opnbz5bJEre/eST/8KXM/46HnGjimeGxTq6+hgdcTdOCPEVpxexvIhVVIlG2Nx5EAkYsPMTZbZKC1UUmcqLPMvlOL4DS3+ZEg== | ||||
							
								
								
									
										137
									
								
								blueprints/orientation.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								blueprints/orientation.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,137 @@ | |||
| { | ||||
|   "blueprint": { | ||||
|     "entities": [ | ||||
|       { | ||||
|         "enable_logistics_while_moving": false, | ||||
|         "entity_number": 1, | ||||
|         "items": [ | ||||
|           { | ||||
|             "id": { | ||||
|               "name": "rocket-fuel", | ||||
|               "quality": "legendary" | ||||
|             }, | ||||
|             "items": { | ||||
|               "in_inventory": [ | ||||
|                 { | ||||
|                   "inventory": 1, | ||||
|                   "stack": 0 | ||||
|                 } | ||||
|               ] | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "name": "locomotive", | ||||
|         "orientation": 0, | ||||
|         "position": { | ||||
|           "x": 251, | ||||
|           "y": 234.21875 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "enable_logistics_while_moving": false, | ||||
|         "entity_number": 2, | ||||
|         "items": [ | ||||
|           { | ||||
|             "id": { | ||||
|               "name": "rocket-fuel", | ||||
|               "quality": "legendary" | ||||
|             }, | ||||
|             "items": { | ||||
|               "in_inventory": [ | ||||
|                 { | ||||
|                   "count": 4, | ||||
|                   "inventory": 1, | ||||
|                   "stack": 0 | ||||
|                 } | ||||
|               ] | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "name": "locomotive", | ||||
|         "orientation": 0.75, | ||||
|         "position": { | ||||
|           "x": 243.6875, | ||||
|           "y": 243 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "enable_logistics_while_moving": false, | ||||
|         "entity_number": 3, | ||||
|         "items": [ | ||||
|           { | ||||
|             "id": { | ||||
|               "name": "rocket-fuel", | ||||
|               "quality": "legendary" | ||||
|             }, | ||||
|             "items": { | ||||
|               "in_inventory": [ | ||||
|                 { | ||||
|                   "count": 2, | ||||
|                   "inventory": 1, | ||||
|                   "stack": 0 | ||||
|                 } | ||||
|               ] | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "name": "locomotive", | ||||
|         "orientation": 0.25, | ||||
|         "position": { | ||||
|           "x": 259.9375, | ||||
|           "y": 243 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "enable_logistics_while_moving": false, | ||||
|         "entity_number": 4, | ||||
|         "items": [ | ||||
|           { | ||||
|             "id": { | ||||
|               "name": "rocket-fuel", | ||||
|               "quality": "legendary" | ||||
|             }, | ||||
|             "items": { | ||||
|               "in_inventory": [ | ||||
|                 { | ||||
|                   "count": 3, | ||||
|                   "inventory": 1, | ||||
|                   "stack": 0 | ||||
|                 } | ||||
|               ] | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "name": "locomotive", | ||||
|         "orientation": 0.5, | ||||
|         "position": { | ||||
|           "x": 251, | ||||
|           "y": 250.4375 | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "icons": [ | ||||
|       { | ||||
|         "index": 1, | ||||
|         "signal": { | ||||
|           "name": "rail" | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "item": "blueprint", | ||||
|     "stock_connections": [ | ||||
|       { | ||||
|         "stock": 1 | ||||
|       }, | ||||
|       { | ||||
|         "stock": 2 | ||||
|       }, | ||||
|       { | ||||
|         "stock": 3 | ||||
|       }, | ||||
|       { | ||||
|         "stock": 4 | ||||
|       } | ||||
|     ], | ||||
|     "version": 562949954797573 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										45
									
								
								blueprints/own_train.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								blueprints/own_train.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | |||
| { | ||||
|   "blueprint": { | ||||
|     "item": "blueprint", | ||||
|     "label": "test", | ||||
|     "entities": [ | ||||
|       { | ||||
|         "entity_number": 1, | ||||
|         "name": "locomotive", | ||||
|         "orientation": 0, | ||||
|         "position": { | ||||
|           "x": 0, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "entity_number": 2, | ||||
|         "name": "cargo-wagon", | ||||
|         "orientation": 0, | ||||
|         "position": { | ||||
|           "x": 0, | ||||
|           "y": 7 | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "stock_connections": [ | ||||
|       { | ||||
|         "back": 2, | ||||
|         "stock": 1 | ||||
|       }, | ||||
|       { | ||||
|         "stock": 2, | ||||
|         "front": 1 | ||||
|       } | ||||
|     ], | ||||
|     "icons": [ | ||||
|       { | ||||
|         "index": 1, | ||||
|         "signal": { | ||||
|           "name": "rail" | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "version": 562949954797573 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										1
									
								
								blueprints/simple_splitter.bp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								blueprints/simple_splitter.bp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| 0eNqd0W8LgjAQBvDvcq+n+G/l9lUiQuuIgZ6ynZHIvnuziMISopcbz/O7Y5ugbgbsrSEGPYE5duRA7yZw5kxVM99R1SJoYFuR6zvLUY0Ngxdg6IRX0KkXX+Kubwwz2rdg5vcCkNiwwceQ+2E80NDWIalT8dEW0HcuFDqa7YCUWwEj6ChN0lj6efQCycTKxp9UGcsnlnzH8r+wlc2KnzGVLLDwcIaxDdXXdwm4oHX3ktxkqlBKyrzc5ir3/gbLs5nn | ||||
							
								
								
									
										1
									
								
								blueprints/single_belt.bp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								blueprints/single_belt.bp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| 0eNp1jsEOgjAQRP9lzoWItUL7K8YYqhvTBLakLUZC+u8WPHjyuJN5b3aFHWaaguMEs8LdPUeYy4rontwPW8b9SDBIoec4+ZAqS0NCFnD8oDdMk68CxMklR192P5Ybz6OlUArij0Ng8rFgnredouraWgksMFVzkLXKm9klGgv6e1PgRSHukDof9UlrpWTXSi1z/gD180RL | ||||
							
								
								
									
										1
									
								
								blueprints/small_train.bp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								blueprints/small_train.bp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| 0eNqtlGFvwiAQhv/LfUZjaxHbv7IsDa1YL6NgAOuM6X/f0Tq3ZF3Ckn0ivHAP78Fxd2j0RZ0dmgDVHbC1xkP1cgePnZE6akb2CipwEjWMDNAc1DtU2fjKQJmAAdUcMU1utbn0jXK0gX1G+kCx3SmsJgSDs/UUZU2EEynfcAY3GouM8Ad0qp1Xi5H9oObpVJFO3T6prXSdXV1lR1sXmPv1bi++21VGNlrV2nboA7a+vp6Q5r0d0HRQHaX2ioF1SCfKGbVZ5zxe40CSdUQyF60XTBXpqZbpqfJkapalU3fp1G06VTyp2ra2twEHtYTk//QqCxb26Yn9oYrLdOofqjjbpGN/rRj61T7Y9q2mTmBm+dEQojp9laOzsVuIaOGhkstGTssRgEH1ZOKrszAYlPPTCXyXl0VZ8kKUgovtOH4AgIx9uw== | ||||
							
								
								
									
										119
									
								
								blueprints/small_train.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								blueprints/small_train.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,119 @@ | |||
| { | ||||
|   "blueprint": { | ||||
|     "entities": [ | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 1, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 205, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 2, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 207, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "enable_logistics_while_moving": false, | ||||
|         "entity_number": 3, | ||||
|         "inventory": null, | ||||
|         "name": "cargo-wagon", | ||||
|         "orientation": 0.25, | ||||
|         "position": { | ||||
|           "x": 208.6875, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 4, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 209, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 5, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 211, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 6, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 213, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "enable_logistics_while_moving": false, | ||||
|         "entity_number": 7, | ||||
|         "name": "locomotive", | ||||
|         "orientation": 0.25, | ||||
|         "position": { | ||||
|           "x": 215.6875, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 8, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 215, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 9, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 217, | ||||
|           "y": 0 | ||||
|         } | ||||
|       }, | ||||
|       { | ||||
|         "direction": 4, | ||||
|         "entity_number": 10, | ||||
|         "name": "straight-rail", | ||||
|         "position": { | ||||
|           "x": 219, | ||||
|           "y": 0 | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "icons": [ | ||||
|       { | ||||
|         "index": 1, | ||||
|         "signal": { | ||||
|           "name": "rail" | ||||
|         } | ||||
|       } | ||||
|     ], | ||||
|     "item": "blueprint", | ||||
|     "stock_connections": [ | ||||
|       { | ||||
|         "front": 7, | ||||
|         "stock": 3 | ||||
|       }, | ||||
|       { | ||||
|         "back": 3, | ||||
|         "stock": 7 | ||||
|       } | ||||
|     ], | ||||
|     "version": 562949954797573 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										1
									
								
								blueprints/train2.0.bp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								blueprints/train2.0.bp
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										5752
									
								
								blueprints/train2.0.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5752
									
								
								blueprints/train2.0.json
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										12
									
								
								src/bin/balancer_blueprint.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/bin/balancer_blueprint.rs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| use factorio_blueprint::blueprint::{balancer::generate_4_lane_balancer, BlueprintString}; | ||||
| 
 | ||||
| fn main() { | ||||
|     let b = BlueprintString::Blueprint(generate_4_lane_balancer()); | ||||
| 
 | ||||
|     println!("{}", serde_json::to_string_pretty(&b).unwrap()); | ||||
| 
 | ||||
|     println!( | ||||
|         "{}", | ||||
|         factorio_blueprint::blueprint::encode(&serde_json::to_string(&b).unwrap()) | ||||
|     ); | ||||
| } | ||||
							
								
								
									
										139
									
								
								src/blueprint/balancer.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										139
									
								
								src/blueprint/balancer.rs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,139 @@ | |||
| use super::{Blueprint, BlueprintEntity, BlueprintPosition}; | ||||
| 
 | ||||
| pub fn generate_4_lane_balancer() -> Blueprint { | ||||
|     let e = vec![ | ||||
|         BlueprintEntity::builder("splitter".to_owned(), 1, BlueprintPosition::new(1.0, 0.5)) | ||||
|             .build(), | ||||
|         BlueprintEntity::builder("splitter".to_owned(), 2, BlueprintPosition::new(3.0, 0.5)) | ||||
|             .build(), | ||||
|         BlueprintEntity::builder("splitter".to_owned(), 3, BlueprintPosition::new(2.0, 1.5)) | ||||
|             .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             4, | ||||
|             BlueprintPosition::new(0.5, 1.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             5, | ||||
|             BlueprintPosition::new(3.5, 1.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             6, | ||||
|             BlueprintPosition::new(0.5, 2.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "underground-belt".to_owned(), | ||||
|             4, | ||||
|             BlueprintPosition::new(1.5, 2.5), | ||||
|         ) | ||||
|         .underground_type("output".to_owned()) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "underground-belt".to_owned(), | ||||
|             5, | ||||
|             BlueprintPosition::new(2.5, 2.5), | ||||
|         ) | ||||
|         .underground_type("output".to_owned()) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             6, | ||||
|             BlueprintPosition::new(3.5, 2.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             7, | ||||
|             BlueprintPosition::new(0.5, 3.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             8, | ||||
|             BlueprintPosition::new(1.5, 3.5), | ||||
|         ) | ||||
|         .direction(12) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             9, | ||||
|             BlueprintPosition::new(2.5, 3.5), | ||||
|         ) | ||||
|         .direction(4) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             10, | ||||
|             BlueprintPosition::new(3.5, 3.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder("splitter".to_owned(), 11, BlueprintPosition::new(2.0, 4.5)) | ||||
|             .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             12, | ||||
|             BlueprintPosition::new(0.5, 5.5), | ||||
|         ) | ||||
|         .direction(4) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             13, | ||||
|             BlueprintPosition::new(1.5, 5.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             14, | ||||
|             BlueprintPosition::new(2.5, 5.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             15, | ||||
|             BlueprintPosition::new(3.5, 5.5), | ||||
|         ) | ||||
|         .direction(12) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             16, | ||||
|             BlueprintPosition::new(0.5, 6.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "underground-belt".to_owned(), | ||||
|             17, | ||||
|             BlueprintPosition::new(1.5, 6.5), | ||||
|         ) | ||||
|         .underground_type("input".to_owned()) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "underground-belt".to_owned(), | ||||
|             18, | ||||
|             BlueprintPosition::new(2.5, 6.5), | ||||
|         ) | ||||
|         .underground_type("input".to_owned()) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder( | ||||
|             "transport-belt".to_owned(), | ||||
|             19, | ||||
|             BlueprintPosition::new(3.5, 6.5), | ||||
|         ) | ||||
|         .build(), | ||||
|         BlueprintEntity::builder("splitter".to_owned(), 20, BlueprintPosition::new(1.0, 7.5)) | ||||
|             .build(), | ||||
|         BlueprintEntity::builder("splitter".to_owned(), 21, BlueprintPosition::new(3.0, 7.5)) | ||||
|             .build(), | ||||
|     ]; | ||||
| 
 | ||||
|     Blueprint::builder() | ||||
|         .label("balancer".to_string()) | ||||
|         .entities(e) | ||||
|         .build() | ||||
| } | ||||
|  | @ -8,6 +8,7 @@ pub mod structs; | |||
| 
 | ||||
| pub use structs::*; | ||||
| 
 | ||||
| pub mod balancer; | ||||
| pub mod train; | ||||
| 
 | ||||
| pub fn decode(s: &str) -> String { | ||||
|  |  | |||
|  | @ -98,7 +98,7 @@ pub struct BlueprintEntity { | |||
|     #[builder(start_fn)] | ||||
|     position: BlueprintPosition, | ||||
|     #[serde(skip_serializing_if = "Option::is_none")] | ||||
|     direciton: Option<u8>, | ||||
|     direction: Option<u8>, | ||||
|     #[serde(skip_serializing_if = "Option::is_none")] | ||||
|     orientation: Option<f32>, | ||||
|     #[serde(skip_serializing_if = "Option::is_none")] | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue