AI Using Doors; Room Atmo Using Condition System

Hey Folks! More progress today on the latest two additions to the game. And while the work doesn't include new systems, it goes quite a way towards making both of these game-ready and interactive.

First, I finished up getting the AI to work with doors. AI now can pathfind through closed doors, and if a closed door is in the path, the AI will stop, interact with it, and wait for the door to open before continuing. And in theory, the doors should adhere to all the usual interaction rules, so AI's shouldn't run into issues of both using one at the same time, etc.

There were a bunch of issues that needed fixing to get this to work, such as checking if the door is busy so AI doesn't spam open interactions on it, cleaning up old door objects when they switch (closed vs. open), and moving the UI bracket from deleted objects to the new one.

Once that was done, I started thinking about how the AIs (and eventually, other ship items) are going to interact with room gas, temperature, and pressure. Since each of those values were just numerical properties on a room, the interaction/condition system (ICS) didn't really see them. And I was reluctant to hard-code the ICS to affect those values, since the list would likely grow.

Instead, I think I found a way to convert the rooms to take advantage of the ICS by giving each of them a "condition owner" (i.e. thing that has stats and conditions and can interact). Then, each room could be given condition stats for gas amount, temperature, and pressure. AIs could then interact with the room, and depending on the room's stats for gas, temperature, and pressure, the AIs could be affected for better or worse.

For example, AI might have some reservoir of O2 they can survive on for up to 3 minutes. Each turn, that AI interacts with the current room to see what the O2 levels are. If the O2 levels are normal, nothing changes. If the O2 levels are too low, that reservoir depletes. And as it depletes, that AI goes through stages of hypoxia (similar to how hunger works in NEO Scavenger). If the O2 levels return to normal (or AI enters a room with O2), that AI's O2 reservoir stat would slowly tick up.

I think the same could be done for temperature and pressure, as well.

I think the only tricky part here will be some of the code glue to make these pieces stick together. I'll need to add some way for AI and other condition owners to get access to the room condition owner in order to interact with it. So the current method of searching for condition owners needs to include rooms now (instead of just AIs and shipboard items).

Another tricky part is keeping the complicated math out of the ICS system. Room-to-room gas transfer and temperature propagation is probably doable using ICS, but would be terrible to maintain. Instead, I'm going to hardcode that transfer rate stuff, and store the results in the ICS conditions. This way, AIs can still access the data, but the math for it is done in faster (and easier to maintain) code.

Some questions still remain, such as partial pressures for things like O2, CO2, CO, and other contaminants. I want there to be fouled atmo in certain rooms if the life support stops, or a fire breaks out. Simple gas pressure and temperature isn't enough, even though both are important to survival. Ideally, rooms would know how much of that pressure is O2 vs. other inert or toxic gases.

Probably doable, but I just haven't looked into it yet. I'm guessing the room will probably have its custom gas exchange code process all conditions with a certain prefix like StatGas___, and use that to total the overall pressure. Then, the ICS kicks-in when the AI needs to know about O2 and other specific gas amounts.

Anyway, enough about that. It's officially beer o'clock on Friday. So I'm going to go attend to that need :) Have a good one, all!