Wednesday, June 12, 2024

Light Editor Interfaces and Encumbrance

Just an update that's more for me this evening as I got stuff done, but it's really for my needs rather than the game itself. I got into the editor code and tweaked up the last bits so that when I create an effect or item and give it a lightsource, the editor now displays it properly, then cleans everything up when the next item is selected. Not interesting, but needed to create items and effects in the long run.

I then started on encumbrance management. I already had items with a weight setting, so it was just a matter to increment the character's weight value when they do something with the item... And that's about where things fell over. I had mentally thought it was going to be in the code that equips the item, but that's actually incorrect. Players can find/create/dispose/trade/buy items without equipping them, so I need to go back up a level so to speak, but I ran into the problem in the code that that "level up" as such doesn't exist in a single place, but rather throughout many, many, many different sections of code. Way too many places doing way too many things for me to finish it off in the time I have left this evening, so I'll leave that for a fresh evening's work tomorrow and see if I can get it done in a single sitting - which I would prefer for my sanity.


Edit: I had a great idea, which was to use another bit of code I had which updates the item owner, which would kind of work... as it is called from most of the places I just found above, but it's also going to fall over when the owner isn't changed but the quantity is... which then led to "What if I change it in BOTH those places?" which is where I am at currently... and it's maybe possible. It feels like a band-aid solution, but it might be enough.

Edit 2: I'm trying to see if I can get away with doing it in just those two sections of code and have things work.

Edit 3: It seems to have worked mainly. Seems there's at least one bug (my encumbrance didn't increase when I bought an item I already had a stack of - but it also did fix itself perfectly when I then reloaded the game with the correct weights - so not exactly a gamebreaker issue)

No comments:

Post a Comment

Sometimes you do the same thing really well. Twice.

And each time, you do it for the first time. So, lets start with some back story here. While I was doing all the recent changes to the code ...