[B18]PawnMenu v1.3 Ask your pawn to eat specified food first.

Started by temple_wing, May 25, 2018, 07:09:06 AM

Previous topic - Next topic

temple_wing

PawnMenu
Ask your pawn to eat specified food first.



Menuļ¼š
Added a menu tab to human pawn. You can specify some food type. Then if he need some food, he will try to get those you specified types first, then vanilla food searching algorithm.
Also works for food choosing for patients.
So say, you have vegetable garden mod. Then you can specify cheeseburger to patients, simple meal for others. Don't need to worry that other healthy pawns just eat all that cheeseburgers you made for patients.
Menu can be specified "per pawn" or "per kind", default setting mode is "per kind". So you can specify menu for a pawn, then make it works to all pawns of the same kind, eg: human.

100CellsRule:
Animal pawn has a max food search distance of 100. That means if an animal is 100 cells away from your specified food, he will not go to eat your specified food. Theoretically I can rise it to 9999, but I belive it has been set to 100 for performance reason, so I leave it to 100.
This limit is only for animal pawn, human pawn don't have this limit.

Requires HugsLib
https://ludeon.com/forums/index.php?topic=28066.0

Download
github:
https://github.com/jinlan/PawnMenu/releases

Changelog:
v1.3:
Allow separate setting for breakfast and supper. So you can set moving, manipulation bonus food for breakfast and metabolism, blood pumping, breathing bonus food for supper.
Concept of breakfast and supper is actually decided by pawn's rest level not time of day.
v1.2:
Added support to menu setting mode, has 2 modes, per pawn or per kind.
v1.1:
Added support for animals, and any mod that extends "BasePawn".

Does not require a new game.

Umbreon117

Iiinteresting...Two questions.
1: Can it be added to an existing game, and can it be taken off of one?

2: Can I tell them to eat one thing first, then another?
Example: I want Steve the builder to eat Kibble first, then if that's not there I want him to eat Simple meals.
I'll shoot your colonists...After a long nap.

temple_wing

Quote from: Umbreon117 on May 25, 2018, 10:23:57 AM
Iiinteresting...Two questions.
1: Can it be added to an existing game, and can it be taken off of one?

2: Can I tell them to eat one thing first, then another?
Example: I want Steve the builder to eat Kibble first, then if that's not there I want him to eat Simple meals.

1 Does not need to restart a new game.
2 No, currently impossible. I'll try to find a way.

becomeweaker


Ibrahym


Umbreon117

Quote from: temple_wing on May 25, 2018, 10:53:01 AM
Quote from: Umbreon117 on May 25, 2018, 10:23:57 AM
Iiinteresting...Two questions.
1: Can it be added to an existing game, and can it be taken off of one?

2: Can I tell them to eat one thing first, then another?
Example: I want Steve the builder to eat Kibble first, then if that's not there I want him to eat Simple meals.

1 Does not need to restart a new game.
2 No, currently impossible. I'll try to find a way.
Thanks. 2 was actually done in a different mod IIRC, but I forgot the mod's name.
I'll shoot your colonists...After a long nap.

Kori


temple_wing

Quote from: Kori on May 25, 2018, 02:55:04 PM
Can you add a workshop version, please? :)

Could you please help me upload this mod to workshop? I can't connect to steamcommunity.com

user19990313

That's quite a good idea, a lite version of WM food selection.
Well I suggest you maintain a static Dictionary<Pawn, Settings> to store food settings instead of a CompPawnMenu, because TryGetComp<>() and so are implemented using linear search (O(n)), and it's likely that players may only adjust food settings for part of the colonists and may never do so on animals/visitors/irrelevant pawns. Then you get faster access to settings, better performance per tick and can use less storage in saves. (You don't wanna see everyone disable your mod because "it's laggy in the long run", right?)
If you're even more aggressive like me, spend some memory to create a reverse-lookup (Dictionary<ThingDef, Pawn>) and query it in food selection function instead of the vanilla ThingFilter.Allows(), which significantly improves the performance. Check StuffFilter for those details.

BTW If you're looking for CN download, search in tieba.baidu.com using the mod name as the keyword, or simply check this. Strongly suggest you use RuntimeGC XD

temple_wing


Kori

Quote from: temple_wing on May 26, 2018, 02:32:02 AM
Quote from: Kori on May 25, 2018, 02:55:04 PM
Can you add a workshop version, please? :)

Could you please help me upload this mod to workshop? I can't connect to steamcommunity.com

How can I help?
Do you get an error in the client?

Drakuv

Quote from: temple_wing on May 25, 2018, 10:53:01 AM
Quote from: Umbreon117 on May 25, 2018, 10:23:57 AM
Iiinteresting...Two questions.
1: Can it be added to an existing game, and can it be taken off of one?

2: Can I tell them to eat one thing first, then another?
Example: I want Steve the builder to eat Kibble first, then if that's not there I want him to eat Simple meals.

1 Does not need to restart a new game.
2 No, currently impossible. I'll try to find a way.

For 2 couldn't you do something like the work tab? have the order be selected by numbers

Kori

Hey temple_wing,

whenever I set food preferences for my pawns it wasn't saved, so the next time I started the game and loaded my save, all the settings were gone.
That was a few mod versions ago and I wasn't able to test the newer versions yet. Have you been able to fix it in the meantime?

temple_wing

Quote from: Kori on June 12, 2018, 11:12:37 AM
Hey temple_wing,

whenever I set food preferences for my pawns it wasn't saved, so the next time I started the game and loaded my save, all the settings were gone.
That was a few mod versions ago and I wasn't able to test the newer versions yet. Have you been able to fix it in the meantime?

Update to newest version.