[1.0] Auto Caravan Equip (Autoseller Extension) - (v1.0.0.8) (29-06-2019)

Started by Supes, August 21, 2018, 01:16:04 PM

Previous topic - Next topic

Supes

This mod adds the ability to Auto Select Personnel and Items when forming a caravan.  As with other extensions, be sure to check the first two videos of AutoSeller for how the filters work

Each time you create a caravan, you select who you want, what food, and what items you want to sell at another colony.  a lot of these selected items repeat each time, don't you wish there was some way you could automate a large part of this selection.

Additional Info

Caravan forming using Auto Caravan Equip is done using a set of Rules, these rules are separated into three groups that run at different times, Global, Per Personnel and Late Global.  Use the conform to type button to help.

Global

If your rule is of type Global (not to be mistaken for Late Global), then it will change the quantities of the caravan before the Caravan Form window even shows.  This is ideal for setting things like Personnel to take.  To make a Global type, leave the Apply to Personnel root blank and make sure Process Last is unchecked.

Per Personnel

if your rule is of type Per Personnel, then it changes quantities after you select your route, then it checks the Personnel Root against who has already been set by a Global Type and multiplies by the number of who you take, this is excellent for setting food to take (be sure to set a waypoint back to base for the return journey) or if a certain person needs to take drugs with them.  Per Personnel is the only type that can use the Days or Route Days options.  To make a Per Personnel type, you just have to set the Apply to Personnel Root to check for who this rule applies to.

Late Global

Similar to Global, but this changes quantities after you set the route, this is more useful for setting items you wish to take to sell, or things you need to take each time.  To make a Late Global type, leave the Apply to Personnel root blank and make sure Process Last is checked

Download Links

https://steamcommunity.com/sharedfiles/filedetails/?id=1487284611

https://github.com/SupesSolutions/RWAutoCaravanEquip

How to install

This mod requires AutoSeller 2.0.3.6 or greater installed, and should be loaded after AutoSeller
Unzip the contents and place them in your RimWorld/Mods folder.
Activate the mod in the mod menu in the game.

Change Log
1.0.0.8
Preset changes
Colonist Inventory filter

1.0.0.7
updated preset/chain code
fixed issue mixing prefix and select presets

1.0.0.6
Added Diet Filter (Grazer)

1.0.0.5
updated for chain compatibility
presets activate/deactivate needed chains

1.0.0.4
Added Wizardry stuff

1.0.0.2
Added Equipped Armour Filter
updated for 1.0

1.0.0.1
Added Equipped Weapon Filter

Future Plans

Currently it Skips once it goes over Max Mass Capacity, but I plan to change it later so it restricts it to stop just below Max Mass capacity (like the trade rules do with the Allow Partial Trades option)

I will create a video to demonstrate the different types at some point.

I have a few other things to touch up, like the label that shows the current type doesn't differentiate between global and late global.

Xubrim

I was just complaining how annoying it gets to select the exact same bedrolls, quantities of specific medicine types, and modded caravan items every time I wanted to free up some stockpile space. The mod appears to work perfect.

Cheers. :)

dr33mz33

This is very nice and powerful! Thank you. It took me a while to figure out all the functions though. Also, if you try to set quantity before touching the filters it seems to block them. That might be a bit counterintuitive for some people. I'm still using the b19 version though.

Supes

no worries, with the exception of an additional filter, B19 and 1.0 versions are essentially the same.

do you mean during editing/creating a rule? or setting quantities on the form caravan page?

dr33mz33

It only happens when, while creating a rule, you hit Esc and cancel a filter you are currently setting. In that instance, I have to close the window and try to create the rule again for the filter window  to work again. But it is such a small thing I'm not bothered at all. Also maybe others do not experience this, doesn't matter all that much tbh. Thanks again!

Supes


Supes


mitasamodel

Hello Supes!

Just found this caravan extension. Extremely nice thing! Thanks!

One question to clarify. The rule "Apply to Personnel" works only with animals and pawns? It doesn't work with items or weapons, right?
I'm playing around with this rule and trying to automatically load the ammo for weapons, which colonists equip (CE mod). It doesn't work though. Workaround is to define the exact ammo for exact colonist (predefine which weapon he will take). But would be nice to make it "fully-automatic".
The second complicated thing is that this weapon is equipped, not just taken with in inventory. Hmm.

P.S. Just noticed the update for "Auto Seller" itself. Will check out the new feature, thanks! :)
P.P.S. Would be nice to be able to copy/paste and/or duplicate the rules (and chains), not only the groups.

