Page 1 of 1

[0.16.16] don't get event on_built_entity on building entity

Posted: Sat Jan 13, 2018 8:40 pm
by darkfrei
Hi all.

I've made item for control:

Code: Select all

  {
    type = "item",
    name = "private-chest-requester",
    icons = {
      {icon = "__base__/graphics/icons/logistic-chest-requester.png"},
      {icon = "__PrivateBufferChest__/PBC.png"}
      },
    icon_size = 32,
    flags = {"goes-to-quickbar"},
    subgroup = "logistic-network",
    order = "b[storage]-e[logistic-chest-requester]-z",
    place_result = "logistic-chest-requester",
    stack_size = 50
  },
:!: Name of this item is not the same as place_result.

control.lua has this code:

Code: Select all

script.on_event(defines.events.on_built_entity, function(event)
  local entity = event.created_entity
  local player = game.players[event.player_index]
  player.print('entity is ' .. entity.name)
end)
By placing of any item with same name entity I get text, but when item has one name and entity has another name, then I get nothing.
Example mod:
PrivateBufferChest_0.0.1.zip
For 0.16
(10.17 KiB) Downloaded 114 times
How to reproduce:
Place all objects from inventory and by BPC you get no notification.

Re: [0.16.16] don't get event on_built_entity on building entity

Posted: Sat Jan 13, 2018 10:06 pm
by Rseding91
Thanks for the report. It's now fixed for the next version of 0.16.

Re: [0.16.16] don't get event on_built_entity on building entity

Posted: Sat Jan 13, 2018 10:50 pm
by darkfrei
Rseding91 wrote:Thanks for the report. It's now fixed for the next version of 0.16.
What it will be? Item or entity? Item is better.

Why?
If I use new item and old entity, than this entity will be not destroyed on removing of this mod. It's much easy to manage placing and you don't need to replace one entity thru another.
Or both of them.

Re: [0.16.16] don't get event on_built_entity on building entity

Posted: Sun Jan 14, 2018 1:26 am
by eradicator
darkfrei wrote:
Rseding91 wrote:Thanks for the report. It's now fixed for the next version of 0.16.
What it will be? Item or entity? Item is better.
on_built_entity already contains both .entity and .stack.