Droppin' Stacks

Hey Folks! Unfortunately, the fat stacks we are dropping today are not fat stacks of cash, but rather Trenchers-brand Kung Pao Chicken.

The next task on my list was to fix whatever was wrong with dropping items from crew inventory. And thankfully, that wasn't too hard. It turns out the food was looking for nearby other food items to stack on, and decided to stack on other food in the crew's inventory. Since we were trying to drop this food on the floor, that was obviously an error.

So I changed the "search nearby" code to filter out items in our pockets, and it seemed to work! For a minute.

It turns out this was hiding a different bug wherein the crew would be trying to eat the same food it was trying to drop. This initially manifested as getting stuck in a situation where the crew was waiting for the food to drop, and the food was waiting for the crew to finish eating it. They would both end up waiting for an hour if left alone.

And what's worse, if I tried to cancel this waiting game by walking somewhere, I'd crash the game by entering an infinite loop. It turns out that if two objects are involved in an interaction, and one of them has a second interaction in the queue on the same target, they just ping-pong between each other waiting and cancelling, over and over.

In the end, I just added an extra check after cancelling the target's waiting to see if the next interaction also targeted us, and cancelled that too. And that was enough to break the loop. We could successfully drop food items! And not get stuck in loops! And they stacked on the floor!

But, one problem remained. The stack counter on objects was missing. And fixing it is turning out to be a bit tricky. Ever since I changed the rendering engine for the sprites, some UI stuff has no longer worked. And this is one of them. The bad news is that fixing it is going to mean finding new ways to render all the stuff that used old Unity rendering engine techniques.

The good news is, once I figure out how to get one of those things to render, the rest should be easy. And in theory, that might fix several bugs on my list! Things like stack counters, missing crew labels, tile highlights, and more.

That'll have to wait until Monday, however. For now, it's weekend time. Have a good one, all!

Tags: Ostranauts