 9b22458f44
			
		
	
	9b22458f44
	
	
	
		
			
			Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024 This includes randomization for pretty much all of the new content, including but not limited to - Raccoon Bundles - Booksanity - Skill Masteries - New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit. In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update - Walnutsanity - Player Buffs - More customizability in settings, such as shorter special orders, ER without farmhouse - New Remixed Bundles
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| from abc import ABC, abstractmethod
 | |
| from typing import ClassVar, Optional
 | |
| 
 | |
| from ...data.game_item import GameItem, ItemTag
 | |
| 
 | |
| location_prefix = "Harvest "
 | |
| 
 | |
| 
 | |
| def to_location_name(crop: str) -> str:
 | |
|     return location_prefix + crop
 | |
| 
 | |
| 
 | |
| def extract_crop_from_location_name(location_name: str) -> Optional[str]:
 | |
|     if not location_name.startswith(location_prefix):
 | |
|         return None
 | |
| 
 | |
|     return location_name[len(location_prefix):]
 | |
| 
 | |
| 
 | |
| class CropsanityFeature(ABC):
 | |
|     is_enabled: ClassVar[bool]
 | |
| 
 | |
|     to_location_name = staticmethod(to_location_name)
 | |
|     extract_crop_from_location_name = staticmethod(extract_crop_from_location_name)
 | |
| 
 | |
|     @abstractmethod
 | |
|     def is_included(self, crop: GameItem) -> bool:
 | |
|         ...
 | |
| 
 | |
| 
 | |
| class CropsanityDisabled(CropsanityFeature):
 | |
|     is_enabled = False
 | |
| 
 | |
|     def is_included(self, crop: GameItem) -> bool:
 | |
|         return False
 | |
| 
 | |
| 
 | |
| class CropsanityEnabled(CropsanityFeature):
 | |
|     is_enabled = True
 | |
| 
 | |
|     def is_included(self, crop: GameItem) -> bool:
 | |
|         return ItemTag.CROPSANITY_SEED in crop.tags
 |