Page 1 of 1

Console command to create new oil wells?

Posted: Thu Sep 03, 2015 10:54 am
by Peter34
I'm playing a test map, "wide ribbon"-style, 672 tiles tall and infinite width, but I seem to have extremely few sources of Oil.

Are there console commands that can create new Oil Wells for me? I know how to create oil barrels via the usual gift-item console command, but I'd rather have some Oil Wells to use Pumpjacks on.

Re: Console command to create new oil wells?

Posted: Thu Sep 03, 2015 11:44 am
by prg
Stand where you want the well to be created, then run

Code: Select all

game.player.surface.create_entity{name="crude-oil", position=game.player.position}
Point your mouse cursor at the new well and run

Code: Select all

game.player.selected.amount=10000
edit: ...and just figured out you can already pass the amount in the create_entity call.

Re: Console command to create new oil wells?

Posted: Sat Sep 05, 2015 12:00 pm
by Peter34
I tested this, and it works, and amount=10k gives 133% yield, 20k gives 266%, so it's linear:

/c game.player.surface.create_entity{name="crude-oil", position=game.player.position, amount=10000}

Thanks!

Re: Console command to create new oil wells?

Posted: Sat Sep 05, 2015 7:24 pm
by Peter34
Thanks again.

What's the equivalent command to spawn a patch of ore? Especially ores from mods, such as the Uraninite and Flourite from the Atomic Power mod?

Re: Console command to create new oil wells?

Posted: Sat Sep 05, 2015 7:30 pm
by prg
Replace crude-oil with the name of the resource. Point the mouse cursor at an existing patch and /c game.player.print(game.player.selected.name) to find out what it's called, or dig through the mod's source if no such patch yet exists.

edit: ...and if you want more than a single tile,

Code: Select all

for a = -10, 10 do
    for b = -10, 10 do
        game.player.surface.create_entity{name="coal", position={game.player.position.x+a, game.player.position.y+b}, amount=500}
    end
end
edit edit: in case a simple square is still not fancy enough: (need the whitespace in front of every line so you can just paste the whole thing into the console)

Code: Select all

    complex = {
        new = function(r, i)
            local a = {r=r, i=i,
                abs = function(x)
                    return math.sqrt(x.r^2 + x.i^2)
                end,
            }
            setmetatable(a, complex)
            return a
        end,

        __add = function(a, b)
            return complex.new(a.r + b.r, a.i + b.i)
        end,

        __mul = function(a, b)
            local new_r = a.r * b.r - a.i * b.i
            local new_i = a.r * b.i + a.i * b.r
            return complex.new(new_r, new_i)
        end,
    }

    local size = 200
    local max_iter = 100
    local top = game.player.position.y-size/2
    local left = game.player.position.x-size/2
    for y = 1, size do
        for x = 1, size do
            local z = complex.new(0, 0)
            local c = complex.new(2.5*x/size - 2, 2.5*y/size - 1.25)
            local res = "coal"
            for n = 1, max_iter do
                if z:abs() > 2 then
                    if n < 8 then
                        res = nil
                    elseif n < 15 then
                        res = "iron-ore"
                    else
                        res = "copper-ore"
                    end
                    break
                end
                z = z*z + c
            end
            if res then
                game.player.surface.create_entity{name=res, position={left+x, top+y}, amount=1000}
            end
        end
    end

Re: Console command to create new oil wells?

Posted: Mon Sep 07, 2015 3:13 am
by Peter34
Thanks!

For some weird reason, "flourite" doesn't work with the Uranium Power mod. I've tried to look into the mod files to see what it's called, but haven't been able to find it. "uraninite" works fine, and that was the mineral that hadn't occured on my RSO/Tall_Ribbon map.

In general, I think combining RSO, Uranium Power and the Tall_Ribbon playstyle might be advisable only if the ribbon is very tall. I play on a 672 tall ribbon (3 regions tall) and with water set to "medium" that seems to cause problems with abundance of special minerals. It'd probably work fine with a ribbon height of 1120, 5 regions, but at that point it's not really a ribbon any more. It doen't really create the effect that you fairly quickly end up defending only 2 fronts, left and right, while up and down are safe.

Re: Console command to create new oil wells?

Posted: Mon Sep 07, 2015 8:11 am
by prg
Haven't looked at that mod, so just a guess, but... maybe try "fluorite"?

Re: Console command to create new oil wells?

Posted: Mon Sep 07, 2015 4:57 pm
by orzelek
Ohh pretty mandelbrot resources.
Don't tempt me to add fractal resources to RSO :D

Do I understand correctly that you are having problems with fluorite not being spawned by RSO on ribbon map?
Amount of water is important for RSO - if whole resource patch lands in the water you will simply lose it. There is no mechanics to compensate for that.

Both uraninite and fluorite have quite low spawn chances so might be rare.

Re: Console command to create new oil wells?

Posted: Tue Sep 08, 2015 2:41 am
by Gandalf
That mandelbrot ore patch is glorious!

Re: Console command to create new oil wells?

Posted: Tue Sep 08, 2015 4:38 pm
by orzelek
Gandalf wrote:That mandelbrot ore patch is glorious!
Sad part is - it would be difficult to mine.
But placing it somewhere far and random as an easter egg in RSO is still tempting.

Re: Console command to create new oil wells?

Posted: Fri Sep 11, 2015 8:49 pm
by katyal
Mandelbrot resources....what do they mean?!

Re: Console command to create new oil wells?

Posted: Fri Sep 11, 2015 8:51 pm
by orzelek
katyal wrote:Mandelbrot resources....what do they mean?!
Mandelbrot is the name of fractal used to generate resource picture in this thread some posts above.

Re: Console command to create new oil wells?

Posted: Sat Sep 12, 2015 3:58 am
by Twisted_Code
orzelek wrote:
Gandalf wrote:That mandelbrot ore patch is glorious!
Sad part is - it would be difficult to mine.
But placing it somewhere far and random as an easter egg in RSO is still tempting.
Do it! Do it! Do it! *begins chanting*

Re: Console command to create new oil wells?

Posted: Sun Sep 13, 2015 8:15 pm
by BillH
orzelek wrote:
katyal wrote:Mandelbrot resources....what do they mean?!
Mandelbrot is the name of fractal used to generate resource picture in this thread some posts above.
I took the OP to be a reference to the double rainbow guy:https://www.youtube.com/watch?v=OQSNhk5ICTI

Re: Console command to create new oil wells?

Posted: Sun Sep 20, 2015 8:56 pm
by korthan
Whenever I try to use the lua command console i keep getting the error "cannot execute command. error: [insert command here]:1: LuaPlayer doesn't contain key surface. Anyone have any ideas of what i'm doing wrong? Trying to use the console command for making oil, ores, etc as a test.

I attached a screenshot of the error

Re: Console command to create new oil wells?

Posted: Sun Sep 20, 2015 9:33 pm
by prg
korthan wrote:Whenever I try to use the lua command console i keep getting the error "cannot execute command. error: [insert command here]:1: LuaPlayer doesn't contain key surface. Anyone have any ideas of what i'm doing wrong? Trying to use the console command for making oil, ores, etc as a test.

I attached a screenshot of the error
You're using a pre-0.12 version which doesn't contain support for multiple surfaces yet. Just use game.createentity or update to 0.12 (enable experimental updates in the settings)

Re: Console command to create new oil wells?

Posted: Fri Jul 29, 2016 1:15 pm
by Jupiter
Peter34 wrote:I tested this, and it works, and amount=10k gives 133% yield, 20k gives 266%, so it's linear:

/c game.player.surface.create_entity{name="crude-oil", position=game.player.position, amount=10000}

Thanks!
Sorry for the necro but for anyone reading this thread: the number you put in for amount is the number of cycles left in case of an oil well. There are 75 cycles for 1% so 10000 cycles would be 10000 / 75 = 133% (rounded down)
This number includes the 10% the well cannot go under.

Note: recently the number of cycles per % was doubled to 150 so 10000 cycles now equals 66% (rounded down)