Equipment items using ammo

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1698
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Equipment items using ammo

Post by Pi-C »

My mod Autodrive allows to automatically refuel vehicles and refill their ammo slots. When it is refueling vehicles, it also tries to refuel equipment items in the vehicle grid.

I know that LuaEquipmentPrototype can have attack_parameters if the equipment is an ActiveDefenseEquipmentPrototype. I suppose it would be possible to create an ActiveDefenseEquipmentPrototype that consumes ammo. Therefore, it seems I should also try to refill the ammo slots of equipment items.

However, this comes with some overhead (keeping track of what ammo items can be used with equipment, checking whether its ammo inventory is empty, looking for usable items in the trunk inventory, and actually refilling the ammo inventory) which I'd like to avoid if it isn't really needed. While there is precedence for equipment running on fuel (e.g. from IR3), I haven't seen yet any mods that create ammo-consuming ActiveDefenseEquipment. But if no such equipment items exist, running the code for refilling the ammo of equipment items is unnecessary.

Do you know any mods that provide equipment items which need ammo?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Bilka
Factorio Staff
Factorio Staff
Posts: 3218
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Equipment items using ammo

Post by Bilka »

I see no inventory related methods on the ActiveDefenseEquipment class, so I doubt that it can have an ammo inventory.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1698
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Equipment items using ammo

Post by Pi-C »

Thank you, that sounds reasonable! So I can save myself the trouble to add reloading of equipment. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding discussion”