[1.1.32] Unit groups missing on units in the on_entity_died event

This subforum contains all the issues which we already resolved.
Post Reply
Veden
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Jul 13, 2016 3:54 pm
Contact:

[1.1.32] Unit groups missing on units in the on_entity_died event

Post by Veden »

Summary:
Unit groups are nil on units during the on_entity_died event.

Long version:

If you load the attached save with the attached mod, you can run the command below in the console to generate a unit group with 10 small biters.
The unit group will spawn close enough to turrets to agro the unit group.

The command when run will print the unit number and the group number of each biter.
The mod contains a hook for the on_entity_died event, where the code prints out the unit number and the group the dying biter is associated with.

None of the biters passing through the on_entity_died contain a unit_group

Code: Select all

local surface = game.surfaces[1]

local group = surface.create_unit_group({position={0,0}})

for i = 1, 10 do
    local e = surface.create_entity({
            position = {0,0},
            name = "small-biter"
    })
    group.add_member(e)
    print("unit", e.unit_number, "group", e.unit_group.group_number)
end
Attachments
testUnitGroups.zip
(979.83 KiB) Downloaded 159 times
testUnitGroups_0.0.1.zip
(847 Bytes) Downloaded 152 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.32] Unit groups missing on units in the on_entity_died event

Post by Rseding91 »

Thanks for the report. It's now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”