Options: various fixes to get_option_name falsely giving get_current_option_name instead.
This commit is contained in:
		
							parent
							
								
									3f415b8265
								
							
						
					
					
						commit
						54e50f69e1
					
				|  | @ -68,10 +68,14 @@ class FactorioContext(CommonContext): | |||
|                 raise Exception("Cannot connect to a server with unknown own identity, " | ||||
|                                 "bridge to Factorio first.") | ||||
| 
 | ||||
|         await self.send_msgs([{"cmd": 'Connect', | ||||
|                                'password': self.password, 'name': self.auth, 'version': Utils.version_tuple, | ||||
|         await self.send_msgs([{ | ||||
|             "cmd": 'Connect', | ||||
|             'password': self.password, | ||||
|             'name': self.auth, | ||||
|             'version': Utils.version_tuple, | ||||
|             'tags': ['AP'], | ||||
|                                'uuid': Utils.get_unique_identifier(), 'game': "Factorio" | ||||
|             'uuid': Utils.get_unique_identifier(), | ||||
|             'game': "Factorio" | ||||
|         }]) | ||||
| 
 | ||||
|     def on_print(self, args: dict): | ||||
|  |  | |||
							
								
								
									
										10
									
								
								Options.py
								
								
								
								
							
							
						
						
									
										10
									
								
								Options.py
								
								
								
								
							|  | @ -181,6 +181,8 @@ class Choice(Option): | |||
|             return other != self.value | ||||
|         elif isinstance(other, bool): | ||||
|             return other != bool(self.value) | ||||
|         elif other is None: | ||||
|             return False | ||||
|         else: | ||||
|             raise TypeError(f"Can't compare {self.__class__.__name__} with {other.__class__.__name__}") | ||||
| 
 | ||||
|  | @ -217,7 +219,7 @@ class Range(Option, int): | |||
|         return cls.from_text(str(data)) | ||||
| 
 | ||||
|     def get_option_name(self, value): | ||||
|         return str(self.value) | ||||
|         return str(value) | ||||
| 
 | ||||
|     def __str__(self): | ||||
|         return str(self.value) | ||||
|  | @ -256,7 +258,7 @@ class OptionDict(Option): | |||
|             raise NotImplementedError(f"Cannot Convert from non-dictionary, got {type(data)}") | ||||
| 
 | ||||
|     def get_option_name(self, value): | ||||
|         return ", ".join(f"{key}: {value}" for key, value in self.value.items()) | ||||
|         return ", ".join(f"{key}: {v}" for key, v in value.items()) | ||||
| 
 | ||||
|     def __contains__(self, item): | ||||
|         return item in self.value | ||||
|  | @ -282,7 +284,7 @@ class OptionList(Option): | |||
|         return cls.from_text(str(data)) | ||||
| 
 | ||||
|     def get_option_name(self, value): | ||||
|         return ", ".join(self.value) | ||||
|         return ", ".join(value) | ||||
| 
 | ||||
|     def __contains__(self, item): | ||||
|         return item in self.value | ||||
|  | @ -310,7 +312,7 @@ class OptionSet(Option): | |||
|         return cls.from_text(str(data)) | ||||
| 
 | ||||
|     def get_option_name(self, value): | ||||
|         return ", ".join(self.value) | ||||
|         return ", ".join(value) | ||||
| 
 | ||||
|     def __contains__(self, item): | ||||
|         return item in self.value | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue