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

This subforum contains all the issues which we already resolved.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14405
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post by Rseding91 »

Thanks for the report. It's now fixed for the next version of 0.16.
If you want to get ahold of me I'm almost always on Discord.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5210
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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.
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.
Post Reply

Return to “Resolved Problems and Bugs”