Cataclysm-dda: Mutinous fish et al

Created on 12 Feb 2020  路  2Comments  路  Source: CleverRaven/Cataclysm-DDA

Not really a mutiny, but I liked the idea and thought it sounded catchy. Sorry. Earlier, I was going for a little sail on my new canoe. A fish popped out of the water right where I was standing! It was a warmouth! Somehow, I was displaced but yet I was still driving. However, I wasn't _really_ driving, as the fish had become the driver. I passed a few turns without realising what had happened, by which point my sailboat had gotten quite far away from me. I tried to move and got the following error...

captain warmouth

As you can see, there goes Captain Warmouth of the Swift, the most cunning pirate fish of the Cataclysm. Damn that handsome rogue.

Unfortunately, I was too preoccupied with the screenshot to remember the debug log. I still think I had my priorities right, even if it's not as helpful. I mean, that boat is a sail boat. _Imagine that. Seriously. I insist._

Steps To Reproduce

Honestly, I can think of no way to reliably reproduce this beyond dumb luck or a long and boring stint in the map editor combined with the building of a boat.

Expected behavior

Fish don't jack yo' ride.

Version

  • OS: Windows

    • OS Version: MINGW/CYGWIN/MSYS2 on unknown Windows version

  • Game Version: 0.D-12105-gda56791 [64-bit]
  • Graphics Version: Tiles
  • Mods loaded: [
    Dark Days Ahead [dda],
    Aftershock [aftershock],
    C.R.I.T Expansion Mod [crt_expansion],
    Magiclysm [magiclysm],
    Makeshift Items Mod [makeshift],
    More Survival Tools [More_Survival_Tools],
    Mythological Replicas [nw_pack],
    Hydroponics [hydroponics],
    Mutant NPCs [mutant_npcs],
    No Rail Stations [No_Rail_Stations],
    Folding Parts pack [deoxymod],
    Vehicle Additions Pack [blazemod],
    Tanks and Other Vehicles [Tanks],
    Roadheader and other mining vehicles [Heavy miners],
    No Fungal Monsters [No_Fungi],
    Beta National Guard Camp [national_guard_camp],
    ]
<Bug> Monsters Vehicles

Most helpful comment

Well, yeah, that's a bug. But why?

Aha! When a vehicle collides with a monster in water, it pushes the monster out of the way, unless the monster is on a boardable part, in which case it assumes the monster is a legitimate passenger. This is done to keep your car from running over your dog riding shotgun. But it doesn't check if there's already someone at that location, which means monsters can get picked up by vehicles if they collide with the driver. Then, the next time the vehicle moves, the vehicle movement code keeps moving passengers until there aren't two passengers at the same location. Net result, you get boatjacked by a fish, but the game thinks your still driving until you try to get off the boat.

This should fix all that, but I'll need to compile and test it:

diff --git a/src/vehicle_move.cpp b/src/vehicle_move.cpp
index 5f22d25f51..81fb6cc8a6 100644
--- a/src/vehicle_move.cpp
+++ b/src/vehicle_move.cpp
@@ -466,8 +466,10 @@ veh_collision vehicle::part_collision( int part, const tripoint &p,
     }

     if( is_body_collision ) {
-        // critters on a BOARDABLE part in this vehicle aren't colliding
-        if( ovp && ( &ovp->vehicle() == this ) && get_pet( ovp->part_index() ) ) {
+        // critters on a BOARDABLE part in this vehicle aren't colliding, unless there's already
+        // a passenger there
+        if( ovp && ( &ovp->vehicle() == this ) && get_pet( ovp->part_index() ) &&
+            !get_passenger( ovp->part_index() ) ) {
             return ret;
         }
         // we just ran into a fish, so move it out of the way

All 2 comments

Well, yeah, that's a bug. But why?

Aha! When a vehicle collides with a monster in water, it pushes the monster out of the way, unless the monster is on a boardable part, in which case it assumes the monster is a legitimate passenger. This is done to keep your car from running over your dog riding shotgun. But it doesn't check if there's already someone at that location, which means monsters can get picked up by vehicles if they collide with the driver. Then, the next time the vehicle moves, the vehicle movement code keeps moving passengers until there aren't two passengers at the same location. Net result, you get boatjacked by a fish, but the game thinks your still driving until you try to get off the boat.

This should fix all that, but I'll need to compile and test it:

diff --git a/src/vehicle_move.cpp b/src/vehicle_move.cpp
index 5f22d25f51..81fb6cc8a6 100644
--- a/src/vehicle_move.cpp
+++ b/src/vehicle_move.cpp
@@ -466,8 +466,10 @@ veh_collision vehicle::part_collision( int part, const tripoint &p,
     }

     if( is_body_collision ) {
-        // critters on a BOARDABLE part in this vehicle aren't colliding
-        if( ovp && ( &ovp->vehicle() == this ) && get_pet( ovp->part_index() ) ) {
+        // critters on a BOARDABLE part in this vehicle aren't colliding, unless there's already
+        // a passenger there
+        if( ovp && ( &ovp->vehicle() == this ) && get_pet( ovp->part_index() ) &&
+            !get_passenger( ovp->part_index() ) ) {
             return ret;
         }
         // we just ran into a fish, so move it out of the way

Well, yeah, that's a bug. But why?
For a moment there I thought you meant this was a feature, and in that moment I kind of agreed it should be.

Nice one on the fix! It occurred to me earlier that with map editor you could fill a large area with water and fish using the big paintbrush, so I hope that helps with testing.

Also, I forgot to mention this before, but the fish may have surfaced beneath me, or during the move. I'm not entirely sure. It was very recent either way.

Was this page helpful?
0 / 5 - 0 ratings