====
Update
And one more question.
Can I create single rule to pick up 20 beer and 20 chocolates? Unfortunately I can't do it: have to create 2 separate rules.
Thanks.

Supes

apply to personnel acts as a multiplier based on the number of pawns it returns.  If you know which weapon requires what ammo, you could use the Equipped Weapon filter (place in the apply to personnel root), which checks if a pawn is holding a certain weapon, then use the specific ammo type in a category filter placed in the main Caravan root.

atm yes, it would require 2 rules for 20 chocolate and 20 beer.

mitasamodel

Quote from: Supes on June 23, 2019, 04:03:07 PM
apply to personnel acts as a multiplier based on the number of pawns it returns.  If you know which weapon requires what ammo, you could use the Equipped Weapon filter (place in the apply to personnel root), which checks if a pawn is holding a certain weapon, then use the specific ammo type in a category filter placed in the main Caravan root.
Yeah, it works well!
Unfortunately it doesn't work with side-arms (if there is backup weapon in the inventory). The backup weapons are used intensively due to CE (again it :) ).

Quote from: Supes on June 23, 2019, 04:03:07 PM
atm yes, it would require 2 rules for 20 chocolate and 20 beer.
Got it! Thanks.
No way there will be "Treat Defs as Separate" in the future?


Aaand one more thing. UI bug. If there are too many rules and I add the new one, then the scroll line disappear:


I have to collapse the chain and expand it again to get scroll lines back:

Supes

Quote from: mitasamodel on June 23, 2019, 04:55:28 PM
No way there will be "Treat Defs as Separate" in the future?

it could be added.

I'll look into the other stuff, I'll probably need to add a new filter, and thanks for the bug report on the UI (it's nice to see the chains and presets being used as well)

mitasamodel

Quote from: Supes on June 23, 2019, 05:48:57 PM
it could be added.
Nice!

Quote from: Supes on June 23, 2019, 05:48:57 PM
<...>I'll probably need to add a new filter <...>
Hmm, it seems to be very complicated complex filter. Of course it can just looks what kind of items are present in the caravan inventory (or planned to be added to inventory), but it is a bit different. There may be weapons, which are going to be added to caravan but for sale purposes. Soo... It should check only what kind of weapons have the colonists right now, I guess?
Either way, thanks for looking and making the improvements!

Quote from: Supes on June 23, 2019, 05:48:57 PM
<...>and thanks for the bug report on the UI (it's nice to see the chains and presets being used as well)
I'm using the chains very intensively. Mainly for 2 purposes:
1. Selling firstly the "garbage" staff and then the "extra" (I'm producing some extra apparel for selling). Works perfect!


2. Loading the caravan with these exact things.

Oh, actually, I just remember one more thing. Not sure if it is bug or I made it wrong.
I'm using "Activate" button to check what kind of Preset will be applied ("Select Preset on Form Caravan" is checked as well). I noticed that the chains are not applied:


But if I uncheck "Default New to Inactive" then both chains are activated even the "Ambush" should not do that (it is in "Inactive" column):


With the "normal" rules (not chains) everything as expected.

Aand one more question about "prefix" and this window altogether. I read the info about prefixes somewhere, but now I can not find where exactly. I start to use these prefixes (very useful) but lost the location of docs =)
== Update
Found: Steam

Supes

for presets and chains, if a nested rule in a chain and has a prefix, it will enable the nested rule and chain (Contains should do the same).

but you're right about the 'select' option not applying to chains (my fault, forgot to code that bit).  because the nested rules don't show in the list, when it reaches the chain, it skips into the nested rules to check their description, but of course they were never made available to select so they never get activated (Don't worry, I will sort that).

edit: prefixes are anything in the description before a colon.  a rule can have multiple prefixes by separating them with a comma or semi-colon, very handy if you want the same rule to apply to more than one preset.

Supes

made an update (both the core AutoSeller mod (scrollbar is controlled by core) and AutoCaravanEquip have been updated) so I've added an option to control how presets are applied to chains (top down or bottom up basically).

Activate from top: this will check the top level of the chain only, and enable if required (current behaviour)
Activate all from first: this will check just the chain itself and not the child rules, if the chain matches the preset, it will enable all child rules in the chain.

also spotted that selected was being blocked by prefixes, so sorted that aswell

mitasamodel

Quote from: Supes on June 25, 2019, 01:01:36 AM
made an update (both the core AutoSeller mod (scrollbar is controlled by core) and AutoCaravanEquip have been updated)
<...>
also spotted that selected was being blocked by prefixes, so sorted that aswell
Nice, thanks!

Quote from: Supes on June 25, 2019, 01:01:36 AM
Activate from top: this will check the top level of the chain only, and enable if required (current behaviour)
Activate all from first: this will check just the chain itself and not the child rules, if the chain matches the preset, it will enable all child rules in the chain.
I spent ~10 seconds trying to figure out what is the difference (thought that "top" level is the chain itself and all of the rules are the "bottom") but then realized, that there could be chains in the chains! Now everything is clear, one more feature revealed :) Cool.

I guess, there should be one small decorative fix:

If "Prefix" or "Contains" selected, then the arrows should be hidden.

Aand I will combine the "feature request" just to make them at single place


1. Copy / Paste the rules and chain
It's not that critical due to ability to copy/paste the groups, but will be time saving either way.


2. Swap prefix behaviour (or allow both).
Right now the location of prefix definition is the rule. And then we can choose all of the rules with specific prefix in the preset.
I think it would be better to make it wise versa (or allow both): in the preset as filter could be typed more than one prefix using the same mechanism (comma or semi-colon).

For the rule the prefix will become a "type". And in preset you will choose what "types" of the rules should be included to the preset.

Why?
What is the standard behaviour now: I decided to make the new caravan type (trade, mine, attack, quest, etc.). I start to create the rules for it, say "Ambush" chain.


Then I decided to create another type of caravan. Say "Trade". But it is clear that some of the rules from "Ambush" could be easily used and for "Trade" too. So, I add one more prefix to these rules.


Now the "Trade" preset will be OK.
Then I want to manage one more caravan type... Soo.. Change the names for the rules (add one more prefix).
If we are talking about 1,2,3... 10 rules, then it is not very cool, but OK. And it works perfect, btw :)

But behaviour with my suggestion (allow to have multiple prefixes in preset string) is different:
I create the rule and as "prefix" write the type of this rule (or chain of rules):


And then I can combine these rules quickly and easy in preset windows.
New caravan for trade? - Ok, in preset will be "Supply; Caravan-500; Car-1", where "Car-1" is specific chain for this exact caravan (colonists, for example) but "Supply" and "Caravan-500" are general chains.

For "Ambush" caravan in will be then "Supply; Ambush".
And so on. So, this mechanism will allow to create new presets of caravans very-very quickly.

But the question is if it is not that hard to implement. =)


