[MOD 0.12.x] Multiplied Minables

Topics and discussion about specific mods
Post Reply
Bokrug
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue May 03, 2016 2:57 pm

[MOD 0.12.x] Multiplied Minables

Post by Bokrug » Tue May 03, 2016 8:28 pm

Description:
  • Multiplies the amount of ore received from mining by x2, x5, or x10. Just in case you thought the game was too slow.
    Requested by a redditor and made possible by prg.
Image Image

Details:
  • Name: Multiplied Minables
    Catagory: Convinience
    MOD Version: 0.1.0
    Factorio Version: 0.12.x
    License: MIT
Last edited by Bokrug on Tue May 03, 2016 8:42 pm, edited 2 times in total.

mooklepticon
Fast Inserter
Fast Inserter
Posts: 234
Joined: Wed Mar 02, 2016 10:09 pm

Re: [MOD 0.12.x] Multiplied Minables

Post by mooklepticon » Tue May 03, 2016 8:30 pm

Someone on Reddit was just asking about something like this!

Bokrug
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue May 03, 2016 2:57 pm

Re: [MOD 0.12.x] Multiplied Minables

Post by Bokrug » Tue May 03, 2016 8:38 pm

mooklepticon wrote:Someone on Reddit was just asking about something like this!
I saw that and decided to to take a shot at it.

mooklepticon
Fast Inserter
Fast Inserter
Posts: 234
Joined: Wed Mar 02, 2016 10:09 pm

Re: [MOD 0.12.x] Multiplied Minables

Post by mooklepticon » Tue May 03, 2016 10:25 pm

Bokrug wrote:
mooklepticon wrote:Someone on Reddit was just asking about something like this!
I saw that and decided to to take a shot at it.
You are a good human.

User avatar
SoulForge
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Wed Apr 13, 2016 6:58 pm

Re: [MOD 0.12.x] Multiplied Minables

Post by SoulForge » Fri May 06, 2016 5:26 pm

Can support be added for mods that add ores like bobs?

I tried to add to your existing list;

data.raw["resource"]["zinc-ore"].minable.count = 10

But it throws errors.

orzelek
Smart Inserter
Smart Inserter
Posts: 3254
Joined: Fri Apr 03, 2015 10:20 am

Re: [MOD 0.12.x] Multiplied Minables

Post by orzelek » Fri May 06, 2016 5:33 pm

SoulForge wrote:Can support be added for mods that add ores like bobs?

I tried to add to your existing list;

data.raw["resource"]["zinc-ore"].minable.count = 10

But it throws errors.
You can add it but it needs to execute after ore has been added.
Setting optional dependency for bobsores might solve this.

User avatar
SoulForge
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Wed Apr 13, 2016 6:58 pm

Re: [MOD 0.12.x] Multiplied Minables

Post by SoulForge » Fri May 06, 2016 7:23 pm

orzelek wrote:
SoulForge wrote:Can support be added for mods that add ores like bobs?

I tried to add to your existing list;

data.raw["resource"]["zinc-ore"].minable.count = 10

But it throws errors.
You can add it but it needs to execute after ore has been added.
Setting optional dependency for bobsores might solve this.
Just as a side question to this. How would that work with angels infinite ores? It still only pulls 1 from those patches.

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am

Re: [MOD 0.12.x] Multiplied Minables

Post by prg » Fri May 06, 2016 8:25 pm

Maybe just go through all the resources and multiply the count of everything that's not a fluid.

Code: Select all

for _, res in pairs(data.raw.resource) do
    if not res.category --crude-oil has "basic-fluid" here, for ores this is nil
    and res.minable then
        if res.minable.count then
            res.minable.count = res.minable.count * 10
        else
            res.minable.count = 10
        end
    end
end
Do this in data-updates.lua so other mods will already have added their own entities.

edit: and this should now work with resources that drop multiple results:

Code: Select all

multiplier = 10

for _, res in pairs(data.raw.resource) do
    if not res.category --crude-oil has "basic-fluid" here, for ores this is nil
    and res.minable then
        if res.minable.result then
            if res.minable.count then
                res.minable.count = res.minable.count * multiplier
            else
                res.minable.count = multiplier
            end
        elseif res.minable.results then
            for _, result in pairs(res.minable.results) do
                result.amount_min = result.amount_min * multiplier
                result.amount_max = result.amount_max * multiplier
            end
        end
    end
end
Warning: not really tested.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

User avatar
sporefreak
Fast Inserter
Fast Inserter
Posts: 178
Joined: Sun Apr 17, 2016 12:55 am

Re: [MOD 0.12.x] Multiplied Minables

Post by sporefreak » Sat May 07, 2016 7:02 am

Don't suppose it would be possible to make it so a special pick causes more ores instead of automatic multiplied ores?
In my current mod pack i would love to make player mining always faster then drilling (as long as you keep up with it and have only a few miners)

User avatar
SoulForge
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Wed Apr 13, 2016 6:58 pm

Re: [MOD 0.12.x] Multiplied Minables

Post by SoulForge » Sun May 08, 2016 1:43 pm

prg wrote:Maybe just go through all the resources and multiply the count of everything that's not a fluid.

Code: Select all

for _, res in pairs(data.raw.resource) do
    if not res.category --crude-oil has "basic-fluid" here, for ores this is nil
    and res.minable then
        if res.minable.count then
            res.minable.count = res.minable.count * 10
        else
            res.minable.count = 10
        end
    end
