Technology Prerequisites

Place to get help with not working mods / modding interface.
Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Technology Prerequisites

Post by TheSAguy »

Is it possible to have a Technology Prerequisites be something besides another tech?

Like a prerequisites Evolution Factor or prerequisites must first kill x aliens or spawners?

Same for entities?
Thanks.

SirRichie
Fast Inserter
Fast Inserter
Posts: 244
Joined: Wed Feb 25, 2015 4:50 pm
Contact:

Re: Technology Prerequisites

Post by SirRichie »

There is no direct support for this, because the prerequisites property of a technology is a table of Lua/Technology (so nothing else). But I think it can be easily emulated [untested]:

Define your technology normally, then when the game inits/loads, disable that technology (.enabled = false).
When your prerequisite is met (which you obviously have to detect), then just set enabled = true. If the other technology prerequisites are met, it can then be researched.

Entities can be made to work like this if you use the same trick on the recipies.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13239
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Technology Prerequisites

Post by Rseding91 »

SirRichie wrote:There is no direct support for this, because the prerequisites property of a technology is a table of Lua/Technology (so nothing else). But I think it can be easily emulated [untested]:

Define your technology normally, then when the game inits/loads, disable that technology (.enabled = false).
When your prerequisite is met (which you obviously have to detect), then just set enabled = true. If the other technology prerequisites are met, it can then be researched.

Entities can be made to work like this if you use the same trick on the recipies.
You'd want to just define the technology so it's not enabled by default: enabled = false in the prototype.
If you want to get ahold of me I'm almost always on Discord.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Technology Prerequisites

Post by TheSAguy »

Hmmm, anyway you guy's could share some code examples showing this?

Thanks for the feedback!

Post Reply

Return to “Modding help”