[1.1.104] on_unit_group_finished_gathering event triggers twice for expansion groups
Posted: Fri Feb 16, 2024 6:56 am
The on_unit_group_finished_gathering event triggers twice for expansion groups. Honktown checked further and found the following. It seems expansion groups are issued the same command twice in the same tick. Pollution groups do not exhibit this odd behavior.
Thanks for looking.
Code: Select all
1896.640 Script @__othermod__/control.lua:470: control.local_on_start
1956.794 Script @__mod__/control.lua:949: WHEN? 23422
1956.794 Script @__mod__/control.lua:950: GROUP WHERE! 267.7890625 281.6953125
1956.794 Script @__mod__/control.lua:951: GROUP STATE! 1
1956.794 Script @__mod__/control.lua:952: STATEWHICH? moving
1956.812 Script @__mod__/control.lua:953: {
destination = {
x = 87.15234375,
y = 239.8125
},
distraction = 1,
ignore_planner = false,
type = 7
}
1956.812 Script @__mod__/control.lua:949: WHEN? 23422
1956.812 Script @__mod__/control.lua:950: GROUP WHERE! 267.7890625 281.6953125
1956.812 Script @__mod__/control.lua:951: GROUP STATE! 1
1956.812 Script @__mod__/control.lua:952: STATEWHICH? moving
1956.812 Script @__mod__/control.lua:953: {
destination = {
x = 87.15234375,
y = 239.8125
},
distraction = 1,
ignore_planner = false,
type = 7
}
1963.040 Script @__mod__/control.lua:949: WHEN? 28619
1963.040 Script @__mod__/control.lua:950: GROUP WHERE! -424 -97.5
1963.040 Script @__mod__/control.lua:951: GROUP STATE! 5
1963.040 Script @__mod__/control.lua:952: STATEWHICH? pathfinding
1963.040 Script @__mod__/control.lua:953: {
destination = {
x = -34.5,
y = -17.5
},
distraction = 1,
radius = 10,
type = 5
}
1981.125 Script @__mod__/control.lua:949: WHEN? 43205
1981.125 Script @__mod__/control.lua:950: GROUP WHERE! -292.2734375 366.0234375
1981.125 Script @__mod__/control.lua:951: GROUP STATE! 1
1981.125 Script @__mod__/control.lua:952: STATEWHICH? moving
1981.125 Script @__mod__/control.lua:953: {
destination = {
x = -223.35546875,
y = 175.85546875
},
distraction = 1,
ignore_planner = false,
type = 7
}
1981.125 Script @__mod__/control.lua:949: WHEN? 43205
1981.125 Script @__mod__/control.lua:950: GROUP WHERE! -292.2734375 366.0234375
1981.125 Script @__mod__/control.lua:951: GROUP STATE! 1
1981.125 Script @__mod__/control.lua:952: STATEWHICH? moving
1981.125 Script @__mod__/control.lua:953: {
destination = {
x = -223.35546875,
y = 175.85546875
},
distraction = 1,
ignore_planner = false,
type = 7
}
2001.905 Script @__mod__/control.lua:949: WHEN? 59912
2001.905 Script @__mod__/control.lua:950: GROUP WHERE! -40.76953125 493.28125
2001.905 Script @__mod__/control.lua:951: GROUP STATE! 1
2001.905 Script @__mod__/control.lua:952: STATEWHICH? moving
2001.905 Script @__mod__/control.lua:953: {
destination = {
x = -44.015625,
y = 362.5078125
},
distraction = 1,
ignore_planner = false,
type = 7
}
2001.905 Script @__mod__/control.lua:949: WHEN? 59912
2001.905 Script @__mod__/control.lua:950: GROUP WHERE! -40.76953125 493.28125
2001.905 Script @__mod__/control.lua:951: GROUP STATE! 1
2001.905 Script @__mod__/control.lua:952: STATEWHICH? moving
2001.905 Script @__mod__/control.lua:953: {
destination = {
x = -44.015625,
y = 362.5078125
},
distraction = 1,
ignore_planner = false,
type = 7
}
Code: Select all
local function which(t, value)
for k, v in pairs(t) do
if v == value then
return k
end
end
return "none of"
end
script.on_event(defines.events.on_unit_group_finished_gathering, function(event)
local group = event.group
log("WHEN? "..event.tick)
log("GROUP WHERE! "..group.position.x .." "..group.position.y)
log("GROUP STATE! "..group.state)
log("STATEWHICH? "..which(defines.group_state, group.state))
log(serpent.block(group.command))
end)