I want to write a mod to edit blueprints by walking around in them. I have a button on the screen where you can drop a blueprint to start editing it. The mod then creates a surface and teleports the player there. The mod is then supposed to create all the entities from the blueprint but I decided to start with a blank blue print first. So that's what I have so far. You drag&drop the blueprint and end up on a blank surface ready to create stuff.
Now I want to hide the players inventory and tool bar and replace them with a blank inventory and toolbar because editing the blueprint should neither take items from the inventory or add any to it. Also while editing the blueprint crafting should be free. Which means I need the creative recipes as used in the sanbox mode. And I need to hide the normal players crafting queue.
Can I do that and if so how?
One alternative idea I had was to maybe create a tutorial if I can somehow make that dynamically from the blueprint the player dropped on the button. In a tutorial the players inventory and crafting queue is already separate from the game. Is that an option?
How to create a blank inventory and creative recipes?
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: How to create a blank inventory and creative recipes?
- Create the surface
- Create a new character on the new surface. (Possibly an associated character)
- Set the players character to the new character
- Set player.cheat_mode = true on the player.
- Deal with the original character on the original surface. (Hide, Make invulnerable)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: How to create a blank inventory and creative recipes?
That sounds simple. Thanks.
Making the player invulnerable though would be bad I think. You could just walk into an alien nest and then "hide" in the blueprint editor. Better might be to pause the blueprint editor when the real player character takes damage. Or make the dummy character take damage whenever the real one does. So the player knows he should quit editing and save himself.
Making the player invulnerable though would be bad I think. You could just walk into an alien nest and then "hide" in the blueprint editor. Better might be to pause the blueprint editor when the real player character takes damage. Or make the dummy character take damage whenever the real one does. So the player knows he should quit editing and save himself.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: How to create a blank inventory and creative recipes?
Well yea, you have to deal with the clone some way or another.mrvn wrote:Making the player invulnerable though would be bad I think.
I don't see any benefit in walking into a nest and switching to BP mode though. Yes, you wouldn't take damage while editing the BP, but the moment you step back into the real world you're still in the middle of a nest and have to survive. The only edge case i can think of would be if you were almost dead in a multiplayer game - you could wait inside the BP until someone rescues you? That sounds like a rather edgy edge-case. Of course you could just skip the "make invulnerable" part altogether. I just put it in there to protect you from randomly dieing to trains/cars etc. With the new on_entity_damaged event from 0.16.17 transfering damage to the BP world or yanking the player back into the real world when they take damage certainly becomes an option too. Though when yanking people out forcefully you should probably save the intermediate BP somewhere. I don't think you have time to actually ask the player to come back, when you take damage in factorio you usually only have a few seconds left until you're dead. Also associated characters do get a corpse too i believe, so even if the original dies while the player is in a BP they wouldn't lose any items (except for the armor if it got destroyed).
Slightly off topic: Do you have any explanation how the player gets to the other surface btw? Personally i'd imagine it to be some kind of meditative/dream state.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: How to create a blank inventory and creative recipes?
Virtual reality display in your helmet.eradicator wrote:Slightly off topic: Do you have any explanation how the player gets to the other surface btw? Personally i'd imagine it to be some kind of meditative/dream state.
Re: How to create a blank inventory and creative recipes?
Hey there, I am coming from the other blueprint lab mod that you commented on! 
Some very interesting ideas here.
First of all, I dealt with the lab behavior by not creating a new character for the player when they are teleported to the lab. It appears that the game assigns characterless players a temporary inventory that gets destroyed when the player is reattached to a character. That solves a whole nest of problems. By enabling cheat mode in the lab, as eradicator has also suggested, the player does not care about whatever was in their temporary lab inventory.
As for the "clone", i.e., the character that gets left behind in the real world when the player teleports to the lab, I have done nothing!
I just left it there quite very vulnerable. The idea of somehow handling on_entity_damaged by maybe flashing the screen or yanking the player back to the world is great! As my lab is persistent, yanking back seems to be an ok solution. Adding a very small lab shield to the character would also be a nice qol improvement for using the lab.
Also, I have noted a few things that I need to go back and test in my mod:
- Porting to the lab while crafting. Also, while driving.
- Porting back with an item in your "hand".

Some very interesting ideas here.
First of all, I dealt with the lab behavior by not creating a new character for the player when they are teleported to the lab. It appears that the game assigns characterless players a temporary inventory that gets destroyed when the player is reattached to a character. That solves a whole nest of problems. By enabling cheat mode in the lab, as eradicator has also suggested, the player does not care about whatever was in their temporary lab inventory.
As for the "clone", i.e., the character that gets left behind in the real world when the player teleports to the lab, I have done nothing!

Also, I have noted a few things that I need to go back and test in my mod:
- Porting to the lab while crafting. Also, while driving.
- Porting back with an item in your "hand".