-
Notifications
You must be signed in to change notification settings - Fork 112
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
Remove unit from groups too on SetUnitNoSelect. #1849
Remove unit from groups too on SetUnitNoSelect. #1849
Conversation
22aaebf
to
65ac9d5
Compare
I'm not sure, there's plenty of use cases where a unit can become unselectable just temporarily in which case you may want to keep its group. For example:
AFAIK skirmish AI can use groups for general internal organisation too, see #1334. Having a separate |
Well, atm it's optional through a parameter, wouldn't that cover the use cases you mention? Otherwise api users can use Spring.SetUnitGroup(unitID, -1), but thought this change makes it more straightforward to just do it in one call, no biggie otherwise. Also tbh not sure whether the unit can still be added to groups after noSelect is set, not sure what to do about that but maybe we need a SetUnitNoGroup... but then a new flag would be needed maybe. |
What is optional through a parameter? I don't see one. Sprung has some good examples of cases where you'd want noselect units to retain their group. Leaving units in groups seems like the non-harmful default behaviour because you're not going to be selecting those units anyway. Calls should be atomic. Don't combine two things into one call. It makes the code confusing to read and adds unexpected side effects when writing it. If someone sets noselect and comes across a bug caused by groups, then they can remove the unit from the group too. If a game dev finds that they are applying the same operations all the time, then they can make a utility for it in lua. I think it's pretty clear that this PR doesn't prevent units from being readded to groups. If it did, then that would be an engine bug. Add Spring.SetUnitNoGroup if you have to, and make sure it both removes units from groups and prevents them being added. |
Right, I thought I put a bool at the function to control that but seems like I didn't, sorry about that.
True, but I think the unit would still affect the group centroid.
Ok, here it is: #1853 |
Closing this in favour of #1853 |
Work done
Remarks