I have question [get_inventory]

Place to get help with not working mods / modding interface.
Post Reply
sore68
Fast Inserter
Fast Inserter
Posts: 123
Joined: Mon May 02, 2016 8:39 am
Contact:

I have question [get_inventory]

Post by sore68 »

I would like to know how to work with next example.
I making some turrets and one of them combined rocket and cannon turret


1. make a ammo chest
2. Insert Items
3. if not ammo, not insert / if ammo, insert

I think get chest inventory entity and if if... end end.
But have a problem! ammo entity name is too many.
So try to classified into categories.

Unfortunately I can't search that code..
Do you know how I get ammo category(bullet/ shotgun-shell/ cannon-shell/ rocket/ capsule/ ...) in ammo chest???

Or selected entity name only?

sore68
Fast Inserter
Fast Inserter
Posts: 123
Joined: Mon May 02, 2016 8:39 am
Contact:

Re: I have question [get_inventory]

Post by sore68 »

Code: Select all

/c
for name, item in pairs(game.item_prototypes) do
	if item.type == "ammo" then
		game.player.print("name : " .. name)
	end
end
I see that :)

Post Reply

Return to “Modding help”