NL Facial Animation – Load Fix
这是一个十分轻量级的修改mod,用来帮助 NL Facial Animation 在加载存档时正确地为所有小人启用动态表情。
这个 mod 用来解决什么问题?
在每次读档后,NL Facial Animation 可能并不能为所有人物正确加载动态表情。这表现为部分人物正常地加载动态表情,而部分人物仍为静态,且长时间都无法正确加载上动态表情,造成这个问题的具体原因尚不明确。
然而,通过手动打开 mod 设置并更改设置项 / 打开未正确加载动态表情人物的 Character Editor / 给人物脱下并重新穿戴装备后,人物的动态表情会恢复正常。这些操作均触发了人物的图形刷新,而在进行刷新后,人物的动态表情便被正确加载。
这个 mod 干的事情,就是把这个“手动刷新”的过程自动化。具体而言,本mod会在每次读档进入游戏后,在当前tick=1时(即约16.7ms时)遍历地图所有的人形生物,并将对应的图形缓存标记为失效,使其强制进行图形刷新。
性能影响
这个 mod 不会持续运行,它只会在每次读档后,第一个tick开始执行的瞬间进行一次刷新,后续不再生效,这不会带来可被感知到的游戏卡顿。
兼容性
该mod没有修改 NL Facial Animation 的内部逻辑,仅在第一个tick的处理中额外加入了让人物刷新图形的语句,理论上不会与其他mod出现兼容性问题。
加载顺序
该mod没有依赖,也不需要特殊排序,方便起见,可放在NL Facial Animation的下面。
具体代码实现方式可在Source文件夹下找到
This is a very lightweight utility mod designed to help NL Facial Animation correctly enable dynamic facial expressions for all pawns when loading a save.
What problem does this mod solve?
After loading a save, NL Facial Animation may fail to properly initialize dynamic facial expressions for all pawns. As a result, some pawns display facial animations correctly, while others remain static. The reason behinds this is unclear.
However, in these cases, facial animations usually return after one of the following actions: manually refreshing the mod by changing a setting, opening Character Editor for a pawn whose facial animation failed to initialize, removing and re-equipping the pawn’s apparel. All of these actions trigger a refresh of the pawn’s graphics, after which dynamic facial expressions begin working normally again.
This mod simply automates that manual refresh process. More specifically, each time a save is loaded, this mod iterates through all humanlike pawns on the current maps at tick 1 (about 16.7 ms after entering the game), and marks their graphic caches as dirty so their graphics are forcibly refreshed.
Performance impact
This mod does not run continuously.
It performs a single refresh only once, at the first tick after loading a save, and does nothing afterwards. As a result, it should not cause any noticeable in-game lag.
Compatibility
This mod does not modify the internal logic of NL Facial Animation.
It only adds an extra graphic refresh step during processing on the first tick after loading. In theory, this should make it compatible with most other mods.
Load order
This mod has no dependencies, and no special load order is required.
For convenience, you can place it below NL Facial Animation.
The specific implementation method of the code can be found in the "Source" folder.