Legendary Quality 4 All


All qualities will now have the same stats as the legendary one

Tweaks
4 months ago
2.0
538
Cheats

g Drills and inserters

4 months ago

This doesn't look like it's applying to inserters and drills. I used this as my first experience with modding. ChatGPT helped.
My guess is that since there is no resource drain value on the normal entities, it never gets adjusted. I don't know about inserters yet.
I got the mining drills to work by adding this to the data.lua file. Now I'm working on inserters.

-- Retrieve the legendary quality from the quality table.
local legendary_quality = data.raw.quality["legendary"]
if not legendary_quality then
error("Legendary quality not found!")
end

-- Get the legendary drain multiplier.
local legendary_drain = legendary_quality.mining_drill_resource_drain_multiplier
if not legendary_drain then
error("Legendary mining_drill_resource_drain_multiplier not defined!")
end


-- Ensure that the "normal" quality (i.e. Common) is defined with the legendary drain.
-- This is important because burner mining drills (and other common devices)
-- default to using the "normal" quality for their resource drain values.


if data.raw.quality["normal"] then
data.raw.quality["normal"].mining_drill_resource_drain_multiplier = legendary_drain
log("Set 'normal' quality drain multiplier to legendary drain: " .. legendary_drain)
else
log("Normal quality not found!")
end


-- Update prototypes for all mining drills.
-- For regular drills we assume a natural drain of 1.0;
-- for the big mining drill, natural drain is 0.5.


for drill_name, drill in pairs(data.raw["mining-drill"] or {}) do
local natural_drain = 1.0
if drill.name == "big-mining-drill" then
natural_drain = 0.5
end
local new_drain = natural_drain * legendary_drain
drill.mining_drill_resource_drain_multiplier = new_drain
log("Set mining drill '" .. drill_name .. "' drain multiplier to " .. tostring(new_drain)
.. " (natural: " .. tostring(natural_drain) .. ", legendary: " .. tostring(legendary_drain) .. ")")
end


-- Update prototypes for all pumpjacks.
-- (Pumpjacks are assumed to have a natural drain of 1.0.)


for pumpjack_name, pumpjack in pairs(data.raw["pumpjack"] or {}) do
local new_drain = 1.0 * legendary_drain
pumpjack.mining_drill_resource_drain_multiplier = new_drain
log("Set pumpjack '" .. pumpjack_name .. "' drain multiplier to " .. tostring(new_drain)
.. " (natural: 1.0, legendary: " .. tostring(legendary_drain) .. ")")
end

4 months ago

I'm definitely in over my head. It seems like the Quality API doesn't expose how qualities are calculated for inserters. So you can't dynamically go out and grab whatever stats are used for legendary inserters. I don't feel like hard coding in the values so I'm taking a break.

4 months ago

Yeah, weird behavior. Seems that processing of stat bonuses for 'normal' quality is hardcoded for some items.
I`ll try to find good solution.

Thx for report!

4 months ago

Good post. Thanks!

4 months ago

Fixed mining-drills, pumpjacks and science-packs in new version (0.1.3).
Still tinkering with inserters.

2 months ago

in this version now the inserters work

New response