Wanna Buy a Food Packet? No? How About a Floor?

Hey Folks! The zone/trade refactor continued today, and is mostly working now. I can add and remove zones from a ship, and use them in the trade UI.

There were still a handful of gotchas to solve in wrapping-up the zone UI. Adding a name to the zone was particularly tricky, as I had to deal with user-edited names as well as default "Zone 1" style names. Then, some logic to handle removing zones when all tiles in the zone were changed to other zones (or null zones). I added code to select an entire zone by clicking one of its tiles.

There was also the trigger ("Owner" drop down) to control who the zone belongs to. In 99% of cases, this will be the player. But when someone is editing ships (i.e. me or a modder), there will need to be other triggers like "all bartenders from Hangzhou").

There was a slight UX problem with scroll wheel causing zoom to happen when trying to scroll the dropdown list, as well as an infinite loop when trying to load a save file (rotation of item failed to get exactly the right value and spun endlessly).

Finally, some code was retrofitted to all my full-screen GUIs so they can optionally pause and restore the game when they appear/disappear. Trade will be one such UI, since AI moving items around and/or using them while it's up can make things wonky.

Once all this was done, I fired-up the game, designated a pile of hull patches as the player barter zone, and spawned Davi Monroe so I could trade with her. And as you can see in today's image, it works! Sort of.

We see food packets from both AIs as tradeable (good), as well as our player's hull patches from the barter zone! (Also good.) However, we also see the ship's floor structure, and the abstract constructs for the room and tiles of the barter zone. (Bad.)

So my next task is to add some more flags to items to designate them as system objects (GUI, invisible objects, etc.), or installed items (like floors, walls, etc.). I'm thinking that salvage will involve uninstalling items from the target ship, which converts them into a transportable, "uninstalled" version (which lacks the "installed" flag). This uninstalled object (e.g. a nav computer or water purifier) somehow gets placed in a zone on the player's ship setup for resource gathering. And later, the player can choose to install the item on their ship, or sell it via bartering.

Now that I type this, I realize the gathering zone and the barter zone might need to be the same tiles. Even if barter zones were separate from gather zones, I'd need a way to get items from one to the other, which is sort of saying barter zones are a type of gather zone anyway (i.e. to define which items should be dropped there).

Hm. Not necessarily an unsolvable problem. But might warrant some thinking!