Installing Equipment Without Debug Commands
Hey Folks! After getting uninstallation working yesterday, I'm trying to add the reverse today: installing equipment.
A little over a month ago, I was able to get equipment to reinstall elsewhere on the ship by using a debug command. As long as only one crew member was selected, and the cursor was over a valid item, I could press a hotkey to re-place it elsewhere on the ship. It reused a lot of the ship editing UI stuff, and then the crew would go through the steps to retrieve the original and move it to the new place.
Unfortunately, that's a lot of "ifs." It also bypassed a lot of the built-in game functions for controlling interactions, which means I couldn't have branching outcomes, required tools and parts for the job, etc.
So today, I tried to integrate that installation stuff into the interaction system, where a player could right-click on an installable item, and one of the available interactions would be "install." In theory, they'd still use the ship-editing UI to place the part in its new home, and then the game would hand back off to the interaction system so the crew finishes the chain of actions. Tools, parts, conditions, and all.
It was a real square peg/round hole problem, though. I spent a good chunk of the day planning and rewriting different approaches.
But I think I'm nearly there. With a crew member selected, I am able to right-click a conduit, choose "uninstall," and they'll grab the nearest drill on the ship, then go to the conduit and uninstall it. Then, I can right-click on the conduit, choose "install," and the ship editor UI appears with a ghosted placeholder version of that conduit that I can place.
In today's image, those placeholders are in the top left of the screenshot. And if you look at the bottom of the screenshot, you can see Lucas's queue includes an action to "PickupItem" and then "Install" it.
Unfortunately, that last part, installation, fails. I need to find a way to tell Lucas to perform "ACTConduitJunctionInstall," which has logic for success/failure based on tools. And if he succeeds, I need the next interaction to be the special "swap placeholder with original" interaction. But that's tricky to do. An interaction always happens between "us" and "them," but this installation has three participants: us, them, and placeholder them.
One thing I added today might help, though. Historically, every interaction between us and them could generate a reply, and each reply would swap us and them. E.g. "us flirts with them." And the reply would be "them pushes us away in disgust." It works well enough for simple conversation. And for more one-sided things, I could sometimes fool the game by making every odd interaction silent so it looks like "us" keeps talking.
However, there have been a bunch of times, like today, where I wished I didn't need those hacky silent in-between interactions to skip "them." So I added code today to optionally do just that. A reply can now specify who the "us" and "them" in the reply are, which allows me to do multiple "us" in a row, or vice versa.
In theory, I could bend this a bit further to specify a third party. I.e. the placeholder "them" from this installation ménage à trois.
So tomorrow, I'll have to look into that.