The original code from brave-new-world/scenarios/bnw/control is:
-- where player = game.players[event.player_index]
-- where name = player.cursor_stack.name, count = player.cursor_stack.count
function itemCountAllowed(name, count, player)
local item = game.item_prototypes[name]
local place_type = item.place_result and item.place_result.type
if ...
-- some code here
elseif string.match(name, ".module.") then
-- allow modules
return count
-- some codes here
end
return 0
end
The example code from pyalienlife/prototypes/items/items is:
-- This module can only be use in sap-extractor
ITEM {
type = "module",
name = "tree-mk01",
category = "tree",
tier = 1,
subgroup = "py-alienlife-modules",
effect = { speed = {bonus = 0.4}},
limitation = alien_life_limitations_tree
}
thx