i dont know if you want to have this but i wrote a different combine effects function for your MDlib and then replaced the corresponding snippet in MDpt.lua:
----------------MDlib.lua addition:-----------------------------------
function MDlib.combine_effects_advanced(effects_list)
local bucket = {}
for _, eff in pairs(effects_list) do
for stat, val in pairs(eff) do
if not bucket[stat] then bucket[stat] = {} end
table.insert(bucket[stat], val)
end
end
local final = {}
for stat, values in pairs(bucket) do
local pos_sum = 0
local neg_sum = 0
for _, v in pairs(values) do
if v > 0 then
pos_sum = pos_sum + v
elseif v < 0 then
neg_sum = neg_sum + v
end
end
local penalty_factor = 0.25
if stat == "quality" then
penalty_factor = 0.10
elseif stat == "consumption" or stat == "pollution" then
penalty_factor = 1.0
end
final[stat] = pos_sum + penalty_factor * neg_sum
end
return final
end
----------------------------Change in MDpt.lua:----------------------------------
--this:
local effects_list = {}
for _, vm in pairs(components) do
if drm[vm] and drm[vm].effect then
table.insert(effects_list, drm[vm].effect)
end
end
item.effect = MDlib.combine_effects_advanced(effects_list)
--Replaces this: (line 100+)
for _, vm in pairs(components) do
if drm[vm] then
MDlib.add_module_effect_bonus(item.effect, drm[vm].effect)
end
end
just above
MDlib.multiply_module_effect_bonus(item.effect, efficiency)
return item
This gets pretty "close" to Vanilla combined stats with some losses (in my opinion acceptable since we have multiple "modules" in one module slot.
the goal was to create a method that "preserves" the main idea behind each module and have them stay positive so it can scale with rarity.