diff --git a/changelog.txt b/changelog.txt index 4508866..1e8e64f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,8 @@ Version: 2.0.4 Date: 17. 12. 2021 Improvements: - Added RTStasisRealm to surface exclusion list + Bugfixes: + - Fixed onBuilderArrived if the builder was a unit and not a group (Thanks DBotThePony for reporting) --------------------------------------------------------------------------------------------------- Version: 2.0.3 diff --git a/control.lua b/control.lua index 3160741..6565046 100644 --- a/control.lua +++ b/control.lua @@ -867,11 +867,13 @@ end local function onBuilderArrived(event) local builder = event.group + local usingUnit = false if not (builder and builder.valid) then builder = event.unit if not (builder and builder.valid and builder.force.name == "enemy") then return end + usingUnit = true elseif (builder.force.name ~= "enemy") then return end @@ -881,8 +883,10 @@ local function onBuilderArrived(event) return end map.activeSurface = true - local squad = universe.groupNumberToSquad[builder.group_number] - squad.commandTick = event.tick + COMMAND_TIMEOUT * 10 + if not usingUnit then + local squad = universe.groupNumberToSquad[builder.group_number] + squad.commandTick = event.tick + COMMAND_TIMEOUT * 10 + end if universe.aiPointsPrintSpendingToChat then game.print("Settled: [gps=" .. builder.position.x .. "," .. builder.position.y .."]") end