RimWorld

RimWorld

95 ratings
Apparel Ownership
3
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5, 1.6
File Size
Posted
Updated
270.514 KB
25 Jun, 2024 @ 11:20am
10 Jul @ 2:32am
12 Change Notes ( view )

Subscribe to download
Apparel Ownership

Description
Intro
I created this mod to give apparel an ownership property since I was too frustrated by pawns stealing each others' stuff.

Description
With this mod pawns who are not the owner won't be allowed to wear that specific apparel (forcing is still possible, the ownership is retained but bypassed).
This is particularly useful if you are utilizing a repair/mending mod, so your pawns' apparel won't get shuffled every time it gets repaired (it can come in handy also for other reasons).

Added in the 1.5 version of this mod
- Mod option "Prefer owned apparel over non-owned (even if worse)", which allows preference of owned apparel over better non-owned one.
- Mod option "Allow owned-by-pawn-only filter in built storage", which adds a button in furniture storage (shelves-like) to allow only apparel owned by that specific pawn. Higher priority storage would still snatch the item out of this one, as it should. If an item is already stored somewhere with this filter non-active, but then the filter is activated, the items not allowed would be removed only if they've a "better" storage to go (higher priority) - they wouldn't be allowed back though, as it should.

CAUTION: To handle the new "Allow owned-by-pawn-only filter in built storage" I had to override the method involved in checking for a better storage during hauling. It had to be done, the vanilla logic is too entangled to just patch (it would override itself in the next tick). Because of this, make sure to have the mod quite high in the list, so all the other mods can patch. Except what's needed, the override retains the vanilla logic.
If a mod conflicts with this function and the higher position doesn't help, just disable this option in the mod and the vanilla method will be used as usual!

How to
To assign ownership, select a pawn and right-click on the apparel you want to assign. Select "Assign Ownership".
Ownership can be swapped to another colonist (click "Reassign Ownership") or reset so anyone can wear it again (click "Reset Ownership").

Apparel's ownership can be checked both in the quick panel (bottom left) when is selected and in the detailed info under the category "Apparel".

For 1.5 quick search function, you can search the owner's name and the apparel will be listed in the results.

The ownership doesn't override the policies, so if, for example, a duster is assigned to the pawn "Djinn," he won't wear it if his policies don't allow dusters.

One thing is sure, no one else will since it's his duster!

F.A.Q.
I'm not new to programming in C#, but I'm new to Rimworld modding, so be kind and feel free to leave comments and feedback. I'll try to address any issue and keep the mod smooth.

Where should I put the mod?
I suggest at the end of the list, since it attaches a property to all apparel.

Can I add/remove it mid-save?
Yes, in my tests it didn't cause any problem.

Does it have multilingual support?
Yes now it has. I added some languages (of course with AI support for translation), but feel free to add more.

Is it compatible with XXX?
I don't know, you can try and tell me. I have tested with 150+ mods that are currently on my mods list and there was no conflict. But you never know ~

Can you do this/that to make it better?
I don't know. I published it just cause it was a very frustrating problem for me and I didn't find any other mod that would address this in a simple way (without complex bio-coding or apparel management). The comment area is open for suggestions and I might do improvements if I have time and I like the ideas.

Why did you attach the function to the right-click of a pawn?
I found it convenient, like simulating that pawn attaching a tag on the apparel.

Final remarks
I hope that someone will find it useful and will improve their game experience.

Enjoy!
Popular Discussions View All (1)
2
8 Sep, 2024 @ 3:02pm
Bug with a few mods
Kor
53 Comments
Dima 🥔 10 Jul @ 7:33am 
Yay, seems to be totally working in 1.5. Thank you @Djinn for your time and efforts!
Djinn  [author] 10 Jul @ 2:41am 
I finally had time (just 1 day before patch ><) to rewrite the logic and make the mod 1.6 ready as well. Let me know if you encounter any issue!
Djinn  [author] 4 Jul @ 2:39am 
Yeah I still didn't have time to look into it cause I'm busy at work, but I'll fix it for the new patch (and retroactively for the others), don't worry.

