For a while I've been thinking about if it was possible for me to use the $dispatcher (which is what we call the complicated object that dispatches npcs to do scripted actions like start a gang war or backup their friends in a fight) to have an NPC take a taxi.
A year ago it wouldn't have been possible but we've added a lot of code around pathing, and dispatching npcs that gave me the feeling this could be accomplished with the $dispatcher now.
It's a -really- complicated set of actions with a lot of edge cases that might seem 'easy' on the surface. Let's break down what has to happen:
1. Is there a PC taxi driver online?
1A. Is the PC taxi driver in their vehicle?
1B. Is the PC taxi driver 'available' IE not driving someone else?
2. NPC needs to call for a taxi.
Well, not really. We just have to simulate it, which is the case here because there is no value in having the NPC actually call the number and talk to a script. It doesn't add value so we simulate it.
3. NPC needs to wait for the Taxi to arrive
3A. Taxi needs to be unlocked and not moving
4. NPC needs to enter the taxi
5. NPC needs to speak loudly
6. NPC needs to state their destination
6A. NPC should state the 'meter' should be used so we can track how much to pay at the end of the trip.
7. NPC needs to detect when they've arrived.
This seems easy but as many of you know, if you ask to go certain places, a Cab will get you as close as it can-- but maybe not all the way. So we need to know when we are 'near' a destination, or 'good enough' basically.
7A. NPC needs to restate destination if they haven't arrived, aren't close, and are 'stopped'. But not in an express tube because traffic causes a vehicle to stop and we don't want to spam.
8. NPC needs to pay.
Easy. But... what if they don't have any money? What if they have only part of the fare? I had to add an 'eject' verb to taxis that players can use so they can dump patrons that don't pay. Seems legit, since NPC drivers can do it.
9. NPC needs to exit.
10. NPC needs to make small talk during the trip.
There are a lot of little edge cases that had to be covered as well that I don't go into here, but suffice to say it took me almost a week to get this into the game.
So, all that being said, this is now a thing! It will happen a few times a day if there are PC drivers online, and there should be a fair disposition of who gets the call as I've randomized which taxi gets the call if there are multiple PC drivers online.
I think this adds a great amount of depth to driving a taxi around as you don't have to only be getting PC fares all the time, you can get NPCs too. I had this extensively tested by a player (THANK YOU) and they did a wonderful job of roleplaying with the NPCs who were in their cab. I was really impressed. I think the small talk adds a fun bit of flavor to the interaction.
As always, please report issues with the new code.