[1.3] Pawn Rules (v1.5.0): Disallow Foods, Relationships and More

Started by Jaxe, August 05, 2018, 12:38:08 PM

Previous topic - Next topic

Awe

Oh. Dreams come true.

PS Is it really work, or i missed something?

[attachment deleted due to age]

Jaxe

Hmm are those food containers from the RimFridge mod? I haven't tested if those will still apply the rules.

Awe

Yes. Its from RimFridge.
But besides this meals i have some nutrient and simple meals just on the ground. (in like 50 tiles)

Jaxe

I just did a quick test with RimFridge and my test dog refused to eat the lavish, fine all other meals except the simple. I tried forbidding the simple meals and even still the dog refused to eat when starving.

The one possibility is I haven't got a rule check a pawn's inventory, so if he was hauling a fine meal and got hungry on the way there is a chance he could eat it then but I have a feeling that hauling something doesn't count as being in one's inventory so that probably isn't it. The other possibility is he was on the way to eat a fine meal before this mod was added to your game.

If any of these sound like the cause then let me know so I know where to look. Thanks for the feedback.

Awe

None of this. I create default rule to animals. Wait until they are go to sleep and watch their wake up. And nothing changed - they are go as usual to closest source of food - rice, simple meals, fine meals or whatever. Ill try to switch some mods, probably compatibility issues. Tnx for response.

Jaxe

Default rules for animals would only apply to new animals who join you. Animals who were part of your faction before the defaults were set would require manual setting of their presets, which by the looks of it you did so I'm not sure what's happening there as I can't replicate it. I will do some more testing anyway and see what comes up.

Awe

Well, i dont know how this happened. Reassign rules again and now all ok.

Suggestion - please add a way to mass assign/reassign rules. Via mass select, or somewhere in the mod windows "apply to all", "apply to all of this kind" or similar to zoning changes. So its be possible to change diet of different animals or dont suffer if you accidently click on reset at your 100 chickens farm.

Jaxe

Currently a newborn animal will inherit the rules of it's mother. I haven't fully tested if an egg hatches when the mother is dead or scenarios like that. A mass assign option is a good idea I'll work on that sometime.

Mufflamingo

So I created a rule for my prisoners. I forbid fine and lavish meals only simple meals and raw food but my colonists still deliver fine meals to them and the prisoners wont eat and have starvation debuff. One nearly died because I was not attentive enough to see that one prisoner is starving.
Bleeeee. . . . .

superresistant

My pawns eat the chocolate while it is forbidden in the rules.

Canute


Jaxe

Quote from: Mufflamingo on August 12, 2018, 04:42:36 AM
So I created a rule for my prisoners. I forbid fine and lavish meals only simple meals and raw food but my colonists still deliver fine meals to them and the prisoners wont eat and have starvation debuff. One nearly died because I was not attentive enough to see that one prisoner is starving.
I will test out prisoners for the next release. From my testing earlier it worked ok as the method where Pawn Rules comes into play is "BestSourceFoodOnMap" in which a 'getter' will look for the best food for an 'eater'. The eater should be bound by rules so the getter will skip over food sources that an eater is banned from. Be sure the prisoner has the rules applied to them, setting defaults only works for any new prisoners, any you had before the defaults were set will not have those settings.



Quote from: Canute on August 12, 2018, 12:56:29 PM
Maybe they use the chocolate as joy object not as food.

Thanks for pointing that possibility out, I didn't realize a joy need can make a pawn find food. I will look into putting a rule check on that.



I've been working quite solidly on the next update which has so many changes especially in the rules structure. Now an entire set of rules for a pawn can be set to a preset. Also adding in the ability to mass assign rules. Might be a few days before the next update because as always there are unexpected issues but stay tuned and thanks for all the feedback.

superresistant

Quote from: Jaxe on August 12, 2018, 01:30:11 PM


Quote from: Canute on August 12, 2018, 12:56:29 PM
Maybe they use the chocolate as joy object not as food.
Thanks for pointing that possibility out, I didn't realize a joy need can make a pawn find food. I will look into putting a rule check on that.


I've been working quite solidly on the next update which has so many changes especially in the rules structure. Now an entire set of rules for a pawn can be set to a preset. Also adding in the ability to mass assign rules. Might be a few days before the next update because as always there are unexpected issues but stay tuned and thanks for all the feedback.

Yes it must be joy object.

Great can't wait for the next version.

Jaxe

Released version 1.0

- No longer requires HugsLib
- Huge update, the structure of the saved rules has changed from the beta version so if you previously used Pawn Rules Beta in a savegame you should use the "Remove Mod" button first before updating to create a save without the beta version. Skipping this step will result in errors being displayed on the first launch of an old savegame but no issues should occur.
- Rules can now be saved as presets and mass assigned to other pawns of the same type
- Fixed eating chocolate for joy if it was disallowed

xion1088

I used the 0.5 version for a while, did what you said and selected a pawn, went to Global Options, clicked "Remove Mod" game restarted and I loaded up the PawnRules_Removed game, saved again over my OG file, closed the game and installed 1.0 version, now I can't play, my game won't load, kinda fucked up...

Error when loading a game:



Error logs:

QuoteFailed to find RimWorld.WorldObjectDef named PawnRules_Registry. There are 13 defs of this type loaded.
Verse.Log:Error(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:78)
Verse.DefDatabase`1:GetNamed(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\Databases\DefDatabase.cs:166)
PawnRules.Data.Registry:Initialize()
PawnRules.Controller:LoadWorld()
PawnRules.Patch.Verse_Game_FinalizeInit:Postfix()
Verse.Game:FinalizeInit_Patch2(Object)
Verse.Game:LoadGame() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Game\Game.cs:486)
Verse.SavedGameLoaderNow:LoadGameFromSaveFileNow(String) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Map\MapIniter\SavedGameLoaderNow.cs:39)
Verse.Root_Play:<Start>m__0() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root_Play.cs:46)
Verse.LongEventHandler:RunEventFromAnotherThread(Action) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:455)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__1() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:367)

More error logs:

QuoteException from asynchronous event: System.NullReferenceException: Object reference not set to an instance of an object
at PawnRules.Data.Registry.Initialize () <IL 0x0005b, 0x000e7>
at PawnRules.Controller.LoadWorld () <IL 0x00006, 0x00017>
at PawnRules.Patch.Verse_Game_FinalizeInit.Postfix () <IL 0x00000, 0x0000a>
at (wrapper dynamic-method) Verse.Game.FinalizeInit_Patch2 (object) <IL 0x00016, 0x0003a>
at Verse.Game.LoadGame () [0x00254] in C:\Dev\RimWorld\Assets\Scripts\Verse\Game\Game.cs:486
at Verse.SavedGameLoaderNow.LoadGameFromSaveFileNow (string) [0x000a7] in C:\Dev\RimWorld\Assets\Scripts\Verse\Map\MapIniter\SavedGameLoaderNow.cs:39

Verse.Log:Error(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:78)
Verse.LongEventHandler:RunEventFromAnotherThread(Action) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:459)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__1() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:367)