Vanilla-Expanded / VanillaExpandedFramework

Vanilla Expanded Framework for RimWorld
Other
69 stars 34 forks source link

Update Apparel_Patches.cs #10

Closed AmCh-Q closed 1 year ago

AmCh-Q commented 1 year ago

In RimWorld 1.4 the index of local iterator for pawn.apparel.WornApparel changed from 20 to 23, leading to ArgumentOutOfRangeException, this edit fixes it.
Obviously this change is not compatible with pre-1.4 versions. IDK how you all do multi-version support.

Taranchuk commented 1 year ago

The index was changed with the new update, not with 1.4 initial update. And this fix isn't ideal since some players might not have the newest game update and thus it will break the patch for them.

Taranchuk commented 1 year ago

In this case, need to grab the local index dynamically, rather than relying on a fixed number.

AmCh-Q commented 1 year ago

Yes that's actually what I was thinking of next as well, I can do that if you aren't on it already.

Taranchuk commented 1 year ago

If you can do it, it would be great

AmCh-Q commented 1 year ago

Just made the edit. The transpiler now looks for the most recent previous access to List\<Apparel>.get_Item(idx) and get that local idx var.

Taranchuk commented 1 year ago

Was it tested on both stable and unstable game versions?

AmCh-Q commented 1 year ago

I have just tested it on both unstable1.4(Ubuntu w/ Proton) and stable1.4(Windows 11).
It now runs without errors on my side.
Though just in case you might want to double check it, since this is my first PR to Vanilla Expanded.

Taranchuk commented 1 year ago

Checked on the stable branch, seems to be fine, thanks for the fix! I'm merging this.