The load order issue is only for considering or not containers to be filtered with the optional setting, not for the apparel to wear.
Acc Original 24 Jun @ 2:20am 
Ok, I'm trying to get this to work properly for over a week now. When I change apparel policy they always go and wear the best they can find and only after that going to wear the ones they own. I#ve got the prioritize own clothing even if worse enabled in the mod settings and been moving the mod in the load order up and down. Nothing seems to fix it. At this point I don't think it's a load order issue anymore.
Dima 🥔 16 Jun @ 11:32am 
@Djinn I wasn't sure, so rechecked right now, and no, "Prefer owned apparel over non-owned (even if worse)" was unchecked. Though if enabled, owner pawn can now also get stuck in different loop. If there are multiple owned similar clothes, i.e. pants (even different ones, like normal and flak pants), owner pawn begins endlessly switching over all that are present.

I don't know how it's coded, maybe there is a way to return result "no better apparel to optimize, finish job" when only better items are already owned so there is no even attempt to wear it? Maybe by default there is some timer for jobs that is used by default?

And for enabled option I don't know. It's different Job here being repeated (Wear), and when comparing output in console from Job Logging to vanilla, it doesn't seem to be any differences, except in vanilla pawn equips what they need and stops, and with mod job keep being assigned again and again.
Acc Original 16 Jun @ 5:55am 
Gotcha. Thanks for explaining :)
Djinn  [author] 15 Jun @ 11:55pm 
@Dima Yeah, this loop is caused by the option "Prefer owned apparel over non-owned (even if worse)". I tweaked the priority values, but I made them too close together, so they overlap for certain apparel. That creates a loop of "ownership wins" vs. "this one’s better, it wins.". It usually stops happening if you uncheck that option or if the "better" apparel is not so close in priority value to the owned one. I'll fix it in the upcoming patch. Thanks for pointing it out!
Djinn  [author] 15 Jun @ 11:54pm 
@Exacerangutan Glad you're enjoying the mod! There are only two reasons I didn't consider weapons:

1- I didn’t feel the need for it in my own games, so I didn’t think to include it. Since pawns remember their weapons, I never saw a strong need to "mark" them as owned. It feels like an extra calculation that doesn’t add much value. There are very few cases where it would actually matter. (Since pawns don’t auto-arm by default, there’s no real risk of them accidentally taking someone else's weapon.).

2- There are already several older mods that handle auto-rearming (some for years), and I’d need to account for them, almost certainly causing conflicts. Weapons are more micro-managed than apparel, so adding ownership wouldn’t provide much benefit relative to the extra performance cost. I might be wrong, of course.
Djinn  [author] 15 Jun @ 11:54pm 
@Acc Original That’s probably a bad explanation on my part. The higher the value is, the easier it is for what it injects to be overridden by other mods (or it may not account for additions from other mods), so it's better for it to be closer to the end. But...at the same time, it should be higher if you want other mods that affect storage sorting to inject what I already inject. Sadly mods ordering is always a game of balance, so you'll have to place it where it works best :P. As a rule of thumb: after mods that add new apparel and new storages, before mods that "inject" the functions of sorting in storages. Worse case you'd notice that it won't work correctly, but it won't break a game if you misplace it.
Dima 🥔 15 Jun @ 6:40pm 
Hi Djinn. It seems mod doesn't fully prevent pawns from trying to wear apparel owned by someone else, so after some time they put themselves into loop of doing it instead of some useful work or even sleeping. Will not die to hunger though.

To reproduce:
Start dev quicktest map, drop all apparel from pawns and assign it all to one of them, unforbid, put stockpile zone around, switch to max speed and wait. After some time owner will put on something, and two other pawns will try too.


Latest Rimworld 1.5.
Modlist: Harmony, Core, Apparel Ownership

Job from debug menu:
Wear (Job_1488) A = Thing_Apparel_Pants749 Giver = JobGiver_OptimizeApparel [workGiverDef: null]