DayZ 1.24
Loading...
Searching...
No Matches
CCTWaterSurface Class Reference
Inheritance diagram for CCTWaterSurface:
[legend]
Collaboration diagram for CCTWaterSurface:
[legend]

Protected Member Functions

void CCTWaterSurface (float maximal_target_distance=UAMaxDistances.DEFAULT, string surfaceType="")
 
override bool Can (PlayerBase player, ActionTarget target)
 
override bool CanContinue (PlayerBase player, ActionTarget target)
 

Protected Attributes

const int HEIGHT_DIFF_LIMIT_METERS = 1.0
 
float m_MaximalActionDistanceSq
 
string m_SurfaceType
 
ref array< stringm_AllowedSurfaceList
 DEPRECATED.
 

Detailed Description

Definition at line 1 of file CCTWaterSurface.c.

Constructor & Destructor Documentation

◆ CCTWaterSurface()

void CCTWaterSurface::CCTWaterSurface ( float maximal_target_distance = UAMaxDistances.DEFAULT,
string surfaceType = "" )
inlineprotected

Member Function Documentation

◆ Can()

override bool CCTWaterSurface::Can ( PlayerBase player,
ActionTarget target )
inlineprotected

use hit position from ActionTarget otherwise player's position

special handling for sea

Definition at line 18 of file CCTWaterSurface.c.

19 {
20 if (!target || (target && target.GetObject()))
21 return false;
22
24 vector hitPosition = target.GetCursorHitPos();
25 if (hitPosition == vector.Zero)
26 hitPosition = player.GetPosition();
27
28 string surfaceType;
29 float waterLevel = player.GetCurrentWaterLevel();
30 g_Game.SurfaceGetType3D(hitPosition[0], hitPosition[1] + waterLevel, hitPosition[2], surfaceType);
31
32 if (waterLevel > 0.0)
34
35 float surfaceHeight = g_Game.SurfaceY(hitPosition[0], hitPosition[2]);
37 if (!surfaceType)
39
42 return false;
43
44 float distSq = vector.DistanceSq(player.GetPosition(), hitPosition);
46 return false;
47
49 }
DayZGame g_Game
Definition DayZGame.c:3528
const int HEIGHT_DIFF_LIMIT_METERS
Definition EnMath.c:7
static bool AllowedWaterSurface(float pHeight, string pSurface, array< string > pAllowedSurfaceList)
Definition Surface.c:8
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static const vector Zero
Definition EnConvert.c:110
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat(), Surface::AllowedWaterSurface(), vector::DistanceSq(), g_Game, HEIGHT_DIFF_LIMIT_METERS, m_AllowedSurfaceList, m_MaximalActionDistanceSq, and vector::Zero.

◆ CanContinue()

override bool CCTWaterSurface::CanContinue ( PlayerBase player,
ActionTarget target )
inlineprotected

Definition at line 51 of file CCTWaterSurface.c.

52 {
53 return true;
54 }

Member Data Documentation

◆ HEIGHT_DIFF_LIMIT_METERS

const int CCTWaterSurface::HEIGHT_DIFF_LIMIT_METERS = 1.0
protected

Definition at line 3 of file CCTWaterSurface.c.

Referenced by Can().

◆ m_AllowedSurfaceList

ref array<string> CCTWaterSurface::m_AllowedSurfaceList
protected

DEPRECATED.

Definition at line 7 of file CCTWaterSurface.c.

Referenced by Can(), and CCTWaterSurface().

◆ m_MaximalActionDistanceSq

float CCTWaterSurface::m_MaximalActionDistanceSq
protected

Definition at line 5 of file CCTWaterSurface.c.

Referenced by Can(), and CCTWaterSurface().

◆ m_SurfaceType

string CCTWaterSurface::m_SurfaceType
protected

Definition at line 6 of file CCTWaterSurface.c.

Referenced by CCTWaterSurface().


The documentation for this class was generated from the following file: