Request: Add LuaEntityPrototype.ammo_category to turrets

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
gangerM
Burner Inserter
Burner Inserter
Posts: 18
Joined: Thu Nov 28, 2024 5:32 pm
Contact:

Request: Add LuaEntityPrototype.ammo_category to turrets

Post by gangerM »

Hello,

Currently ammo_category only works for landmines, for now I made a map from name of entity to turret type, however this is not scalable to other mods;
  • Rocket turret and Gun turret both have the type ammo-turret and therefore need to look at the name.
  • You cannot split the "gun" part of gun-turret name because the ammo type is "bullet"; string.match(CopyFromName, "(%a+)%-turret")
Would it be possible to add LuaEntityPrototype.ammo_category for all turret types?
https://lua-api.factorio.com/latest/cla ... o_category

If there is another way to get it and have overlooked it please let me know as well.
curiosity
Filter Inserter
Filter Inserter
Posts: 587
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Request: Add LuaEntityPrototype.ammo_category to turrets

Post by curiosity »

Yes, you have: https://lua-api.factorio.com/latest/cla ... parameters
It helps to check the prototype docs and see how it was specified to begin with.
User avatar
gangerM
Burner Inserter
Burner Inserter
Posts: 18
Joined: Thu Nov 28, 2024 5:32 pm
Contact:

Re: Request: Add LuaEntityPrototype.ammo_category to turrets

Post by gangerM »

Thank you for letting me know, I definitely overlooked that.
I am looking through the 3 doc types (prototype, runtime and auxiliary) but sometimes it is difficult to determine where it is, appreciate your help!
curiosity
Filter Inserter
Filter Inserter
Posts: 587
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Request: Add LuaEntityPrototype.ammo_category to turrets

Post by curiosity »

You can also check the actual code defining the prototype.
User avatar
gangerM
Burner Inserter
Burner Inserter
Posts: 18
Joined: Thu Nov 28, 2024 5:32 pm
Contact:

Re: Request: Add LuaEntityPrototype.ammo_category to turrets

Post by gangerM »

I did not realize this as well and is very useful!
Thank you again!
Post Reply

Return to “Modding interface requests”