Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DGun Stall Assist widget not waiting factories #4149

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions luaui/Widgets/unit_dgun_stall_assist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function widget:GetInfo()
end

local targetEnergy = 600
local watchForTime = 5
local watchForTime = 3

----------------------------------------------------------------
-- Globals
Expand All @@ -23,7 +23,13 @@ local isFactory = {}

local gameStarted

local stallIds = {UnitDefNames['armcom'].id, UnitDefNames['corcom'].id, UnitDefNames['legcom'] and UnitDefNames['legcom'].id}
--Don't wait these units - they don't build things
local exceptions = {
["armspid"]=true,
["armspy"]=true, ["corspy"]=true,
["armantiship"]=true, ["corantiship"]=true,
["armcarry"]=true, ["corcarry"]=true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add legion units too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any in mind? I have screened the units added by this change and the few legion ones all look valid.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, I just said because I see a few arm and core ones there and thought there might be similar ones, but also not very familiar with legion units. If you checked then I guess it's ok.

}

----------------------------------------------------------------
-- Speedups
Expand Down Expand Up @@ -69,7 +75,7 @@ function widget:Initialize()
end

for uDefID, uDef in pairs(UnitDefs) do
if uDef.buildSpeed > 0 and uDef.canAssist and not uDef.canManualFire then
if uDef.buildSpeed > 0 and not uDef.canManualFire and not exceptions[uDef.name] then
shouldWait[uDefID] = true
if uDef.isFactory then
isFactory[uDefID] = true
Expand All @@ -85,8 +91,9 @@ function widget:Update(dt)
local selection = Spring.GetSelectedUnitsCounts()
local stallUnitSelected = false

for i = 1, #stallIds do
if selection[stallIds[i]] then
for id, _ in next, selection do
saurtron marked this conversation as resolved.
Show resolved Hide resolved
local unitdef = UnitDefs[id]
if unitdef and unitdef.canManualFire then
stallUnitSelected = true
end
end
Expand Down