DIFF

class CCTLiquid

CCTLiquid › CCTBase

Lightweight liquid target condition.

Handles the two paths that every liquid action needs: - liquid source objects (wells, barrels, ...) - liquid surfaces under the real (engine provided) action cursor

The camera based synthetic cursor / sea level cursor reconstruction lives in CCTLiquidSyntheticCursor, so actions that do not need it (drinking, filling, washing, snow, ...) never pay for it.

All engine queries go through CCTLiquidFrameProbe, which shares them between every liquid condition evaluated in the same frame. This class only holds the per action parameters (liquid mask, reach) and applies them to the shared result.

Constructors 1

Constants 3

protected const float LIQUID_SURFACE_RAYCAST_OFFSET = 0.2
protected const float MAX_HEIGHT_DIFF_SURFACE = 0.25
Referenced by CheckSurfaceLiquid()
protected const float SEA_HIT_RAW_Y_TOLERANCE = 1.25

Members 12

protected int m_AllowedLiquidSource
protected int m_SurfaceDetectionType
Referenced by CanInternal(), and CCTLiquid()
protected bool m_CanBeSaltwater

Precomputed mask tests, so the per-frame paths are plain bool reads.

protected int m_LiquidType = LIQUID_NONE
protected int m_WaterSourceType = EWaterSourceObjectType.NONE
protected int m_LiquidSourceType = ELiquidSourceObjectType.NONE
protected string m_ProfilerName = "CCTLiquid::Can"DIAG_DEVELOPER

Methods 17

protected bool ResolveSyntheticCursor(PlayerBase player, vector playerPos, ActionTarget target, Object targetObj, vector hitPosition)

Hook for camera based cursor reconstruction. The base condition has none.

Returns: true when the cursor was resolved and m_LiquidType was set, the caller must then not run the generic surface checks.

Referenced by CanInternal()
protected bool IsValidLiquid(int liquid)
Referenced by CanInternal()
protected bool IsValidTargetObject(vector playerPos, vector objectPosition, EWaterSourceObjectType waterSourceType, ELiquidSourceObjectType liquidSourceType, bool isProxy)
Referenced by CanInternal()
protected bool IsWellInReach(PlayerBase player, vector playerPos, Object well, vector hitPosition)

Check vertical distance first, it is the cheaper of the two.

Referenced by CanInternal()
protected bool HasClearPathToLiquidSurface(PlayerBase player, vector surfacePos)

Do not allow water merely below grass/terrain.

protected bool CheckSeaLevelFallback(vector hitPosition, vector playerPos)
Referenced by CanInternal()
protected bool TryGetLiquidSurfacePosAt(vector probePosition, out vector surfacePosition, out int liquidType)
protected bool IsCursorActuallyOnLiquidSurface(vector hitPosition, vector liquidSurfacePos)

Engine query last.

override bool CanContinue(PlayerBase player, ActionTarget target)

If terrain/grass/road surface is higher, the player is aiming at ground over/near water, not the water itself.

int GetWaterSourceType()
int GetLiquidSourceType()