You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to detour WaterLevel with your custom water system so that aquatic-based NPCs can at least swim around? They also utilize the MASK_WATER filter when moving, Im not sure if that's something that could be added into your water system or not tho
The text was updated successfully, but these errors were encountered:
Looking at Source's sauce, the CPP function operates as such
// Search for water transition along a vertical line
float UTIL_WaterLevel( const Vector &position, float minz, float maxz )
{
Vector midUp = position;
midUp.z = minz;
if ( !(UTIL_PointContents(midUp) & MASK_WATER) )
return minz;
midUp.z = maxz;
if ( UTIL_PointContents(midUp) & MASK_WATER )
return maxz;
float diff = maxz - minz;
while (diff > 1.0)
{
midUp.z = minz + diff/2.0;
if ( UTIL_PointContents(midUp) & MASK_WATER )
{
minz = midUp.z;
}
else
{
maxz = midUp.z;
}
diff = maxz - minz;
}
return midUp.z;
}
This should be replicatable in the sense that the trace position would be detoured like everything else, WaterLevel in lua has no arguments but the required information can easily be set and ran with a code similar to this instead of the default WaterLevel running
Would it be possible to detour WaterLevel with your custom water system so that aquatic-based NPCs can at least swim around? They also utilize the MASK_WATER filter when moving, Im not sure if that's something that could be added into your water system or not tho
The text was updated successfully, but these errors were encountered: