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

Add allegiance filter to spatial queries #4065

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

saurtron
Copy link
Collaborator

@saurtron saurtron commented Dec 23, 2024

Work done

  • Add allegiance filter to some spatial queries

Affected widgets/gadgets

  • Affected gadgets:
    • pve_boss_priority_targetting (tested)
    • unit_evolution
    • unit_target_on_the_move (tested)
    • unit_prevent_lab_hax
  • Affected widgets:
    • cmd_nanoturrets_assist_priority (tested)
    • cmd_share_unit
    • unit_set_target_by_type (tested)
    • unit_specific_unit_loader (tested)
    • unit_specific_unit_reclaimer (tested)

Testing

I tried testing as much as possible but some cases are a bit tricky like the queen pve boss. The untested ones look pretty safe looking at the code, but pls help testing if possible and look at the code closely.

To test you will need to get this branch as BAR.sdd and setup some appropriate scenario manually.

Fixes issues

  • Errorcode: Error in UnitCreated(): [string LuaUI/Widgets/cmd_nanoturrets_assist_priority.lua]:42: attempt to index local commandQueue (a nil value) , count = 361

Remarks

  • There's other spatial queries without allegiance filters, but I added just the ones where it looks safe to add the filter.
    • Particularly there are some checking with Spring.AreTeamsAllied, those checks the allyTeams are allied, but not sure it's a thing in BAR, most places just check if AllyTeam matches directly.
  • The allegiance filter allows querying just in a specific allyteam/team set, and also saves some checks after that, since they become redundant.

Reference

enum UnitAllegiance {
   AllUnits = -1,
   MyUnits = -2,
   AllyUnits = -3,
   EnemyUnits = -4
};
Spring.GetUnitsInRectangle(xmin, zmin, xmax, zmax, allegiance)
Spring.GetUnitsInCylinder(x, z, radius, allegiance)
Spring.GetUnitsInSphere(x, y, z, radius, allegiance)
Spring.GetUnitsInBox(xmin, ymin, zmin, xmax, ymax, zmax, allegiance)

@saurtron saurtron changed the title Add alliance filter to spatial queries when possible. Add allegiance filter to spatial queries Dec 23, 2024
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.

1 participant