Open Scorch-Mechanic opened 2 years ago
The work around for characters who are inside vehicles they aren't inside, as well as outside of vehicles they supposedly aren't inside of, is to get them out of the vehicle and then board it again. That will stop the spam (once per move, while it lasts) and clear the error.
There are cases where the code move characters out of vehicles without invoking the code that clears the status of being inside, and the code currently spams error messages rather than severing the broken connection (it should probably still report the error, but clear the broken relation while doing so).
That would probably have made the reported error situation worse, though, as my guess is that becoming a companion somehow caused the vehicle connection to be severed, so the fresh companion would end up on the ground rather than inside the vehicle. In this case, the recruitment code should probably have code to detect if the character is inside a vehicle when recruited and ensure that relation is kept/restored rather than mangled during the recruitment. In general, each of the cases where characters are removed from vehicles ought to be tracked down and fixed, which, in most cases, means removing the connection to the vehicle the character is no longer in (this has been caused by characters flung out of vehicles, as well as companions teleported away from vehicles when assigned to base camp tasks, and probably other situations).
This sounds like another version of https://github.com/CleverRaven/Cataclysm-DDA/issues/52531, where the vehicle is removed from the npc, except in that one the player entering the vehicle clears all the error flags. I suspect in this case the player entering the vehicle severed the broken npc-vehicle connection and cleared the errors, but that left the npc in the tile where the seat was, but not actually in the vehicle. That would explain why pulling the npc away from the vehicle before the player re-enters it works to re-establish the correct npc-vehicle relationship.
The NPC was not in the vehicle when I recruited it, it was outside. After I recruited it, and took back all my stuff. I got back into the car. Granted I didn't get back out of the car after re-entering it after recruiting the NPC.
There are definitely some added complications here. In this case it looks like the NPC-vehicle connection was already broken before you recruited her, since you got the errors returning from the mission, so it wasn't the recruitment completion step that broke the connection. If she re-entered the vehicle before you, like if you opened a car door and she jumped into the car first, then that would be consistent, and you'd need to get her out and back in again to establish a correct npc-vehicle relationship. I also wouldn't be surprised if a cart with broken on-board flags might transfer those broken flags when attached to a bike rack. Anyway, hopefully once the cases they can reproduce get fixed, this one will too. I suspect it is a non-trivial problem.
The main thing to remember is, whenever you see map::unboard_vehicle: vehicle not found
messages, step on any tile of the vehicle to clear the flags, and the error you see will tell you which NPC caused the problem, and then make sure that NPC gets off and then back on before moving the vehicle.
I see I was unclear about exactly the locations of the NPC at all times. Let me reestablish the chain of events, as near as I can tell:
I built the scout bike expressly for this sort of task and included only folding parts so it could stored in a cargo space, and would not need bike racks.
The bike rack thing was just FYI in case you use carts. They step on them a lot. I should really actually test that. And sometimes nearby NPCs will jump in front of me into the vehicle, and so entering the car before I do. In my experience, if the NPC is already in the car when I get the error message telling me that NPC had a broken vehicle connection, then driving away without pulling that NPC out and re-boarding them is a bad day for them.
It seems to me the NPC was tied to the vehicle as you left the bubble, but then when you returned it was respawned outside of it, causing it to exit the vehicle without triggering any code to sever the connection. It's odd, however, the the (now) companion managed to enter the vehicle without restoring the connection properly. As a guess, the NPC->companion somehow caused it to break worse than in the normal fail cases.
As I mentioned, and showed in https://github.com/CleverRaven/Cataclysm-DDA/issues/52531, it isn't the movement of the NPC back onto the vehicle that clears the error condition, it's the PC moving onto the affected vehicle which then clears all the flags - both on the vehicle and those on the offending NPC.
Describe the bug
She was sitting in the passenger seat, I started the Battlecube™ and started to reverse, and she got slammed and rammed a bunch and then died before I figured out what was going on.
Before all that happened, as I was returning to my vehicle where the NPC I was about to recruit was (I found her rummaging through my vehicle, thieving my stuff, but her mission was easy so I just grabbed my foldable dirtbike and did it) near it, I was seeing a weird error message that didn't make any sense to me:
21:56:57.126 ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\map.cpp:1077 [unboard_vehicle] map::unboard_vehicle: vehicle not found
This was spamming me so much as I approached my vehicle that I told the game to ignore it. Once the NPC follower was recruited and I was ready to move on, I got in the driver's seat, saw that my NPC follower was in the passenger seat, started the vehicle, and put it in reverse.
I checked my debug.log and here's the last message in it, proceeded by the above error message:
21:57:42.145 ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\map.cpp:1038 [board_vehicle] map::board_vehicle: passenger (Marquita 'Zonie' Vitale) is already there
According to my log, she died inside one second of me starting the car and reversing. I couldn't have been going more than five or six miles an hour in reverse.
Notably, her corpse appeared on the ground in a spot not in line with the passenger seat. My Battlecube™ is three interior tiles wide, with the driver and passenger seats separated by a refrigerator. Despite visibly being in the passenger seat, her corpse appeared on the ground underneath the vehicle in the centerline. I was reversing straight south, and not at any angle.
Steps to reproduce
I have no idea how to replicate this. I've never seen it before.
Expected behavior
NPCs should be where the game says they are, and should not get slammed around vehicles despite being in seats with a five point harness installed.
Screenshots
Versions and configuration
Additional context
EDIT: After making this bug report I tried to walk over the passenger seat and got a couple more weird error messages that did not repeat and only appeared once:
22:38:05.210 ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\map.cpp:1038 [board_vehicle] map::board_vehicle: passenger (<null>) is already there
22:38:12.082 ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\map.cpp:1060 [unboard_vehicle] map::unboard_vehicle: passenger not found