Page 1 of 1

add LuaItemPrototype.limitation

Posted: Sat Apr 30, 2016 10:02 am
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 :)

Re: add LuaItemPrototype.limitation

Posted: Sat Apr 30, 2016 11:54 am
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.

Re: add LuaItemPrototype.limitation

Posted: Sat Apr 30, 2016 12:01 pm
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

Re: add LuaItemPrototype.limitation

Posted: Mon Aug 01, 2016 9:03 am
by daniel34
Implemented in 0.13.12.