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

Conversation

Prehistoricman
Copy link

Work done

  • Fixes dgun stall assist widget not waiting factories
  • Remove need to hardcode all units that can d-gun (uses canManualFire property)
  • Reduce 'watch' time (5s to 3s) so that units come back online quicker
  • Avoid waiting units that don't build things (such as the Arm EMP spider)

Since this widget will now wait any unit that has buildpower, I looked through the list of affected units and found some that we don't want to wait (the exceptions table). I chose the spy bots, EMP spider, and anti-nuke ships. But perhaps the spy bot choice is contentious: it uses more power when moving and the script could stop it. What do you think?

Addresses Issue(s)

Setup

  1. Enable "DGun Stall Assist" widget
  2. Build a factory and a worker

Test steps

  1. Fire d-guns until energy stalling
  2. Expect that both the factory and worker are given a WAIT command by the widget

…els/549281623154229250/1278497565507326012

Remove need to hardcore all units that can d-gun (use canManualFire property)
Reduce 'watch' time so that units come back online quicker
Avoid waiting units that don't build things
@saurtron
Copy link
Collaborator

  • Remove need to hardcode all units that can d-gun (uses canManualFire property)

Problem here is some other unit(s?) also have canManualFire (like thor, armseadragon, cordesolator) and more could pop up without notice. Not sure that's a problem here, but probably needs to be considered.

Maybe can check for other unit attributes, like, customParams.iscommander seems the way to go. Otherwise, things like does it actually have a dgun, or other commander-like attributes.

["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.

@sprunk
Copy link
Collaborator

sprunk commented Jan 14, 2025

Perhaps ideally it would work for any manual fire but appropriately to the cost? So if commander DGun costs 600e it interrupts stuff if you have less than 600e, but if Thor or cordesolator cost 0e it will only interrupt stuff if you have less than 0e.

@Prehistoricman
Copy link
Author

Thanks for the review guys.

Problem here is some other unit(s?) also have canManualFire (like thor, armseadragon, cordesolator) and more could pop up without notice. Not sure that's a problem here, but probably needs to be considered.

Maybe can check for other unit attributes, like, customParams.iscommander seems the way to go. Otherwise, things like does it actually have a dgun, or other commander-like attributes.

I gave those a test and they don't trigger the assist because the command given is not CMD.DGUN, so that's OK. iscommander is not true for the decoy commander, which you may consider OK or not OK.

Perhaps ideally it would work for any manual fire but appropriately to the cost? So if commander DGun costs 600e it interrupts stuff if you have less than 600e, but if Thor or cordesolator cost 0e it will only interrupt stuff if you have less than 0e.

That sounds like an ideal solution. Can you outline how I would do that? I can see that the weapon def has "commandfire = true" but I don't see how to access that from the widget.

@sprunk
Copy link
Collaborator

sprunk commented Jan 15, 2025

commandfire is read back as manualfire from widgets. and energy per shot is energyCost.

@Prehistoricman
Copy link
Author

commandfire is read back as manualfire from widgets. and energy per shot is energyCost.

Thanks. Done and tested with the decoy commander.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants