// Combat · RimWorld Mod

Combat Extended TreePoplar Texture Fix(Hunt Interruption Fix) CE狩猎中断修复

临时修复 Combat Extended 在 RimWorld 1.

临时修复 Combat Extended 在 RimWorld 1.6 中无法缓存 TreePoplarLeaflessImmature 纹理的问题。

这是一个已知的 CE 兼容性问题,本模组通过 Harmony 补丁在 CE 抛出异常时返回默认边界值,避免红字报错和猎人工作中断。

CE 的 BoundsInjector 在启动时会遍历所有事物的纹理,计算碰撞边界。但 TreePoplarLeaflessImmature(落叶+未成熟白杨树)纹理没有被 CE 正确缓存。
我的 Harmony 补丁在 CE 的 ExtractBounds 方法抛出异常时拦截了它,返回一个安全的默认值 (1,1)

缺失边界的影响
正常情况下,如果纹理缺失,CE 会抛异常 → 红字报错 → 猎人 AI 工作中断。
我的补丁让它返回默认边界 (1,1),意味着:
子弹碰撞:把这棵树当作 1×1 格大小的障碍物(略小于实际树木,但差异很小)
对战斗几乎没有实际影响,只是让这棵树在 CE 的弹道计算中"矮了一点"。


注意:这是临时解决方案,建议关注 CE 官方更新。


Temporary fix for the issue where Combat Extended cannot cache the texture of TreePoplarLeaflessImmature in RimWorld 1.6.

This is a known compatibility issue with CE. This mod uses a Harmony patch to return a default bounding value when CE throws an exception, preventing red errors and interruption of hunter work.

CE's BoundsInjector iterates through all thing textures at startup to calculate collision bounds. However, the texture for TreePoplarLeaflessImmature (a leafless, immature poplar tree) is not properly cached by CE.
My Harmony patch intercepts the exception thrown by CE's ExtractBounds method and returns a safe default value of (1,1).

Impact of the missing bounds
Normally, if a texture is missing, CE throws an exception → red error → hunter AI work is interrupted.
With this patch, a default bound of (1,1) is returned instead, which means:

Bullet collision: the tree is treated as a 1×1 cell obstacle (slightly smaller than the actual tree, but the difference is negligible).

It has almost no practical impact on combat, just making this tree "a bit shorter" in CE's ballistic calculations.

Note: This is a temporary solution. It is recommended to keep an eye on the official CE update.