Entity accepting items

Place to get help with not working mods / modding interface.
Post Reply
Theudas
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Oct 31, 2016 11:08 am
Contact:

Entity accepting items

Post by Theudas »

I am currently working on my first mod idea and i ran into several factorio related issues.

I want to make a building, that accepts resources and grants an global effect in return.

1. Which prototype can I use for my entity?
I think it needs an inventory?
2. How do i set the items my entity accepts?

I spent 2 hours looking through the Wiki and the Lua api documentation and have still no idea, the tutorial is great though.

apriori
Filter Inserter
Filter Inserter
Posts: 259
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Re: Entity accepting items

Post by apriori »

Maybe an assembler?
1. Create special recipe category.
2. Use an assembler prototype that can craft recipes of this special category.
3. Create recipes of this category.
Now your entity can accept defined resources at the defined amount.

entity.operable = false -- to prevent changing currently crafted recipe
entity.recipe = your_recipe -- in on_built_entity to automatically assign your recipe
recipe.enabled = false -- to prevent players to use this your_recipe
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Entity accepting items

Post by aubergine18 »

> entity.operable = false -- to prevent changing currently crafted recipe

It would be better to use the fixed_recipe prototype property - similar to how the water pumpjack works: https://mods.factorio.com/mods/binbinhfr/WaterWell
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Entity accepting items

Post by darkfrei »

aubergine18 wrote:> entity.operable = false -- to prevent changing currently crafted recipe

It would be better to use the fixed_recipe prototype property - similar to how the water pumpjack works: https://mods.factorio.com/mods/binbinhfr/WaterWell
How to choose the recipe automatically , like furnaces?

apriori
Filter Inserter
Filter Inserter
Posts: 259
Joined: Thu Feb 18, 2016 8:13 pm
Contact:

Re: Entity accepting items

Post by apriori »

Fixed_recipe = your_recipe - in entity's prototype. See prototype of rocket silo in Factorio -> Base folder.
Any code or mods posted by me are WTFPL, unless otherwise copyrights are specified.

Post Reply

Return to “Modding help”