3. Filter to find pawns with *things* in inventory
Similar to "Equipped" filter, but works with inventory instead.


4. Input parameters for filter-search (not for the result)

I think you can guess what I tried to do, and it doesn't work (as expected though) =)
I wanted to return the pawns, which don't have T9 as weapon and have (P7) OR (USAS and Specific_Quality).
Soo, what will be interesting, is to have as *input_data* for filter in the group "Equiped USAS" the things, which are returned by group "Quality".

But I understand pretty good, that it is not how this filter/group system works. It's a bit different.
Right now the result of "Quality" conjucted (AND) with result of "Equiped USAS". And of course it is different.

It is for both mods, btw.
//sry for mistakes in English


5. Something similar to "Treat Defs as Separate" to equip caravan

So, take 50 of each thing in the filter.


6. Remove items from "category" filter by double-clicking on them (or right mouse and then "delete").


Would be nice to be able to remove item from filter by using the list in the bottom. Double click or right mouse click and then "remove" will be nice.
Additionally, would totally cool to click on the item from this list and the focus will automatically change in the top list to the location of this item.
Let's suppose it happened:

It is for both mods, btw.


7. Small inconvenience: the typing of name for the rule has halted
It happens when you open the rule (or create new one) and start to type it name ("Rule Description").
It is halted because appear the sign to revert the changes. Could it appear without halting the typing? =)



Fuuf. Seems to be all to this moment =) Just the things, which I think could be improved, modified, fixed.
Of course, I'm not waiting that you are going to make all of these. Just suggestions (=

=== Update
An example of combinations of all these changes (if they occur):
1. Preset Window
As one of the prefixes the "Ammo" is selected (multiple prefixes in presets)
2. Chain "Ammo" contain rules for all of the weapons types
3. In these rules are checks if this weapon equipped or hauled (inventory) by colonist (new filter for inventory check)
4. If yes, then the list of different ammo will be added to caravan (Treat Defs as Separate)

=== Update 2
Suggestion 8. Chain rule limits the weight
So, add the limit for weight for chain rule. The caravan will be loaded with items from the chain but only untill the limit for this chain is not exceeded.
P.S. I see that you want to do with weight altogether...