polymod icon indicating copy to clipboard operation
polymod copied to clipboard

[ENHANCEMENT] Add functions to retrieve files from specific mods, or to ignore mods.

Open EliteMasterEric opened this issue 4 years ago • 3 comments
trafficstars

I was going to submit an issue that was like "hey wouldn't it be cool if you could get the original asset without consideration of any mods installed?" but then I found that PolymodAssetLibrary.getTextDirectly and checkDirectly literally already exist.

After further investigation, this is actually misleading; "without consideration of any modifications" means without merges or appends. It does NOT allow for the user to forcibly ignore mods.

In most general cases, the game client should only need the instance of the file provided by the last mod in the list that replaces it. However, in special cases, new functions would allow for accessing the original, unmodded file, or even accessing the file from a specific mod. My suggestion is the following set of static functions to be added to the Polymod class (since I don't believe we can modify the method signature of the existing Lime calls):

  • listDirectly(type:PolymodAssetType, modId:String = ""):Array<String> would list all files of the given asset type. If a value is provided for modId, it would list the files provided by that specific mod. If no value is provided, it will list the asset files only from the fallback libraries, while ignoring mods.
  • getTextDirectly(id:String,PolymodAssetType, modId:String = ""):String would retrieve the file contents as a string; if a specific modId is specified, the file will be fetched from that, and if no modId is specified, the original unmodified file will be used.
  • getBytesDirectly(id:String,PolymodAssetType, modId:String = ""):Bytes is similar to getTextDirectly but it returns bytes.
  • listModsOnFile(id:String) would list each mod that replaces a file, in mod-load order; thus, the last mod in the list is the mod which is currently providing the file.

EliteMasterEric avatar Sep 17 '21 02:09 EliteMasterEric

Moved to MasterEric/Polymod#10

EliteMasterEric avatar Nov 06 '21 01:11 EliteMasterEric