[Rseding91] [2.0.28] Quality % wrong when normal quality's level changes

This subforum contains all the issues which we already resolved.
dominis
Manual Inserter
Manual Inserter
Posts: 3
Joined: Thu Oct 18, 2018 3:57 pm
Contact:

[Rseding91] [2.0.28] Quality % wrong when normal quality's level changes

Post by dominis »

Code: Select all

local function rewrite_quality ()
  local order = { 'normal', 'uncommon', 'rare', 'epic', 'legendary' }
  local level = { 0, 1, 4, 16, 64 }
  for idx, rarity in ipairs(order) do
    if data.raw.quality[rarity] and not data.raw.quality[rarity].qml_ignore then
      data.raw.quality[rarity].level = 64 -- idx - 1
      data.raw.quality[rarity].next_probability = (0.4 - (idx - 1) / 100) ^ idx
    end
  end
end

local function rewrite_crafters ()
  local archetypes = { 'assembling-machine', 'furnace', 'mining-drill' }
  for _, archetype in ipairs(archetypes) do
    for _, entity in pairs(data.raw[archetype]) do
      if not entity.qml_ignore then
        if not entity['effect_receiver'] then
          entity['effect_receiver'] = {}
        end
        if not entity['effect_receiver']['base_effect'] then
          entity['effect_receiver']['base_effect'] = {}
        end
        if not entity['effect_receiver']['base_effect']['quality'] then
          entity['effect_receiver']['base_effect']['quality'] = 0
        end
        entity['effect_receiver']['base_effect']['quality'] = 0.2 -- math.max(entity['effect_receiver']['base_effect']['quality'], 0.01)
      end
    end
  end
end
It says it has ~61.44% quality but the observed effects are for ~61.44%/20.2 (removed level effects). All changes applied in data-final-fixes.lua. The yellow square symbol is all items at (n+1) quality or higher. Check mark is the total crafts. info symbol is quotient of check/square.

Also, shouldn't the docs say quality is multiplied by next_probability not divided by 10?
Attachments
Screenshot 2025-01-03 064928.png
Screenshot 2025-01-03 064928.png (23.69 KiB) Viewed 548 times
Screenshot 2025-01-03 064901.png
Screenshot 2025-01-03 064901.png (83.9 KiB) Viewed 548 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 15464
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] [2.0.28] Quality % wrong when normal quality's level changes

Post by Rseding91 »

Thanks for the report. The tooltip is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”