simplyWiri / Loadout-Compositing

GNU Lesser General Public License v3.0
12 stars 8 forks source link

Feature: Pawn AI and Behaviour Additions #31

Open simplyWiri opened 2 years ago

simplyWiri commented 2 years ago

Impetus

With the ability to add gear to pawns, comes the desire for the pawns to better utilise the things they are holding.

List of ideal features:

Danny-Alexander commented 2 years ago

There are existing mods to do these things. Not sure how well they work, but I would assume if a pawn is holding the associated item their alterations to the AI will have them use it.

Build from inventory Smart Medicine

I wonder if it would not be preferable to keep these features as separate mods and this purely loadout and inventory management anyway. Wouldn't that maximise compatibility, maintainability and minimise bloat, flexibility etc by allowing people to customise AI and inventory management independently?

simplyWiri commented 2 years ago

The idea is a longer term one. These would all be entirely optional, and you would be able to disable them if you wanted. They just make sense to be packaged in a mod which allows you to take advantage of your pawns inventory.

Having this functionality elsewhere relies on mods adding their own inventory management (quite prone to bugs, like PUAH, Smart Medicine, Awesome Inventory job loops / reservation errs), or it is just inert because you can't take advantage of it.

Danny-Alexander commented 2 years ago

I like the idea.

I had some job loops with this and Smart Medicine I suspect.

That's what makes me think it makes sense to have 1 universal inventory system. Something mods like PUAH or Simple Sidearms and (this mod too) can interface with to specify how to handle stuff they pickup if there's any special conditions (so other mods don't interfere or misuse those items).

Kind of like the alien races library that other mods use, but rather to access inventory, or that animal gear library that other mods use to implement animal armor.

Maybe that's not practical or within the scope of what you're planning.

I didn't completely understand what you meant about having the functionality elsewhere requiring mods to add their own inventory management. Might be talking about different things.

What's the problem with AI altering mods which make pawns use what they're carrying (medicine, construction) require a separate mod to stock a pawns inventory?

Can show a message if no stocking mods are present. By separating the functionality (stocking & using) it adds the possibility to choose how either is done without loading stuff that's not used. Also, aren't smaller projects with more distinct focused scope and purpose less error prone?

simplyWiri commented 2 years ago

Pawns have an inventory in vanilla, so to speak, but it is only used for caravans. Which means all mods which utilise it must add the ability for pawns to equip items etc. This means everyone writes their own system for picking up / removing excess items, and unfortunately these don't co-exist (well) by default.

Mods like PUAH which try to be clever (or like this) tend to have issues because we track items in a pawns inventory, I think I get away with it because I only check items which exist in a pawns tags, which is to say, it is more clever than a naive solution, but you can still end up with pawns with inventories which slowly fill up.

Compositable Loadouts is relatively simple, because there are only 2 (arguably 1) place where I actually touch pawn AI.

tldr:

Danny-Alexander commented 2 years ago

That's basically what I expected.

Why would an inventory access framework would need to be vanilla? Seems pretty easy to update mods (by authors or others) or possibly override them (and vanilla) to use a slightly different interface/framework.

I get your not interested in working on an inventory access framework/interface mod (beyond the scope of this mod) and this is off topic. I'll just share my thoughts on it as food for thought - I'm not trying to say you or anyone should do this, just that I think this or something similar is needed to prevent the mess we have now.

At the most basic it could be

Item have properties:

These might be useful optional properties for items

Good luck with this mod, is already very useful & I love your approach with tags - very neat.

simplyWiri commented 2 years ago

Cheers, I appreciate the ideas, even if purely as food for thought.