RimWorld

RimWorld

[AV] Show Utility Apparel
28 Comments
LowPitch 6 minutes ago 
만약에 이 모드가 오류가 난다면 모드 목록에서 Custom Portrait 보다 우선순위에 오도록 순서를 조정하세요. 저는 그렇게 해결보았습니다. 그럼 이만
TeH_Dav 27 Jul @ 7:40am 
@Veltaris
That's strange. Reinstalling after a verify seems to have made the error go away. Steam mod updates have been giving me issues at times recently. Its mostly strange because I had tried that before. Oh well, at least its working now eh? Thank you, and sorry for the inconvenience.
Veltaris  [author] 26 Jul @ 12:22pm 
@TeH_Dav
Seems like the transpiler is running for you properly, but somehow fails to find all instructions inside the colonist bar.
So either, you have a corrupt file of my mod or rimworld or another mod has already changed the colonybar to an extend that it breaks my mod.

So, let steam verify your rimworld files, redownload this mod and check if it works without any other mod (besides harmony ofc).
If it still does not work, I'm out of ideas.
If it does work try to load your other mods with it and see if you can find the one thats not compatible.
TeH_Dav 26 Jul @ 11:30am 
@Veltaris I apologize! X_X

I've been learning how to code myself, but use AI for a lot of things, and I was just trying to identify what might be causing the error. I've attached below a link the player.log. Its one of the first errors you encounter there. I appreciate you taking the time to explain the reasoning behind it!

https://drive.google.com/file/d/11GtTjC7O_m5kl6N_-Lh435cFtCGt-Dwr/view?usp=sharing
Veltaris  [author] 26 Jul @ 10:46am 
@TeH_Dav
Can you upload your whole player.log ?

Please, do not ask AI for why errors happen, otherwise you get lies like "Widgets.ThingIcon only has 3 parameters". It might look competent at first, but It will just waste your time and mine...

Widgets.ThingIcon (on 1.6) either has up to 7 or up to 8 (up to because some are optional) -
https://i.imgur.com/bAM3t8u.png
Your example also calls the 7 parameter: You are giving it 3: 2 are required, 1 is optional and the rest are taken from the default vaules...

I've switched over to a transpiler, since this mod used to override the whole colony bar UI.
A transpiler allows me to only edit how the weapon below is shown (meaning in this case changing its position and adding the utility apparel).
The commented out postfix would be incompatible with other UI mods, but should also work for 1.6.
Well anyway, without a proper log I can not really help you beyond this, as it does work fine for me:
https://i.imgur.com/Tcs3K0r.png
TeH_Dav 26 Jul @ 9:36am 
The transpiler finds the DrawColonist call and starts skipping instructions, but never finds the expected Widgets.ThingIcon call because it's looking for the wrong signature. It continues skipping until the end of the method, which breaks the IL control flow and causes the label resolution error.

I'm guessing this is something to do with the changes made related to 1.6, or updates to the mod? I saw there was a commented out prefix patch code that would work just fine, so I'm guessing there's a reason you switched to a transpiler. But at least on my end the transpiler is breaking it lol.

Thanks for your work on this mod!
TeH_Dav 26 Jul @ 9:36am 
@Veltaris Hi! I'm experiencing a mod loading error with this mod in RimWorld 1.6. The error occurs during Harmony patching and prevents the mod from loading.

Error Details:
[AV] Show Utility Apparel - Failed to patch ColonistBar.ColonistBarOnGUI()
System.ArgumentException: Label #3 is not marked in method `RimWorld.ColonistBar.ColonistBarOnGUI_Patch0'

Root Cause:
The transpiler is looking for a Widgets.ThingIcon call with 7 parameters, but the actual method in RimWorld 1.6 only has 3 parameters. The transpiler never finds the expected call, continues skipping instructions, and breaks the IL control flow.

Specific Issue:
In HarmonyPatch.cs line 67-75, the transpiler expects:
"Void ThingIcon(UnityEngine.Rect, Verse.Thing, Single, System.Nullable`1[Verse.Rot4], Boolean, Single, Boolean)"