end
Do this in data-updates.lua so other mods will already have added their own entities.

edit: and this should now work with resources that drop multiple results:

Code: Select all

multiplier = 10

for _, res in pairs(data.raw.resource) do
    if not res.category --crude-oil has "basic-fluid" here, for ores this is nil
    and res.minable then
        if res.minable.result then
            if res.minable.count then
                res.minable.count = res.minable.count * multiplier
            else
                res.minable.count = multiplier
            end
        elseif res.minable.results then
            for _, result in pairs(res.minable.results) do
                result.amount_min = result.amount_min * multiplier
                result.amount_max = result.amount_max * multiplier
            end
        end
    end
end
Warning: not really tested.
It works! But if you don't go in and alter the original resources amount (or remove it) it multiples that value as well. Giving 100 per strike for the original ores

User avatar
SoulForge
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Wed Apr 13, 2016 6:58 pm

Re: [MOD 0.12.x] Multiplied Minables

Post by SoulForge » Fri May 13, 2016 6:53 pm

I retract what I said. It works for the Dark Matter ore but bobs ores throw an error.

Code: Select all

Error Util.cpp:58: __multi-mine-x10__/data-updates.lua:14: attempt to perform arithmetic on field 'amount_min' (a nil value)

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am

Re: [MOD 0.12.x] Multiplied Minables

Post by prg » Fri May 13, 2016 7:12 pm

Ah, instead of separately specifying amount_min and _max, it's possible to simply use amount. So check which value actually exists and only multiply that one.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

User avatar
SoulForge
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Wed Apr 13, 2016 6:58 pm

Re: [MOD 0.12.x] Multiplied Minables

Post by SoulForge » Fri May 13, 2016 7:23 pm

prg wrote:Ah, instead of separately specifying amount_min and _max, it's possible to simply use amount. So check which value actually exists and only multiply that one.
Thanks prg.

I have altered it with your suggestion and now it works. Code should read as;

Code: Select all

multiplier = 10

for _, res in pairs(data.raw.resource) do
    if not res.category --crude-oil has "basic-fluid" here, for ores this is nil
    and res.minable then
        if res.minable.result then
            if res.minable.count then
                res.minable.count = res.minable.count * multiplier
            else
                res.minable.count = multiplier
            end
        elseif res.minable.results then
            for _, result in pairs(res.minable.results) do
                result.amount = result.amount * multiplier
            end
        end
    end
end
Is it possible to fix this further to not need the resources file? I am still learning by altering what already exists.

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am

Re: [MOD 0.12.x] Multiplied Minables

Post by prg » Fri May 13, 2016 7:46 pm

SoulForge wrote:

Code: Select all

multiplier = 10

for _, res in pairs(data.raw.resource) do
    if not res.category --crude-oil has "basic-fluid" here, for ores this is nil
    and res.minable then
        if res.minable.result then
            if res.minable.count then
                res.minable.count = res.minable.count * multiplier
            else
                res.minable.count = multiplier
            end
        elseif res.minable.results then
            for _, result in pairs(res.minable.results) do
                result.amount = result.amount * multiplier
            end
        end
    end
end
This should now blow up when amount_min and _max are used instead of just amount. You need to check which values exist and only multiply those.
SoulForge wrote:Is it possible to fix this further to not need the resources file? I am still learning by altering what already exists.
What resources file?
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

User avatar
SoulForge
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Wed Apr 13, 2016 6:58 pm

Re: [MOD 0.12.x] Multiplied Minables

Post by SoulForge » Fri May 13, 2016 7:53 pm

prg wrote:
SoulForge wrote:

Code: Select all

multiplier = 10

for _, res in pairs(data.raw.resource) do
    if not res.category --crude-oil has "basic-fluid" here, for ores this is nil
    and res.minable then
        if res.minable.result then
            if res.minable.count then
                res.minable.count = res.minable.count * multiplier
            else
                res.minable.count = multiplier
            end
        elseif res.minable.results then
            for _, result in pairs(res.minable.results) do
                result.amount = result.amount * multiplier
            end
        end
    end
end
This should now blow up when amount_min and _max are used instead of just amount. You need to check which values exist and only multiply those.
SoulForge wrote:Is it possible to fix this further to not need the resources file? I am still learning by altering what already exists.
What resources file?
The resource.lua file included with the original mod.

Has this in it;

Code: Select all

data.raw["resource"]["iron-ore"].minable.count = 10
data.raw["resource"]["copper-ore"].minable.count = 10
data.raw["resource"]["coal"].minable.count = 10
data.raw["resource"]["stone"].minable.count = 10
EDIT; Nevermind. I should follow through with my thoughts before posting it would seem. I removed everything but the data-updates file and the json file and it still works.

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am

Re: [MOD 0.12.x] Multiplied Minables

Post by prg » Fri May 13, 2016 7:59 pm

SoulForge wrote:The resource.lua file included with the original mod.

Has this in it;

Code: Select all

data.raw["resource"]["iron-ore"].minable.count = 10
data.raw["resource"]["copper-ore"].minable.count = 10
data.raw["resource"]["coal"].minable.count = 10
data.raw["resource"]["stone"].minable.count = 10
That just hardcodes increased values for the base game resources. This is not needed anymore since we just go through all the resources later and multiply those.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Post Reply

Return to “Mods”