Setting inventory filters in prototype definition

Things that we aren't going to implement
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1653
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Setting inventory filters in prototype definition

Post by Pi-C »

I think the title may be a bit misleading, so let me explain in more detail what I want:

Ammo inventories of turrets and vehicles are filtered so that you can only place usable ammo there. For example, in your tank, you can place all of normal/piercing/uranium bullets into the SMG's ammo slot, but not cannon shells or rockets.

I'd like to have something like this for the trunk inventories of type "car" vehicles and, if possible, train wagons. The filters I have in mind have nothing to do like the filters you can now set in train wagons to reserve slots for specific items. Rather, I'd like to be able to define in the prototype that a complete inventory may only be filled with items of a certain type/group.

Reasoning:
There are several mods out there that provide new cars. They may differ in some aspects (different graphics; some are slower but stronger; some have only a few inventory slots, others many; some are equipped with weapons, others not), but basically they are all the same: Install one mod you like and use the new vehicle it provides for just about everything.

I believe that being able to to some inventory filtering would make the game more interesting by giving a serious incentive to use different vehicles for different purposes (perhaps that doesn't matter that much if you're manually driving, but with AAI Programmable Vehicles or Autodrive, it would make sense). Also, it would add a bit more realism to the game. In real life, would you dump a heap of coal into the trunk of your Dodge Challenger? Would you use a dumper truck for transporting sensitive cargo like Processing units? All this is possible now.

Having the ability to filter inventories would allow modders, for example, to limit the dumper truck's inventory to items of the prototype "resource" (bulk ores), the Dodge Challenger's inventory to items of prototype "not resource", and allow this flatbed with tarp covering truck to carry all kind of cargo.

Applying the same context to train wagons would open up new possibilities, too. Perhaps somebody would make special wagons that can only be loaded with bulk goods (to be used with Bulk Rail Loader), or the turret wagons from Armored Train could be set to only accept appropriate ammo.

In my opinion, this feature would add even some more complexity to the game and make it even more interesting. Would you consider adding it, please?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Setting inventory filters in prototype definition

Post by darkfrei »

Items with categories is a nice idea. Filtering by this categories is another good one.

Honktown
Smart Inserter
Smart Inserter
Posts: 1025
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Setting inventory filters in prototype definition

Post by Honktown »

https://wiki.factorio.com/Prototype/Ite ... up_filters

It may be possible to add an item which creates the "rest" of the inventory for a vehicle using that. Set a vehicles trunk inventory to 1, and during the proper event, make sure item is inserted in the inventory, extending it the rest of the way with filters and such. If the item's removed, you can remove it from the player. Not sure if there's a way to make it not-removable by inserters if done this way.

Before I have to go and edit, I may be able to help with something. There was a mod I played in .16, "They're Made out of Meat". It had armor with a fixed, unremovable equipment. The changelog says from version 1.5 to 1.6 the armor was removed because it crashed (version 1.4->1.5 was 16 to 17, so maybe something broke there).

On inventory, the above link says there's an "extends_inventory_by_default" boolean for the prototype item (runtime RW value), but https://wiki.factorio.com/Types/ItemPrototypeFlags also has "can-extend-inventory" as a prototype flag. extends_inventory_by_default says "When true, this item-with-inventory will extend the inventory it sits in..." Does that mean if it's in an equipment grid, the equipment grid would get bigger? That doesn't make sense (would it crash?). There's no vanilla item-with-inventory in data.raw except what looks like a placeholder. Google finds nothing on "can-extend-inventory" except the changelog where it was added. I'm trying to think if it means "this item has an inventory which can be extended" but only testing can be sure.
I have mods! I guess!
Link

Post Reply

Return to “Won't implement”