[2.0.73] control_behavior is not applied in surface.create_entity for entity-ghosts

LeonSkills
Inserter
Inserter
Posts: 28
Joined: Mon Feb 11, 2019 12:37 pm
Contact:

[2.0.73] control_behavior is not applied in surface.create_entity for entity-ghosts

Post by LeonSkills »

Consider the following snippet

Code: Select all

game.surfaces[1].create_entity {
  name               = "entity-ghost",
  inner_name         = "decider-combinator",
  position           = {0, 0},
  force              = "player",
  player_description = "test",
  control_behavior   = {
    decider_conditions = {
      conditions = {},
      outputs    = {{signal = {type = "item", name = "iron-ore"}}}
    }
  }
}
This creates the ghost decider combinator on {0, 0} on Nauvis. It misses the iron-ore output. However it does contain the player_description.

In contrast to building the entity proper

Code: Select all

game.surfaces[1].create_entity {
  name               = "decider-combinator",
  position           = {0, 0},
  force              = "player",
  player_description = "test",
  control_behavior   = {
    decider_conditions = {
      conditions = {},
      outputs    = {{signal = {type = "item", name = "iron-ore"}}}
    }
  }
}
Where it does contain the iron-ore output.

I expect the control_behavior to be applied in both cases.

As far as I could see this is the case with `control_behavior` for all entity types, none of the behaviours get added.
There might be other entity-specific attributes which are not applied either for ghosts, but I haven't found any.

Usecase:
I'm saving a blueprints BlueprintEntity and Tiles tables so it can be placed automatically at some later time, without having to worry the original blueprint has been destroyed/changed.

With the BlueprintEntity table it's very useful to be able to do

Code: Select all

blueprint_entity.inner_name = blueprint_entity.name
blueprint_entity.name = "entity-ghost"
blueprint_entity.force = player.force
surface.create_entity(blueprint_entity)
All other relevant attributes are shared between what create_entity expects and a BlueprintEntity contains.
It applies recipes, filters, priorities etc, everything but the control_behavior.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4389
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.73] control_behavior is not applied in surface.create_entity for entity-ghosts

Post by boskid »

Thanks for the report. Issue is now fixed for 2.1.
Post Reply

Return to “Fixed for 2.1”