But the actual call in RimWorld 1.6 is:
Widgets.ThingIcon(rect, thing, stackOfOne: true)
NEPH 23 Jul @ 5:13am 
thank you
OganessonG 1 Apr @ 7:58pm 
Oh, thanks for your update!
Veltaris  [author] 6 Feb @ 8:43am 
Added the suggestions from llunak, it should be more compatible with other mods now.

@OganessonG
It's been a while, so I don't know if you still care, but you can now use [NL] Custom Portraits with this mod :)
llunak 3 Feb @ 10:40am 
@Veltaris: Sorry, it turns out the performance cost is actually in the colonist drawing vanilla code, it just showed up because you copy&pasted the function.

Still, I've pushed a PR with some improvements, if you're interested. The code's commented, so I believe it should be clear, but feel free to ask in the PR if something is not.
Veltaris  [author] 2 Feb @ 2:25pm 
llunak 2 Feb @ 1:56pm 
@Veltaris: I have already looked at the code, but how do you want to get my improvements?
Veltaris  [author] 2 Feb @ 1:41pm 
@llunak
No, but the source code is in the mod files, if you wanna take a look.

Currently it is filtering through every clothing of a colonist and checking if it is an utility item or not. This accours every FRAME and for each colonist. So the more colonists, clothings and frames you have, the more performance it will eat.

I could defininatly reduce the performance impact by doing the search every couple of seconds and saving the results so they can be drawn.
llunak 2 Feb @ 12:12pm 
@Veltaris: Do you have a git repository for this somewhere? This appears to have quite a performance cost for what it does.
Rødelmaster3000 29 Jul, 2024 @ 2:53pm 
Also just so you know:
I love this mod and literally cant play without it... I would have sacrificed VE - Pirates for the enormous luxurity of having an easy way to check utility items haha
Rødelmaster3000 29 Jul, 2024 @ 2:11pm 
Yooooo your crazy fast!!
Also everthing works perfect now.
Thanks a lot
Veltaris  [author] 29 Jul, 2024 @ 7:41am 
@Eddard Stark
Thanks for the info. It should be fixed now.

@OganessonG
Sorry for the late reply. This is really just a mini mod done in not even an hour (excluding the testruns). I'll not expand this thing into a real colonist bar overall. But should you or anybody else want to put this feature into another mod, feel free to copy/change my code.
Rødelmaster3000 29 Jul, 2024 @ 6:52am 
This is somehow incompatible with 'Vanilla Factions Expanded - Pirates.' As soon as you get your first warcasket, the entire HUD becomes invisible (while still being present and activatable)
OganessonG 24 Jun, 2024 @ 12:24am 
So ... Can you add a setting that determine the size of the portrait that are 'redrawn' by this mod? The both mods are wonderful and I really want to use them together.
Veltaris  [author] 24 Jun, 2024 @ 12:08am 
@OganessonG
Sorry, unfortunately both mods change how the colonist bar is displayed.
Sadly this mod needs to redraw the colony bar, even though it just adds pictures under it.
Thats just how rimworlds colony bar works, not much I can do there.
Maybe a modder with more harmony experience can, but I don't have the skill for that.
OganessonG 23 Jun, 2024 @ 11:14pm 
Seems this mod will make [NL] Custom Portraits unable to adjust the size of portraits. Looking forward to a fix, thanks.
Ashen 17 Jun, 2024 @ 10:17am 
great for making sure my pacifists and children stop taking the god damn insanity lances
Vincent 16 Jun, 2024 @ 5:40am 
dude didnt know i needed this
J 14 Jun, 2024 @ 8:57am 
@Veltaris:

Got it, thanks for clarifying.
Veltaris  [author] 14 Jun, 2024 @ 8:36am 
@J:
I've thought about that too, but discarded the idea.
It would mean that the icons would have to be made even smaller or that the spacing between the rows would have to be changed if there were enough colonists for a second row, leaving less space for the actual game at small resolutions.
That seemed like too much work just to see how it looks.
Enzo carini 13 Jun, 2024 @ 12:48pm 
Oh my god finally!!!!!
Thanks a lot bro:steamthumbsup:
J 12 Jun, 2024 @ 4:46pm 
Would be great to see an option to draw an apparel below the weapon. Not sure if it’ll look good/too busy, though. Worth it exploring maybe?