Hull Patching, and Item Fetching
Hey Folks! Minor update today, as I'm sort of mid-feature right now. I'm working on making the hull-patching process use items from elsewhere on the ship.
Yesterday, we had the new ability to damage floor tiles, and to manually order AI to patch them. This always succeeded, and required no special equipment. And what I eventually want is for the AI to go get the materials for the job first, and then patch the hole. (Think of Rimworld, where the AI runs to the depot to get materials, then to the job site.) Today's image shows the floor, damaged floor, patched floor, and hull patch item in the lower right corner.
This, however, turns out to be a tricky bit of functionality to code. The first piece was to shore-up the item taking/giving code within interactions a bit. The old code allowed for taking/giving items, but it assumed those items were either on the person right now, or not. And it would succeed/fail right away based on that. I needed some interactions to work that way, while others to let the AI fetch the item first. Coding this wasn't too hard, but I took a bit more time on the data side, since there was some clean-up to do there.
Once that was setup, I needed the game to handle the new fetch/don't fetch flag when deciding if it could do an action. And if it was fetching, to keep track of what needed fetching for later. The AI then needed to check this fetch list whenever starting a new task, and if something was on that list, go fetch the item.
This is about where I am now. When the AI is ready for their next task, the code is checking that task for any related fetch items. If present, it's inserting a task to take the item. This task, however, needs to be preceded by a "walk" task in cases where the object is distant. And this task also needs to interact with the object's parent container, if present.
Basically, this is going to mean some specific handling for that type of task. Likely something done through bespoke code, instead of generic data. And some of the scheduling is turning out to be tricky.
Of course, it's also late on a Friday, and I often find my brain is more suited to this type of work earlier in the day. So I'm going to leave it at this for now, and hopefully pick it back up again with a fresh brain Monday. Have a good weekend, all!