Save/Load Fixes, Finance, and Trading
Hey Folks! Much more productive day today, though the work was largely fixing bugs. So not exciting to look at.
The day started with a test run where I dock with a derelict, and instead of retrofitting it, I decided to try and loot its contents. Take the spare space suits, clothing, food, hull patches, and scrap materials I could find, then see if I could pawn them off at K-Leg.
The looting went fine. I managed to stuff a pretty large amount of scrap and equipment into my infinite pockets, then made my way to K-Leg. But once there, I couldn't find a person to trade with. Everyone I started trading with didn't have a barter zone, so I couldn't confirm the trade. And when I looked into this, things started falling apart.
Opening up the zone info for the ship showed a major corruption in zone info. I think when I updated the K-Leg tilemap, it added new tiles to pad one or more sides, and that screwed up the zoning info. That's now on my to-do list.
Also, I couldn't type in the new zone name without triggering map scrolling. Not a major issue, but annoying enough. So I added code to halt key input in the game while typing.
I also tried undocking and re-docking to test something, and noticed my old low-precision pushback vector was still in play. I shot away from the station at 50km/s and wasn't able to ever return. I updated the pushback vector to be a more realistic 5m/s, using the new high precision values supported by the game.
I updated the ship editor so it wouldn't spawn crew and loot in a ship template, since that should only happen once the ship is in the game.
Then I came to a bigger problem. K-Leg had its room data all messed-up after saving and loading. Specifically, when saved and loaded at a different rotation than when it was initially spawned. It turns out the way I was assigning rooms to a ship was sensitive to rotation, and I had to rewrite it so it used the unique and immutable IDs stored in the ship data to reattach room objects to their saved data.
That turned out to be the biggest task of the day, as it was a bit of refactoring. But the good news is that docking behaves more stably across save/loads.
From there, I returned to looking at trading, and noticed my finances were not saving correctly. For whatever reason, it was creating the save data but never writing it to the ship, so I fixed that.
And that's where I'll likely resume tomorrow. I should be able to load my save file, see the docking fees restored to my ledger, and I can get back to making sure my captain has a place to sell his loot to pay off the debts.