Manually construct ghosts or blueprints

This is the place to request new mods or give ideas about what could be done.
Post Reply
erisco
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Aug 16, 2015 1:13 am
Contact:

Manually construct ghosts or blueprints

Post by erisco »

Blueprints change the mode of play from focus on individual machines to focus on systems of machines. The power of a single click is increased.

Fond of that kind of play I want to use it earlier in the game. "Start Out Planning" is a simple mod that helps with this (see https://forums.factorio.com/forum/vie ... int#p59770). Having a single blueprint is not quite useful enough, but it is trivial to give yourself more with console commands.

What is missing is a way to construct ghost objects conveniently. This is of course done late game by construction robots. Even if you use "Start Out Planning", in the early game after placing a blueprint you must select each item individually from your inventory, orient it correctly, and place it on the map. This amounts to a lot of busywork relative to the spirit of what blueprints should offer.

A mod could remedy this shortcoming. On a mouse click or key press, the mod attempts to place ghost objects within the player's normal placement radius, using items from the player's inventory. If the player does not have the item in their inventory the mod logs a failure message indicating the object type -- for example "No 'Assembling Machine 2' in your inventory".

I am interested to hear from experienced Factorio modders of how difficult this mod may be to implement -- and some pointers to which parts of the API I need to study. If it is a relatively easy task then I may make this mod myself.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Manually construct ghosts or blueprints

Post by Adil »

So, what you want is basically building blueprints in flesh right away and without robot?
Well, apart from separate key, that's doable. (The best that can be done about a key is slapping another monstrous button onto player's gui.)

There are events on_built_entity and on_put_item which may be used to detect the blueprint placement.
Some understanding of the game object (surfaces, players, forces) would be needed to make it multiplayer-friendly.
surface.create_entity, surface.find_entities_filtered and player.remove_item methods are needed to make it work.
(sorry for a brief answer, gtg.)
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

erisco
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Aug 16, 2015 1:13 am
Contact:

Re: Manually construct ghosts or blueprints

Post by erisco »

I had a poke around the API documentation and was pleasantly surprised to find it in order. While the API could use some more functionality here and there, I was able to put together this mod in only a few hours. Props to the Factorio team!

Here is the link: https://forums.factorio.com/forum/vie ... 91#p101191

Post Reply

Return to “Ideas and Requests For Mods”