Add ammo_category to game.item_prototypes

Post Reply
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Add ammo_category to game.item_prototypes

Post by Adil »

Well, what the title says.

Knowing group of ammo my be useful for realisation of different transfrormations and transitions between groups.

I currently have the mod, which needs to know ammo category in order to procedurally provide compatibility for other mods which add custom ammunition.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Add ammo_category to game.item_prototypes

Post by bobingabout »

Yeah, when talking about data.raw, an ammo type item is of type ammo instead of item, which makes detecting ammo and it's type easy.

but when you get into the game and are using game.item_prototypes to look for item types to make scripts, that dynamically add in items from other mods, this because a whole other story. there is no way to detect what is an ammo type, or what type of ammo it is.

so.... in short, I agree, I think the whole game.item_prototypes thing in inadequate, you really need a system that is capable of presenting all the information that would be accessable via data.raw ingame.

In fact, I'd sugest re-designing the way the whole thing works, and present the modder with a bigger option, perhaps game.prototypes. should allow read-only access to all data.raw entries, so when a modder needs to find such a thing he can scan game.prototypes.ammo and scan through the ammo types for ammo catagory.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Add ammo_category to game.item_prototypes

Post by Rseding91 »

Doesn't prototype.type == "ammo" work for checking if a item prototype is ammo? As for the category - that would be useful and i'll add that for 0.13.
If you want to get ahold of me I'm almost always on Discord.

curiosity
Filter Inserter
Filter Inserter
Posts: 325
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Add ammo_category to game.item_prototypes

Post by curiosity »

LuaGameScript::ammo_category_prototypes has been added and LuaGameScript::get_filtered_item_prototypes allows getting prototypes of a given type. The thread can be moved to implemented requests now.

Post Reply

Return to “Implemented mod requests”