IPhysicsFluidController Interface

I stumbled across this some time ago in the func_movelinear.cpp:

All the water in the source engine is basically a IPhysicsFluidController tied to an IPhysicsObject (the same as props use) with the collision type set to FSOLID_VOLUME_CONTENTS. These controllers are controlled used with two functions: CreateFluidController and DestroyFluidController (in vphysics_interface.h). A good usage example is beginning at line 134 of func_movelinear.cpp.

Request:

  • An interface for CreateFluidController and DestroyFluidController so they can be used in lua.
  • The fluidparams_t should be a table on lua side.
  • The values should default to those used in func_movelinear.cpp.
  • Make the default surface plane {0, 0, 1, 0}.
  • pGameData should take an entity and be required (I guess source uses this to check if the water entity is still in the game).

Why this would be useful:

  • Source simulates all water physics using IPhysicsFluidController. This includes players swimming and props slowing down when crashing into water.
  • The fluid properties should allow anything from tar-like rivers over streams with strong currents to bubbles with air like (physics) behavior under water using negative density and damping values.
  • Physics objects can go into sleep mode while floating on this kind of water.
  • Think about a swep that creates a bubble of water around you, making you swim in the air and drown headcrabs! :smile:
  • Flood Mod on every map!