add LuaItemPrototype.limitation

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

add LuaItemPrototype.limitation

Post by Choumiko »

Make the allowed recipes for modules with productivity effect accessible from control.lua via LuaItemPrototype (like LuaItemPrototype.module_effects)
Right now you have to create a fake technology with allowed recipes as unlocks to access them ingame, which is quite ugly :)
Rseding91
Factorio Staff
Factorio Staff
Posts: 15997
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: add LuaItemPrototype.limitation

Post by Rseding91 »

Right now nothing about recipes is mutable runtime (not even on the C++ side). There are plans to allow that but it's probably not going to be done in 0.13. Once that's done this kind of change will be possible but until then it will have to wait.
If you want to get ahold of me I'm almost always on Discord.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: add LuaItemPrototype.limitation

Post by Choumiko »

What i mean is read access in control.lua to what data/base/prototypes/item/module.lua adds to modules:

Code: Select all

type = "module",
    name = "productivity-module",
    icon = "__base__/graphics/icons/productivity-module.png",
    flags = {"goes-to-main-inventory"},
    subgroup = "module",
    order = "c[productivity]-a[productivity-module-1]",
    stack_size = 50,
    default_request_amount = 10,
    effect = { productivity = {bonus = 0.04}, consumption = {bonus = 0.4}, pollution = {bonus = 0.3}, speed = {bonus = -0.15}}, -- <---- read access is already available via LuaItemPrototype.module_efffects
    limitation = productivitymodulelimitation(), -- <---- this here
    limitation_message_key = "production-module-usable-only-on-intermediates"
Basically it would allow a script to check whether a module can be inserted in an assembler with a specific recipe
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: add LuaItemPrototype.limitation

Post by daniel34 »

Implemented in 0.13.12.
quick links: log file | graphical issues | wiki
Post Reply

Return to “Implemented mod requests”