Hey Folks! Continuing work on the roster/schedule UI today, mostly on getting the widgets hooked-up to in-game entities.
The button alignment issue I ran into late yesterday was actually due to child text labels having widths that extended beyond the button. I guess they intercepted clicks for the parent button, and the order of preference favored buttons to the left (added earlier to the list). Adjusting those labels to match their parents worked.
I spruced-up the roster header area to have clearer labels, and fixed several of the toggle buttons appearances when activated. (They were missing their checked status image.)
Once those last layout issues were solved, it was on to the game data. I setup a "company" data type to store a list of crew and their rules. And each of those rules includes the hourly schedule info and shore leave. The UI received some listeners to apply any changes to the crew being edited, and the overall game received some code to save/load the settings to the game save.
I also had to fix an edge case where the player changes their official ship, as in the case when the player launches from character creation into their first ship.
Finally, I added some code within pathfinders to abort any attempts to leave the assigned ship if they have no shore leave. Once that was all in place, I tested AI pathfinding, and you can see the result in today's image. Our crew member, Valentina, was denied permission to board another ship, since we set her "Shore Leave" to false.
My original assumption was that only the player's "company" mattered, so there would be no need to save such data for non-crew NPCs. However, pretty much immediately upon testing, I proved myself wrong. Crew on stations and other ships we dock to should probably have their shore leave set to false, as well. We don't want them coming aboard without permission.
On the other hand, a hostile boarding party should have permission from their "company" even if we haven't granted it.
So I think this means at least one change: each crew is going to need a company designated for holding such permissions. This might end up just being the beginnings of a faction system, so we have a handful of company/faction entities for controlling who can go where.
This might also mean we have two sets of shore leave permission. One for permission to debark from our captain, and another for permission to board from the target ship's captain. Violating either results in some repercussion.
That might be better saved for down the line sometime, though. For now, this allows us to corral our crew when docking, in order to prevent accidental depressurization or other dangers. That was kind of the reason for adding this all. That, and designated sleeping times.
I think the next important piece here is an invite and dismiss tool. Dismiss is already covered by this new Roster UI, and I just need to hook that up. Invitation can probably just be a special interaction type, so hopefully won't be hard, either.
Once those are in, I can recruit crew for my ship, and remove them. And then, probably return my focus to what the player actually does with said crew. Which, for now anyway, is probably a mix of salvaging derelicts for profit, and dealing with drama during transit.