Console command to create new oil wells?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Peter34
Smart Inserter
Smart Inserter
Posts: 1100
Joined: Mon Nov 10, 2014 12:44 pm
Contact:

Console command to create new oil wells?

Post 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.

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

Re: Console command to create new oil wells?

Post 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.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Peter34
Smart Inserter
Smart Inserter
Posts: 1100
Joined: Mon Nov 10, 2014 12:44 pm
Contact:

Re: Console command to create new oil wells?

Post 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!

Peter34
Smart Inserter
Smart Inserter
Posts: 1100
Joined: Mon Nov 10, 2014 12:44 pm
Contact:

Re: Console command to create new oil wells?

Post 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?

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

Re: Console command to create new oil wells?

Post 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
Attachments
mandelbrot.jpg
mandelbrot.jpg (289.57 KiB) Viewed 90318 times
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Peter34
Smart Inserter
Smart Inserter
Posts: 1100
Joined: Mon Nov 10, 2014 12:44 pm
Contact:

Re: Console command to create new oil wells?

Post 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.

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

Re: Console command to create new oil wells?

Post by prg »

Haven't looked at that mod, so just a guess, but... maybe try "fluorite"?
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

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

Re: Console command to create new oil wells?

Post 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.

User avatar
Gandalf
Filter Inserter
Filter Inserter
Posts: 294
Joined: Fri Dec 19, 2014 10:15 pm
Contact:

Re: Console command to create new oil wells?

Post by Gandalf »

That mandelbrot ore patch is glorious!
OS: Linux Mint 19 x64 | desktop: Awesome 4.2  |  Intel Core i5 8600k  |  16GB DDR4  |  NVidia GTX 1050 Ti (driver version: 410.104)    (2019-03)

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

Re: Console command to create new oil wells?

Post 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.

katyal
Fast Inserter
Fast Inserter
Posts: 208
Joined: Wed Nov 12, 2014 8:42 pm
Contact:

Re: Console command to create new oil wells?

Post by katyal »

Mandelbrot resources....what do they mean?!

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

Re: Console command to create new oil wells?

Post 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.

User avatar
Twisted_Code
Long Handed Inserter
Long Handed Inserter
Posts: 83
Joined: Sat Jun 06, 2015 1:15 am
Contact:

Re: Console command to create new oil wells?

Post 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*
How to report bugs effectively (archived version)because everyone should know this.
The game's tech tree, a visual reference guide.

BillH
Inserter
Inserter
Posts: 39
Joined: Sat Jul 25, 2015 8:01 pm
Contact:

Re: Console command to create new oil wells?

Post 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

korthan
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Sep 20, 2015 8:52 pm
Contact:

Re: Console command to create new oil wells?

Post 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
Attachments
this a screenshot of the error.
this a screenshot of the error.
factorio error.jpg (685.92 KiB) Viewed 61689 times

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

Re: Console command to create new oil wells?

Post 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)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Jupiter
Fast Inserter
Fast Inserter
Posts: 174
Joined: Thu Jun 23, 2016 2:38 pm
Contact:

Re: Console command to create new oil wells?

Post 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)

Post Reply

Return to “Gameplay Help”