| 
									
										
										
										
											2020-06-27 08:38:11 +00:00
										 |  |  | import { formatItemsPerSecond } from "../../core/utils"; | 
					
						
							| 
									
										
										
										
											2020-05-09 14:45:23 +00:00
										 |  |  | import { enumDirection, Vector } from "../../core/vector"; | 
					
						
							| 
									
										
										
										
											2020-06-27 08:38:11 +00:00
										 |  |  | import { T } from "../../translations"; | 
					
						
							|  |  |  | import { ItemAcceptorComponent } from "../components/item_acceptor"; | 
					
						
							| 
									
										
										
										
											2020-05-09 14:45:23 +00:00
										 |  |  | import { ItemEjectorComponent } from "../components/item_ejector"; | 
					
						
							|  |  |  | import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor"; | 
					
						
							|  |  |  | import { Entity } from "../entity"; | 
					
						
							|  |  |  | import { MetaBuilding } from "../meta_building"; | 
					
						
							|  |  |  | import { GameRoot } from "../root"; | 
					
						
							|  |  |  | import { enumHubGoalRewards } from "../tutorial_goals"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class MetaStackerBuilding extends MetaBuilding { | 
					
						
							|  |  |  |     constructor() { | 
					
						
							|  |  |  |         super("stacker"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     getSilhouetteColor() { | 
					
						
							|  |  |  |         return "#9fcd7d"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     getDimensions() { | 
					
						
							|  |  |  |         return new Vector(2, 1); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-17 13:32:19 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @param {GameRoot} root | 
					
						
							|  |  |  |      * @param {string} variant | 
					
						
							|  |  |  |      * @returns {Array<[string, string]>} | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     getAdditionalStatistics(root, variant) { | 
					
						
							|  |  |  |         const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.stacker); | 
					
						
							|  |  |  |         return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-09 14:45:23 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @param {GameRoot} root | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     getIsUnlocked(root) { | 
					
						
							|  |  |  |         return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_stacker); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Creates the entity at the given location | 
					
						
							|  |  |  |      * @param {Entity} entity | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     setupEntityComponents(entity) { | 
					
						
							|  |  |  |         entity.addComponent( | 
					
						
							|  |  |  |             new ItemProcessorComponent({ | 
					
						
							|  |  |  |                 inputsPerCharge: 2, | 
					
						
							|  |  |  |                 processorType: enumItemProcessorTypes.stacker, | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         entity.addComponent( | 
					
						
							|  |  |  |             new ItemEjectorComponent({ | 
					
						
							|  |  |  |                 slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }], | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |         entity.addComponent( | 
					
						
							|  |  |  |             new ItemAcceptorComponent({ | 
					
						
							|  |  |  |                 slots: [ | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         pos: new Vector(0, 0), | 
					
						
							|  |  |  |                         directions: [enumDirection.bottom], | 
					
						
							| 
									
										
										
										
											2020-08-03 14:48:26 +00:00
										 |  |  |                         filter: "shape", | 
					
						
							| 
									
										
										
										
											2020-05-09 14:45:23 +00:00
										 |  |  |                     }, | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         pos: new Vector(1, 0), | 
					
						
							|  |  |  |                         directions: [enumDirection.bottom], | 
					
						
							| 
									
										
										
										
											2020-08-03 14:48:26 +00:00
										 |  |  |                         filter: "shape", | 
					
						
							| 
									
										
										
										
											2020-05-09 14:45:23 +00:00
										 |  |  |                     }, | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |