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

Put players with no squad preference in random squads again #7896

Merged
merged 1 commit into from
Dec 24, 2024

Conversation

sg2002
Copy link
Contributor

@sg2002 sg2002 commented Dec 23, 2024

About the pull request

This fixes a problem introduced in #6588, where marines with no squad preference started to get assigned squads in a deterministic order, where if Alpha has a job slot open, you always get assigned to it, then to Bravo and so on... And since there's no cap on riflemen, all riflemen with no squad preference would always be assigned to Alpha.

Before I fully understood that such a minimalist change would work, I actually did a bigger rewrite. That version is more computationally complex, but may be simpler to understand, due to being somewhat better abstracted. Just giving that as an option for maintainers too, if they're interested.

I did a bit of testing on the local server, seems to work fine.

Explain why it's good for the game

Do we really want Alpha to suffer me as their SL every single round?

Testing Photographs and Procedure

Screenshots & Videos

Put screenshots and videos here with an empty line between the screenshots and the <details> tags.

Changelog

🆑 sg2002
fix: players with no squad preference get correctly put into random squads
/:cl:

@cmss13-ci cmss13-ci bot added the Fix Fix one bug, make ten more label Dec 23, 2024
@harryob harryob added this pull request to the merge queue Dec 24, 2024
Merged via the queue into cmss13-devs:master with commit 5ac6087 Dec 24, 2024
28 checks passed
cmss13-ci bot added a commit that referenced this pull request Dec 24, 2024
@blackcrystall
Copy link
Contributor

blackcrystall commented Dec 25, 2024

		if(!lowest)
			lowest = squad

		else if(slot_check)
			if(squad.roles_in[slot_check] < lowest.roles_in[slot_check])
				lowest = squad

Arent working? hmmm, strange, basicaly what it did, check for balancing purposes (aka same ammount of marines in every squad for every role if you don't have pref or pref is full)

Ah yeaaa... I seee
But we still don't need shuffle, because you unlocked preveusly not used code for balance marines

		if(preferred_squad == "None")
			if(squad.put_marine_in_squad(human))
				return

		else if(squad.name == preferred_squad || squad.equivalent_name == preferred_squad) //fav squad or faction equivalent has a spot for us, no more searching needed.

Basicaly I did minor misstake here... with insta putting marine in any squad first is found if no pref

@sg2002
Copy link
Contributor Author

sg2002 commented Dec 25, 2024

That shuffle is useful to have for lowpop purposes where if you're the only person rolling SL(engie, medic) you'd still be randomized instead of always getting Alpha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Fix one bug, make ten more
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants