Hey Folks! Hope everyone had a good weekend. It was pretty much wall-to-wall for us, between household maintenance and a trip to the zoo with the little one. Hardly feels like we relaxed at all!
And in keeping with that momentum, I decided to tackle stacking items today :)
I'm pretty sure I'm going to need stacking at some point, so I dug into the code. And as predicted, it's pretty hairy. There's a lot of record-keeping and juggling of references, hiding and revealing of objects, and a lot of conditional placement.
If we remove an item from a container, are we removing its entire stack? Or just one from the stack? What if we place a stack onto a stack that doesn't have room? What if we place an item onto a full stack? What if we need to drop an item nearby, which now requires we check if it has a stack, if the destination tile has a stack, and how that fits?
Lots of permutations and edge cases. And NEO Scavenger ran into a lot of them. I was able to use a bit of the old NS code to review some of the harder-to-predict edge cases. But I still have to rewrite a lot of the code, owing to differences in things like NS's "ground" slot, barter hex, and the fact that I don't have things like charges/item-shutdown yet.
The good news is that a lot of the overall architecture is pretty similar between NS and the space prototype. At least as far as items are concerned. I still have to concepts of containers, adding and removing items, and can hang code off of a lot of the same places.
But I'm only about halfway done writing the code after a day, and I suspect I'll have at least a day of testing and fixing once it compiles.
The good news is that, when finished, I can use a laser torch on a wall to get 5-25 pieces of scrap aluminum, 10-50 garbage pieces, and not have to use every floor tile to store them all :)