mirror of
				https://github.com/tobspr/shapez.io.git
				synced 2025-06-13 13:04:03 +00:00 
			
		
		
		
	use locale decimal separator on belt reader display
This commit is contained in:
		
							parent
							
								
									366a2a9f58
								
							
						
					
					
						commit
						9821ba656f
					
				| @ -558,7 +558,16 @@ export function formatSeconds(secs) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Formats a number like 2.5 to "2.5 items / s" |  * Formats a number like 2.51 to "2.5" | ||||||
|  |  * @param {number} speed | ||||||
|  |  * @param {string=} separator The decimal separator for numbers like 50.1 (separator='.') | ||||||
|  |  */ | ||||||
|  | export function formatApproximateSpeed(speed, separator = T.global.decimalSeparator) { | ||||||
|  |     return round1Digit(speed).toString().replace(".", separator); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Formats a number like 2.51 to "2.51 items / s" | ||||||
|  * @param {number} speed |  * @param {number} speed | ||||||
|  * @param {boolean=} double |  * @param {boolean=} double | ||||||
|  * @param {string=} separator The decimal separator for numbers like 50.1 (separator='.') |  * @param {string=} separator The decimal separator for numbers like 50.1 (separator='.') | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| import { globalConfig } from "../../core/config"; | import { globalConfig } from "../../core/config"; | ||||||
| import { Loader } from "../../core/loader"; | import { Loader } from "../../core/loader"; | ||||||
| import { smoothPulse } from "../../core/utils"; | import { formatApproximateSpeed, smoothPulse } from "../../core/utils"; | ||||||
| import { enumItemProcessorRequirements, enumItemProcessorTypes } from "../components/item_processor"; | import { enumItemProcessorRequirements, enumItemProcessorTypes } from "../components/item_processor"; | ||||||
| import { Entity } from "../entity"; | import { Entity } from "../entity"; | ||||||
| import { GameSystem } from "../game_system"; | import { GameSystem } from "../game_system"; | ||||||
| @ -92,7 +92,7 @@ export class ItemProcessorOverlaysSystem extends GameSystem { | |||||||
|         parameters.context.textAlign = "center"; |         parameters.context.textAlign = "center"; | ||||||
|         parameters.context.font = "bold 10px GameFont"; |         parameters.context.font = "bold 10px GameFont"; | ||||||
|         parameters.context.fillText( |         parameters.context.fillText( | ||||||
|             "" + Math.round(readerComp.lastThroughput * 10) / 10, |             formatApproximateSpeed(readerComp.lastThroughput), | ||||||
|             (staticComp.origin.x + 0.5) * globalConfig.tileSize, |             (staticComp.origin.x + 0.5) * globalConfig.tileSize, | ||||||
|             (staticComp.origin.y + 0.62) * globalConfig.tileSize |             (staticComp.origin.y + 0.62) * globalConfig.tileSize | ||||||
|         ); |         ); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user