Code: Select all
crafting_speed_quality_modifier = { ["uncommon"] = 2, ["rare"] = 3, ["epic"] = 4, ["legendary"] = 6 }I can counter this by instead implementing those quality values in data-final-fixes, with code looking something like:
Code: Select all
for k, v in pairs(data.raw.quality) do
kwality_values[k] = v.level
end1) The quality values now have to be implemented distant from the rest of the prototype, which feels messy.
2) If hypothetical user Markus64 (who I don't know exists) is a psychopath who added their qualities in data-final-fixes (I'm sure they had their reasons), my mod may or may not notice depending on how mod load order works out. The possibility just gives me some unpleasant background anxiety.
I think it would save a lot of headache if I had some way to define quality values according to quality level, rather than prototype name.
My simplest, hackiest idea for doing this would be to have QualityID interpreted as referring to level if the string is formatted a particular way, or matches some reserves keyword(s). So, for example:
Code: Select all
crafting_speed_quality_modifier = {
["Xx_scale-with-level_xX"] = "1 + L", -- a MathExpression where L = QualityPrototype.level, generically works even for Markus64's 17 new qualities
["####2"] = 17, -- arbitrary override of level 2, that works even for hypothetical "ralphs-secret-rare"
["legendary"] = 6 -- stays constant even if someone mods legendary's level to something else. I assume this kind of case is why quality values were implemented as a dictionary in the first place.
}
