Basic Zone UI Working

Hey Folks! Did some more work on the zone UI today, and I think I've got it working on a basic level now.

I ended up limiting each tile to one zone flag for now, and setting any flag removes all other flags. This is all independent of equipment installation flags such as "walkable" or "obstruction" or "portal." These are for things such as designating cargo areas as available for trade/barter, or managing crew pathfinding to cordon-off areas.

And that was one of the quick things I added to verify it worked: forbidden zoning. Now, AI will not pathfind to or through any "forbid" tiles. This might one day need expansion into role zones, like passenger vs. crew, or high vs. low security zones. But for now, the proof of concept works. And it's even a crude way for me to solve a problem I've been meaning to tackle: crew wandering off-ship the minute they dock.

I also needed to add some extra data fields to ship save files, so the tile zoning flags could get saved/retrieved. Previously, tiles were not explicitly saved in the file, but were instead auto-generated when the ship's parts were added, one-by-one. Now, however, these flags represent data added outside of the part-placement code, so I needed to store that somewhere. For now, it's a simple list of strings per-tile that gets appended to the tile data once the ship is reconstructed from a save file.

Finally, I needed to do some special handling for mouse clicks. The game was deselecting things when clicking inside the zone UI, and this made zoning really clunky. Adding a check before each click raycast to abort if over a GUI item solved that, and all seems well now.

Today's image shows an example of this all in action. We've designated a section of the utilities room in the starting station to be for bartering, and the crew is forbidden from walking into the launch area until I remove the red block zone.

The next step is to mock-up a bartering/trade UI. It'll probably be pretty simple for now. Enough to get the ball rolling, and hopefully get a sense for how resources come and go. The beginnings of a game loop?

Tags: Ostranauts