Unable to deconstruct entity that lacks a paired item
Unable to deconstruct entity that lacks a paired item
I am confused about how the deconstruction planner works. I have an entity that is a slightly modified deepcopy of the radar entity. No essential fields are modified. It has no associated item, which is intentional, because the entity is only spawned by control.lua scripting. As a result of this, it seems the entity also can not be marked as an entity to deconstruct by the deconstruction planner. Additionally, the entity does have a minable result, which does drop a regular item. The entity can be mined by hand by players just fine.
The solution here seems obvious, right? Add an item for the entity? Except this doesn't make sense -Trees and rocks are deconstructable by the planner and have no associated entity - only a minable result. So what exactly is going on here? Are trees and rocks some special case in the game engine? Am I missing something else entirely?
The solution here seems obvious, right? Add an item for the entity? Except this doesn't make sense -Trees and rocks are deconstructable by the planner and have no associated entity - only a minable result. So what exactly is going on here? Are trees and rocks some special case in the game engine? Am I missing something else entirely?
-
- Inserter
- Posts: 33
- Joined: Fri May 05, 2017 2:09 pm
- Contact:
Re: Unable to deconstruct entity that lacks a paired item
I have the same problem in my mod. I swap entities with almost identical ones to change behaviour; bots will not pick the ones up that have no unique item.
This might be bug report worthy; IMHO bots should just pick up entities that mine into a different item.
This might be bug report worthy; IMHO bots should just pick up entities that mine into a different item.
Re: Unable to deconstruct entity that lacks a paired item
This is how I handle blueprinting and deconstructing and deconstructing a combined entity in nanobots. Might help a little bit in figuring out ways to make it work.
https://github.com/Nexela/Nanobots/blob ... e.lua#L215
https://github.com/Nexela/Nanobots/blob ... erface.lua
The radar I don't care about so when the roboport is build/delete the radar is built/deleted
but this allows blueprint the roboport or the combinator and it will keep settings.
This is accomplished by using on_built entity to teleport everything into their correct places.
https://github.com/Nexela/Nanobots/blob ... e.lua#L215
https://github.com/Nexela/Nanobots/blob ... erface.lua
The radar I don't care about so when the roboport is build/delete the radar is built/deleted
but this allows blueprint the roboport or the combinator and it will keep settings.
This is accomplished by using on_built entity to teleport everything into their correct places.
Re: Unable to deconstruct entity that lacks a paired item
Good to know, but my main question is about understanding how the deconstruction planner actually works. I'd at least at like to understand why trees and rocks and other materials which are minable can be deconstructed using the planner, but other entities can not unless they have an item.Nexela wrote:This is how I handle blueprinting and deconstructing and deconstructing a combined entity in nanobots. Might help a little bit in figuring out ways to make it work.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Unable to deconstruct entity that lacks a paired item
Trees and rocks have an item assigned. there was a time when rocks didn't, and you couldn't mine them, they were a pain in the ass.
basically though, for something to be minable (deconstructable) it needs this tagin this case, a mined entity will give you an underground belt item. You can list any item you want. it SHOULD be unique with a tag as followslisting the name of the entity that gives you the same item, however, you could have multiple entities that give the same item, or multiple items that construct the same entity, and it SHOULD work just fine.
what happens if you don't want an item? include an item, but give itand that will cause it to give you an item 0% of the time, but allow it to be mined.
basically though, for something to be minable (deconstructable) it needs this tag
Code: Select all
minable = {hardness = 0.2, mining_time = 0.5, result = "underground-belt"},
Code: Select all
place_result = "underground-belt",
what happens if you don't want an item? include an item, but give it
Code: Select all
probability = 0
Re: Unable to deconstruct entity that lacks a paired item
You can define an entity as mineable but have no result.
The reason entities can't be deconstructed is they share a check with blueprintable in that it must have an item that builds the entity to be deconstructed.
I don't think that is strictly required so I'll look into changing it to allow deconstructing entities that have no item-to-place.
The reason entities can't be deconstructed is they share a check with blueprintable in that it must have an item that builds the entity to be deconstructed.
I don't think that is strictly required so I'll look into changing it to allow deconstructing entities that have no item-to-place.
If you want to get ahold of me I'm almost always on Discord.
-
- Inserter
- Posts: 33
- Joined: Fri May 05, 2017 2:09 pm
- Contact:
Re: Unable to deconstruct entity that lacks a paired item
Thank you for looking into this!Rseding91 wrote:I don't think that is strictly required so I'll look into changing it to allow deconstructing entities that have no item-to-place.
Might it also be possible for entities to get a "blueprint as" tag for mod purposes? I.e., a modified entity being blueprinted as its original? (So a "radar-modified" would turn into a "radar" in a blueprint.) That might solve a lot of the slightly hacky "replace entity to change behaviour" things mods do at the moment.
Re: Unable to deconstruct entity that lacks a paired item
I've been on hiatus for a while, but the 0.16 update brought me back... Any idea if any changes surrounding this occured?Rseding91 wrote:You can define an entity as mineable but have no result.
The reason entities can't be deconstructed is they share a check with blueprintable in that it must have an item that builds the entity to be deconstructed.
I don't think that is strictly required so I'll look into changing it to allow deconstructing entities that have no item-to-place.
Re: Unable to deconstruct entity that lacks a paired item
There still seem to be some odd inconsistencies between how player mining works and robot-managed deconstruction works.
As I'm working on adding circuit and filter support to Miniloaders, I have made the formerly invisible inserter entities interactable. So each miniloader consists of an underground-belt (empty selection_box) and an inserter (with selection_box). The item has the underground-belt as its place_result, and both the underground-belt and the inserter have minable.result yielding the item.
When the player mines a miniloader, the actual entity that is mined is the inserter, since it has a selection_box, and by script I clean up the underground-belt.
When a robot mines a miniloader, the actual entity that is mined is the underground-belt, it appears from this thread because the underground-belt has an item with the underground-belt as its place_result, but the inserter does not, and I must clean up with inserter via script.
It certainly makes for some odd scripting.
As I'm working on adding circuit and filter support to Miniloaders, I have made the formerly invisible inserter entities interactable. So each miniloader consists of an underground-belt (empty selection_box) and an inserter (with selection_box). The item has the underground-belt as its place_result, and both the underground-belt and the inserter have minable.result yielding the item.
When the player mines a miniloader, the actual entity that is mined is the inserter, since it has a selection_box, and by script I clean up the underground-belt.
When a robot mines a miniloader, the actual entity that is mined is the underground-belt, it appears from this thread because the underground-belt has an item with the underground-belt as its place_result, but the inserter does not, and I must clean up with inserter via script.
It certainly makes for some odd scripting.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
Re: Unable to deconstruct entity that lacks a paired item
I've changed it for the next version of 0.16 so an entity that's mineable but doesn't have an item-to-place can still be deconstructed.
If you want to get ahold of me I'm almost always on Discord.
Re: Unable to deconstruct entity that lacks a paired item
I must still be missing something. I have an entity that has no item-to-place, but is minableRseding91 wrote:I've changed it for the next version of 0.16 so an entity that's mineable but doesn't have an item-to-place can still be deconstructed.
Code: Select all
entity.minable = { mining_time = 1, count = 1, result = "raw-wood" }
Code: Select all
entity.order_deconstruction(entity.force)
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
Re: Unable to deconstruct entity that lacks a paired item
The entity just has to be mineable. What entity type are you using?
If you want to get ahold of me I'm almost always on Discord.
Re: Unable to deconstruct entity that lacks a paired item
Entity type is "loader". I was able to get it to work by adding "player-creation" to the entity's flags.Rseding91 wrote:The entity just has to be mineable. What entity type are you using?
Is there documentation somewhere on what all the different flags mean? Some of them are relatively clear from their names, but what's the link between "player-creation" and deconstruction?
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
Re: Unable to deconstruct entity that lacks a paired item
This no longer seems to be fixed in 1.0. I remember that 0.16 worked as expected and entities that were minable without a paired item could be deconstructed by the deconstruction planner, but in 0.17 and 1.0 it appears the change was lost or broken in some way. What is the expected behavior for these type of entities @Rseding91?
Re: Unable to deconstruct entity that lacks a paired item
It looks like actually in version 0.15.0 it was changed that it wouldn't allow deconstructing stuff without an item-to-place it. Have you actually tested if 0.15 or 0.16 allowed that?Afforess wrote: ↑Sun Oct 04, 2020 7:14 pmThis no longer seems to be fixed in 1.0. I remember that 0.16 worked as expected and entities that were minable without a paired item could be deconstructed by the deconstruction planner, but in 0.17 and 1.0 it appears the change was lost or broken in some way. What is the expected behavior for these type of entities @Rseding91?
If you want to get ahold of me I'm almost always on Discord.