X2CommunityCore / X2ModBuildCommon

An improved XCOM 2 mod build system
MIT License
5 stars 5 forks source link

Add option to mark mod script packages as always loaded for cooker #48

Open Xymanek opened 3 years ago

Xymanek commented 3 years ago

When a SF package is made, the cooker will dutifully inline everything that doesn't match the following criteria:

This includes script classes (including their bytecode). Normally this isn't a concern - objects from (and referenced by) native script packages are considered to be always loaded. However, that isn't the case for non-native script packages (including the DLC ones, but they are unable to cause the issue discussed here). As such, if a package has an object that's based on a class that comes from a non-native script package, the SF package will include the classes, and their bytecode, all the way up the class hierarchy to the first class from a native script package.

Side note: the original cooking approach had this issue even with the native script packages, since I cleared their array - the cooked kismet map pulled in the bytecode for all used Seq[...] classes. I noticed/realized that only after the approach was implemented

The solution is simple - we just add the script package(s) to the native packages array as part of our DefaultEngine.ini modifications. This causes the cooker to load them and mark as always loaded, but not cook them since it assumes that they are part of the base game. However, I do not think we should do so automatically: