DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Can()

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

Pre-calculate object validity once.

Fishing/synthetic/sea-normalized cursor path For fishing or other synthetic cursor actions, do not fall through to generic surface checks. If the synthetic cursor cannot be resolved, the action should not be available.

См. определение в файле CCTLiquid.c строка 66

67 {
68 if (!target)
69 return false;
70
74
75 vector playerPos = player.GetPosition();
76 Object targetObj = target.GetObject();
77 vector objectPosition = vector.Zero;
78 bool isValidInteract = false;
79
81 if (targetObj)
82 {
83 m_WaterSourceType = targetObj.GetWaterSourceObjectType();
84 m_LiquidSourceType = targetObj.GetLiquidSourceObjectType();
85
86 if (targetObj.IsWell())
87 {
88 TIntArray componentIndices = new TIntArray();
89 targetObj.GetActionComponentsForSelectionName(targetObj.GetViewGeometryLevel(), UAMisc.LIQUID_SOURCE_SELECTION, componentIndices);
90
91 if (componentIndices.Count() > 0)
92 isValidInteract = componentIndices.Find(target.GetComponentIndex()) != -1;
93 else
94 isValidInteract = true;
95 }
96 else
97 {
98 objectPosition = targetObj.GetPosition();
99 isValidInteract = IsValidTargetObject(playerPos, objectPosition, m_WaterSourceType, m_LiquidSourceType, target.IsProxy());
100 }
101 }
102
103 vector hitPosition = target.GetCursorHitPos();
104
105 #ifdef DIAG_DEVELOPER
106 m_DebugSyntheticCursor = DiagMenu.GetBool(DiagMenuIDs.SYNTHETIC_FISHING_CURSOR);
107 #endif
108
111 if (m_AllowSeaLevelCursorFallback && !targetObj)
112 {
113 vector resolvedHitPosition;
114 int resolvedLiquidType;
115
116 if (TryResolveSyntheticCursor(player, playerPos, hitPosition, resolvedHitPosition, resolvedLiquidType))
117 {
118 hitPosition = resolvedHitPosition;
119 target.SetCursorHitPos(hitPosition);
120
121 m_LiquidType = resolvedLiquidType;
123 }
124 }
125
126 if (isValidInteract && targetObj)
127 {
128 m_LiquidType = targetObj.GetLiquidSourceType();
130 }
131
132 string surfaceType;
133 if (CheckSurfaceLiquid(player, targetObj, hitPosition, playerPos, isValidInteract, surfaceType))
134 {
136 }
137
138 if (!targetObj && surfaceType == string.Empty && m_LiquidType == LIQUID_NONE)
139 {
140 if (!CheckSeaLevelFallback(hitPosition, playerPos))
141 {
142 #ifdef DIAG_DEVELOPER
143 DbgUI.Begin("", 10, 200);
144 if (m_DebugSyntheticCursor)
145 {
146 DbgUI.Text(string.Format("CCTLiquid CheckSeaLevelFallback rejected: reason=could not create sea hit point | hitPosition=%1 | playerPos=%2", hitPosition, playerPos));
147 }
148 DbgUI.End();
149 #endif
150 }
151 }
152
154 }
DiagMenuIDs
Определения EDiagMenuIDs.c:2
ELiquidSourceObjectType
Определения ELiquidSourceObjectType.c:2
EWaterSourceObjectType
Определения EWaterSourceObjectType.c:2
Empty
Определения Hand_States.c:14
int m_WaterSourceType
Определения CCTLiquid.c:28
bool TryResolveSyntheticCursor(PlayerBase player, vector playerPos, vector currentHitPosition, out vector resolvedHitPosition, out int resolvedLiquidType)
Определения CCTLiquid.c:636
bool IsValidTargetObject(vector playerPos, vector objectPosition, EWaterSourceObjectType waterSourceType, ELiquidSourceObjectType liquidSourceType, bool isProxy)
Определения CCTLiquid.c:161
int m_LiquidType
Определения CCTLiquid.c:27
bool CheckSeaLevelFallback(vector hitPosition, vector playerPos)
Определения CCTLiquid.c:283
int m_LiquidSourceType
Определения CCTLiquid.c:29
bool IsValidLiquid(int liquid)
Определения CCTLiquid.c:156
bool m_AllowSeaLevelCursorFallback
Определения CCTLiquid.c:30
bool CheckSurfaceLiquid(PlayerBase player, Object targetObj, vector hitPosition, vector playerPos, bool isValidInteract, out string surfaceType)
Определения CCTLiquid.c:180
class LOD Object
array< int > TIntArray
Определения EnScript.c:733
const int LIQUID_NONE
Определения 3_Game/DayZ/constants.c:566

Перекрестные ссылки ActionTarget(), DbgUI::Begin(), CheckSeaLevelFallback(), CheckSurfaceLiquid(), Empty, DbgUI::End(), DiagMenu::GetBool(), IsValidLiquid(), IsValidTargetObject(), LIQUID_NONE, UAMisc::LIQUID_SOURCE_SELECTION, m_AllowSeaLevelCursorFallback, m_LiquidSourceType, m_LiquidType, m_WaterSourceType, DbgUI::Text(), TryResolveSyntheticCursor() и vector::Zero.

Используется в ActionFillBottleBase::ActionCondition() и CanContinue().