@@ -89,8 +89,8 @@ def userDidPartialReinstall(self, gameInstallTimeProbePath):
8989 return os .path .getctime (gameInstallTimeProbePath ) > os .path .getmtime (self .localVersionFilePath )
9090
9191 def __init__ (self , fullInstallConfiguration , modFileList , localVersionFolder , datadir = None , _testRemoteSubModVersion = None , verbosePrinting = True ):
92- #type: (installConfiguration.FullInstallConfiguration, List[installConfiguration.ModFile], str, str, Optional[SubModVersionInfo], bool) -> None
93- subMod = fullInstallConfiguration .subModConfig
92+ #type: (installConfiguration.FullInstallConfiguration, List[installConfiguration.ModFile], str, str, Optional[SubModVersionInfo], bool, Optional[list[str]] ) -> None
93+ subMod = fullInstallConfiguration .subModConfig # type: installConfiguration.SubModConfig
9494 self .verbosePrinting = verbosePrinting
9595 self .targetID = subMod .modName + '/' + subMod .subModName
9696 self .unfilteredModFileList = modFileList
@@ -132,8 +132,14 @@ def __init__(self, fullInstallConfiguration, modFileList, localVersionFolder, da
132132 for file in self .unfilteredModFileList :
133133 self .updatesRequiredDict [file .id ] = (True , "Failed to retrieve remote version information" )
134134 else :
135+ forceUpdateList = []
136+
137+ # Always install script when language patch is enabled
138+ if subMod .family == "higurashi" and modOptionParser .languagePatchIsEnabled :
139+ forceUpdateList .append (ForceUpdate ('script' , 'Language patch option forces script re-install' ))
140+
135141 # Mark files which need update
136- self .updatesRequiredDict = getFilesNeedingUpdate (self .unfilteredModFileList , self .localVersionInfo , self .remoteVersionInfo , repairMode = modOptionParser .repairMode )
142+ self .updatesRequiredDict = getFilesNeedingUpdate (self .unfilteredModFileList , self .localVersionInfo , self .remoteVersionInfo , repairMode = modOptionParser .repairMode , forceUpdateList = forceUpdateList )
137143
138144 if verbosePrinting :
139145 print ("\n Installer Update Information:" )
@@ -266,10 +272,15 @@ def getRemoteVersion(remoteTargetID):
266272
267273 return SubModVersionInfo (remoteVersionObject )
268274
275+ class ForceUpdate :
276+ def __init__ (self , name , reason ):
277+ #type: (str, str) -> None
278+ self .name = name
279+ self .reason = reason
269280
270281# given a mod
271- def getFilesNeedingUpdate (modFileList , localVersionInfo , remoteVersionInfo , repairMode ):
272- #type: (List[installConfiguration.ModFile], SubModVersionInfo, SubModVersionInfo, bool) -> Dict[str, Tuple[bool, str]]
282+ def getFilesNeedingUpdate (modFileList , localVersionInfo , remoteVersionInfo , repairMode , forceUpdateList = None ):
283+ #type: (List[installConfiguration.ModFile], SubModVersionInfo, SubModVersionInfo, bool, Optional[list[ForceUpdate]] ) -> Dict[str, Tuple[bool, str]]
273284 """
274285
275286 :param modFileList:
@@ -301,6 +312,13 @@ def getFilesNeedingUpdate(modFileList, localVersionInfo, remoteVersionInfo, repa
301312 result = updatesRequiredDict .get (file .id )
302313 needUpdate , updateReason = (True , "Missing version info" ) if result is None else result
303314
315+ # Check for files forced to update via forceUpdateList parameter
316+ if not needUpdate and forceUpdateList is not None :
317+ for forceUpdate in forceUpdateList :
318+ if file .name == forceUpdate .name :
319+ needUpdate = True
320+ updateReason = forceUpdate .reason
321+
304322 if not needUpdate and repairMode and file .installOnRepair :
305323 needUpdate = True
306324 updateReason = "Re-installing as Repair Mode Enabled"
0 commit comments