local function constructionHandler (fileName, data) local fn = data.updateFn data.updateFn = function(params) result = fn(params) if data.type == "TOWN_BUILDING" and (data.townBuildingParams.landUseType == "RESIDENTIAL") then local ruleCapacity = math.floor(params.capacity / 4 + 0.5) if (ruleCapacity > 0) then result.stocks = {} result.stockRules = {} local cargoTypes = {"MAIL"} local inputs = { { { 1, } }, } for i = 1, 1 do result.stocks[i] = { cargoType = cargoTypes[i], type = "RECEIVING", edges = { }, moreCapacity = ruleCapacity } result.stockRules[i] = { input = inputs[i], output = { { 0, } }, capacity = ruleCapacity } end end end result.cost = 1000 result.bulldozeCost = 100 return result end return data end function data() return { info = { minorVersion = 1, severityAdd = "WARNING", severityRemove = "CRITICAL", name = _("TPF-Addon-Industrie_-_PostMod"), description = _("desc_mod"), tags = { "Industry", "Mail", "Script Mod", "Cargo" }, authors = { { name = "nown", role = "CREATOR", text = "", steamProfile = "", tfnetId = "" }, }, visible = true }, runFn = function (settings) addModifier( "loadConstruction", constructionHandler ) table.insert(game.config.cargotypes, { id = "MAIL", name = _("mail"), weight = 600 } ) table.insert(game.config.cargotypes, { id = "UNSORTED_MAIL", name = _("unsorted_mail"), weight = 600 } ) game.config.industryButton = true end } end