Page 1 of 1

Request: Add LuaEntityPrototype.ammo_category to turrets

Posted: Sat Dec 07, 2024 2:04 pm
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.

Re: Request: Add LuaEntityPrototype.ammo_category to turrets

Posted: Sat Dec 07, 2024 2:26 pm
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.

Re: Request: Add LuaEntityPrototype.ammo_category to turrets

Posted: Sat Dec 07, 2024 2:38 pm
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!

Re: Request: Add LuaEntityPrototype.ammo_category to turrets

Posted: Sat Dec 07, 2024 3:27 pm
by curiosity
You can also check the actual code defining the prototype.

Re: Request: Add LuaEntityPrototype.ammo_category to turrets

Posted: Sat Dec 07, 2024 3:39 pm
by gangerM
I did not realize this as well and is very useful!
Thank you again!