Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл DayZPlayerImplementMeleeCombat.c

См. исходные тексты.

Перечисления

enum  EMeleeHitType {
  NONE = -1 , LIGHT , HEAVY , SPRINT ,
  KICK , FINISHER_LIVERSTAB , FINISHER_NECKSTAB , FINISHER_GENERIC ,
  WPN_HIT , WPN_HIT_BUTTSTOCK , WPN_STAB , WPN_STAB_FINISHER
}
 

Функции

void DayZPlayerImplementMeleeCombat (DayZPlayerImplement player)
 
void Init (DayZPlayerImplement player)
 
void ~DayZPlayerImplementMeleeCombat ()
 
EMeleeHitType GetHitType ()
 
void SetHitZoneIdx (int pHitZone)
 
EntityAI GetTargetEntity ()
 
void SetTargetObject (Object pTarget)
 
int GetHitZoneIdx ()
 component idx
 
vector GetHitPos ()
 
void SetHitPos (vector pHitPos)
 
int GetFinisherType ()
 
void SetFinisherType (int pFinisherType)
 
int GetWeaponMode ()
 
void Reset (InventoryItem weapon, EMeleeHitType hitMask, bool wasHitEvent=false)
 
void ResetTarget ()
 
void Update (InventoryItem weapon, EMeleeHitType hitMask, bool wasHitEvent=false)
 
void CheckMeleeItem ()
 
int SelectWeaponMode (InventoryItem weapon)
 
float GetWeaponRange (InventoryItem weapon, int weaponMode)
 
float GetRange ()
 
float GetAngle ()
 
void TargetSelection ()
 
int TrySelectFinisherType (InventoryItem weapon, EntityAI target)
 General condition for finisher attacks.
 
int DetermineSpecificFinisherType (ItemBase weapon)
 
void InternalResetTarget ()
 
void SetTarget (Object obj, vector hitPos, int hitZone)
 
bool CanObjectBeTargeted (Object obj, bool checkNonAligneAble=false)
 
bool HitZoneSelectionRaycastHelper (out vector hitPos, out int hitZone, out Object target)
 
bool HitZoneSelectionRaycast (out vector hitPos, out int hitZone, out Object target, bool useCamera)
 
void HitZoneSelection ()
 DEPRECATED.
 
bool IsObstructed (Object object)
 DEPRECATED - New function in MeleeTargeting.
 
bool IsEntityBehindEntityInAngle (EntityAI source, EntityAI target, float angle)
 

Переменные

enum EMeleeHitType TARGETING_ANGLE_NORMAL = 30.0
 Target selection settings.
 
const float TARGETING_ANGLE_SPRINT = 15.0
 Second Pass: Half angle of cone during sprint.
 
const float TARGETING_MIN_HEIGHT = -2.0
 Second Pass: How deep the cone goes in meters from player position.
 
const float TARGETING_MAX_HEIGHT = 2.0
 Second Pass: How high the cone goes in meters from player position.
 
const float TARGETING_RAY_RADIUS_EX = 0.5
 Second Pass: Max distance from ray projected from player looking direction.
 
const float TARGETING_RAY_RADIUS = 0.25
 DEPRECATED: "HitZoneSelection".
 
const float TARGETING_RAY_DIST = 5.0
 DEPRECATED: "HitZoneSelection".
 
const float TARGETING_RAY_DIST_SHORT = 2.0
 DEPRECATED: "HitZoneSelection".
 
const float RANGE_EXTENDER_NORMAL = 0.65
 General range extension.
 
const float RANGE_EXTENDER_SPRINT = 1.35
 General range extension while in sprint.
 
const string DEFAULT_HIT_ZONE = "Torso"
 DEPRECATED: "HitZoneSelection".
 
ref MeleeTargeting m_MeleeTargeting
 Target selecting "component".
 
Object m_TargetObject
 Targets - types.
 
EMeleeTargetType m_TargetType
 DEPRECATED: Was added but never used..?
 
ref array< Objectm_AllTargetObjects
 All potential targets found during most recent TargetSelection.
 
ref array< typenamem_TargetableObjects
 Typenames of all directly/preferred targetable objects (1st Pass + 2nd Pass)
 
ref array< typenamem_NonAlignableObjects
 Typenames of objects that can be targeted, but are not a priority (3rd Pass)
 
ref array< stringm_BlacklistedDamageZones
 List of blacklisted damage zone names (cannot use indices due to the possible changes when p3d components are recalculated)
 
DayZPlayerImplement m_DZPlayer
 Parent.
 
InventoryItem m_Weapon
 Weapons - cache.
 
int m_WeaponMode
 WeaponMode used during most recent Update.
 
float m_WeaponRange
 WeaponRange used during most recent Update.
 
bool m_ForceUntargetable
 Misc - cache.
 
bool m_SprintAttack
 If most recent attack was a sprint attack.
 
bool m_WasHit
 If most recent attack was.
 
vector m_RayStart
 Start position of most recent HitZoneSelectionRaycast.
 
vector m_RayEnd
 End position of most recent HitZoneSelectionRaycast.
 
vector m_RayEndShort
 DEPRECATED: "HitZoneSelection".
 
EMeleeHitType m_HitType
 Hit type of the most recent attack.
 
int m_HitZoneIdx
 Hit result - cache.
 
int m_FinisherType
 
string m_HitZoneName
 Most recent target HitZone name.
 
vector m_HitPositionWS
 Most recent target position.
 
int m_DebugForcedFinisherType
 

Перечисления

◆ EMeleeHitType

Элементы перечислений
NONE 
LIGHT 
HEAVY 
SPRINT 
KICK 
FINISHER_LIVERSTAB 
FINISHER_NECKSTAB 
FINISHER_GENERIC 
WPN_HIT 
WPN_HIT_BUTTSTOCK 
WPN_STAB 
WPN_STAB_FINISHER 
2{
3 NONE = -1,
4
5 LIGHT,
6 HEAVY,
7 SPRINT,
8 KICK,
12
13 WPN_HIT,
17}
@ WPN_HIT_BUTTSTOCK
Definition DayZPlayerImplementMeleeCombat.c:14
@ HEAVY
Definition DayZPlayerImplementMeleeCombat.c:6
@ WPN_STAB
Definition DayZPlayerImplementMeleeCombat.c:15
@ KICK
Definition DayZPlayerImplementMeleeCombat.c:8
@ WPN_HIT
Definition DayZPlayerImplementMeleeCombat.c:13
@ FINISHER_LIVERSTAB
Definition DayZPlayerImplementMeleeCombat.c:9
@ FINISHER_GENERIC
Definition DayZPlayerImplementMeleeCombat.c:11
@ NONE
Definition DayZPlayerImplementMeleeCombat.c:3
@ WPN_STAB_FINISHER
Definition DayZPlayerImplementMeleeCombat.c:16
@ FINISHER_NECKSTAB
Definition DayZPlayerImplementMeleeCombat.c:10
@ SPRINT
Definition DayZPlayerImplementMeleeCombat.c:7
@ LIGHT
Definition DayZPlayerImplementMeleeCombat.c:5

Функции

◆ CanObjectBeTargeted()

bool CanObjectBeTargeted ( Object obj,
bool checkNonAligneAble = false )
protected
531 {
532 return obj && obj.IsAlive() && ( obj.IsAnyInherited(m_TargetableObjects) || (checkNonAligneAble && obj.IsAnyInherited(m_NonAlignableObjects)) );
533 }
ref array< typename > m_NonAlignableObjects
Typenames of objects that can be targeted, but are not a priority (3rd Pass)
Definition DayZPlayerImplementMeleeCombat.c:50
ref array< typename > m_TargetableObjects
Typenames of all directly/preferred targetable objects (1st Pass + 2nd Pass)
Definition DayZPlayerImplementMeleeCombat.c:49
Definition EntityAI.c:95

Перекрестные ссылки m_NonAlignableObjects и m_TargetableObjects.

Используется в TargetSelection().

◆ CheckMeleeItem()

void CheckMeleeItem ( )
private
249 {
250 if (m_Weapon)
251 {
252 ItemBase item = ItemBase.Cast(m_Weapon.ProcessMeleeItemDamage(GetWeaponMode()));
253
254 if (item && item.GetHierarchyRootPlayer())
255 {
256 PlayerBase.Cast(item.GetHierarchyRootPlayer()).SetCheckMeleeItem(item);
257 }
258 else if (m_Weapon && m_Weapon.GetHierarchyRootPlayer())
259 {
260 PlayerBase.Cast(m_Weapon.GetHierarchyRootPlayer()).SetCheckMeleeItem(ItemBase.Cast(m_Weapon));
261 }
262 }
263 }
int GetWeaponMode()
Definition DayZPlayerImplementMeleeCombat.c:187
InventoryItem m_Weapon
Weapons - cache.
Definition DayZPlayerImplementMeleeCombat.c:57
Definition InventoryItem.c:731
Definition PlayerBaseClient.c:2

Перекрестные ссылки GetWeaponMode() и m_Weapon.

◆ DayZPlayerImplementMeleeCombat()

void DayZPlayerImplementMeleeCombat ( DayZPlayerImplement player)
private
91 {
92 Init(player);
93 }
override Widget Init()
Definition DayZGame.c:122

Перекрестные ссылки Init().

Используется в DayZPlayer::DayZPlayerImplement().

◆ DetermineSpecificFinisherType()

int DetermineSpecificFinisherType ( ItemBase weapon)
protected
489 {
491 {
493 EMeleeHitType.FINISHER_LIVERSTAB,
494 EMeleeHitType.FINISHER_NECKSTAB
495 };
496
498 }
499
500 if (!weapon || !weapon.GetValidFinishers() || weapon.GetValidFinishers().Count() == 0)
501 {
502 return EMeleeHitType.FINISHER_LIVERSTAB;
503 }
504
506 int idx = Math.Round(Math.Lerp(0, weapon.GetValidFinishers().Count() - 1, player.GetRandomGeneratorSyncManager().GetRandom01(RandomGeneratorSyncUsage.RGSGeneric)));
507 return weapon.GetValidFinishers()[idx];
508 }
DayZPlayerImplement m_DZPlayer
Parent.
Definition DayZPlayerImplementMeleeCombat.c:54
EMeleeHitType
Definition DayZPlayerImplementMeleeCombat.c:2
int m_DebugForcedFinisherType
Definition DayZPlayerImplementMeleeCombat.c:84
RandomGeneratorSyncUsage
Definition RandomGeneratorSyncManager.c:2
Definition EnMath.c:7
static proto float Round(float f)
Returns mathematical round of value.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.

Перекрестные ссылки Math::Lerp(), m_DebugForcedFinisherType, m_DZPlayer и Math::Round().

Используется в TrySelectFinisherType().

◆ GetAngle()

float GetAngle ( )
protected
327 {
328 if (m_SprintAttack)
330 else
332 }
bool m_SprintAttack
If most recent attack was a sprint attack.
Definition DayZPlayerImplementMeleeCombat.c:63
const float TARGETING_ANGLE_SPRINT
Second Pass: Half angle of cone during sprint.
Definition DayZPlayerImplementMeleeCombat.c:23
enum EMeleeHitType TARGETING_ANGLE_NORMAL
Target selection settings.

Перекрестные ссылки m_SprintAttack, TARGETING_ANGLE_NORMAL и TARGETING_ANGLE_SPRINT.

Используется в TargetSelection().

◆ GetFinisherType()

int GetFinisherType ( )
private
178 {
179 return m_FinisherType;
180 }
int m_FinisherType
Definition DayZPlayerImplementMeleeCombat.c:74

Перекрестные ссылки m_FinisherType.

Используется в TargetSelection().

◆ GetHitPos()

vector GetHitPos ( )
private
168 {
169 return m_HitPositionWS;
170 }
vector m_HitPositionWS
Most recent target position.
Definition DayZPlayerImplementMeleeCombat.c:76

Перекрестные ссылки m_HitPositionWS.

◆ GetHitType()

EMeleeHitType GetHitType ( )
private
142 {
143 return m_HitType;
144 }
EMeleeHitType m_HitType
Hit type of the most recent attack.
Definition DayZPlayerImplementMeleeCombat.c:70

Перекрестные ссылки m_HitType.

◆ GetHitZoneIdx()

int GetHitZoneIdx ( )
private

component idx

163 {
164 return m_HitZoneIdx;
165 }
int m_HitZoneIdx
Hit result - cache.
Definition DayZPlayerImplementMeleeCombat.c:73

Перекрестные ссылки m_HitZoneIdx.

◆ GetRange()

float GetRange ( )
protected
322 {
324 }
float m_WeaponRange
WeaponRange used during most recent Update.
Definition DayZPlayerImplementMeleeCombat.c:59
const float RANGE_EXTENDER_NORMAL
General range extension.
Definition DayZPlayerImplementMeleeCombat.c:31

Перекрестные ссылки m_WeaponRange и RANGE_EXTENDER_NORMAL.

Используется в HitZoneSelectionRaycast() и TargetSelection().

◆ GetTargetEntity()

EntityAI GetTargetEntity ( )
private
152 {
153 return EntityAI.Cast(m_TargetObject);
154 }
Object m_TargetObject
Targets - types.
Definition DayZPlayerImplementMeleeCombat.c:40
Definition Building.c:6

Перекрестные ссылки m_TargetObject.

Используется в Update().

◆ GetWeaponMode()

int GetWeaponMode ( )
private
188 {
189 return m_WeaponMode;
190 }
int m_WeaponMode
WeaponMode used during most recent Update.
Definition DayZPlayerImplementMeleeCombat.c:58

Перекрестные ссылки m_WeaponMode.

Используется в CheckMeleeItem() и HitZoneSelection().

◆ GetWeaponRange()

float GetWeaponRange ( InventoryItem weapon,
int weaponMode )
protected
314 {
315 if ( weapon )
316 return weapon.GetMeleeCombatData().GetModeRange(weaponMode);
317 else
318 return m_DZPlayer.GetMeleeCombatData().GetModeRange(weaponMode);
319 }

Перекрестные ссылки m_DZPlayer.

Используется в HitZoneSelection() и Reset().

◆ HitZoneSelection()

void HitZoneSelection ( )
protected

DEPRECATED.

make sure we are in range of the current weapon;

2d only

just for building and transports (big objects)

if no object in cone, set this object from raycast for these special cases

603 {
606
607 // ray properties
608 vector pos;
609 vector cameraDirection = GetGame().GetCurrentCameraDirection();
610
611 MiscGameplayFunctions.GetHeadBonePos(player, pos);
612 m_RayStart = pos;
615
616 // raycast
619 float hitFraction;
622
624 {
625 m_HitZoneIdx = -1;
626 //Print("HitZoneSelection failed");
627 }
628 else if ( hitObjects.Count() > 0 )
629 {
630 cursorTarget = hitObjects.Get(0);
631
633 vector playerPos = m_DZPlayer.GetPosition();
636 playerPos[1] = 0;
637 hitPos[1] = 0;
638
641 {
643 if (m_TargetObject == null)
644 {
646 }
647 }
648
650 {
651 m_HitZoneName = cursorTarget.GetDamageZoneNameByComponentIndex(m_HitZoneIdx);
652 //Print("hit object: " + m_TargetObject + " | component idx: " + m_HitZoneIdx + " | hitzone name: " + m_HitZoneName);
653 }
654 else
655 {
657 m_HitZoneName = DEFAULT_HIT_ZONE; //Default to torso if no zone is targeted
658 }
659 }
660 else
661 {
662 m_HitZoneIdx = -1;
663 //Print("HitZoneSelection failed");
664 }
665 }
PhxInteractionLayers
Definition DayZPhysics.c:2
float GetWeaponRange(InventoryItem weapon, int weaponMode)
Definition DayZPlayerImplementMeleeCombat.c:313
vector m_RayEndShort
DEPRECATED: "HitZoneSelection".
Definition DayZPlayerImplementMeleeCombat.c:68
const float TARGETING_RAY_DIST_SHORT
DEPRECATED: "HitZoneSelection".
Definition DayZPlayerImplementMeleeCombat.c:29
const float TARGETING_RAY_DIST
DEPRECATED: "HitZoneSelection".
Definition DayZPlayerImplementMeleeCombat.c:28
vector m_RayStart
Start position of most recent HitZoneSelectionRaycast.
Definition DayZPlayerImplementMeleeCombat.c:66
const string DEFAULT_HIT_ZONE
DEPRECATED: "HitZoneSelection".
Definition DayZPlayerImplementMeleeCombat.c:34
string m_HitZoneName
Most recent target HitZone name.
Definition DayZPlayerImplementMeleeCombat.c:75
vector m_RayEnd
End position of most recent HitZoneSelectionRaycast.
Definition DayZPlayerImplementMeleeCombat.c:67
const float TARGETING_RAY_RADIUS
DEPRECATED: "HitZoneSelection".
Definition DayZPlayerImplementMeleeCombat.c:27
Definition ZombieBase.c:2
Definition DayZPhysics.c:124
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
Definition ObjectTyped.c:2
Definition EnConvert.c:106
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()

Перекрестные ссылки DEFAULT_HIT_ZONE, vector::Distance(), GetGame(), GetWeaponMode(), GetWeaponRange(), m_DZPlayer, m_HitPositionWS, m_HitZoneIdx, m_HitZoneName, m_NonAlignableObjects, m_RayEnd, m_RayEndShort, m_RayStart, m_TargetObject, m_Weapon, DayZPhysics::RaycastRV(), TARGETING_RAY_DIST, TARGETING_RAY_DIST_SHORT и TARGETING_RAY_RADIUS.

◆ HitZoneSelectionRaycast()

bool HitZoneSelectionRaycast ( out vector hitPos,
out int hitZone,
out Object target,
bool useCamera )
protected

Prevents targeting of objects behind player

Opponent is inside car - targeting range is shorter in that case

545 {
547
548 vector pos;
549 vector dir;
551 if (useCamera)
552 { // What the player camera is looking at (crosshair)
554 player.GetCurrentCameraTransform(pos, dir, cameraRotation);
555 playerDir = dir;
556 }
557 else
558 { // What the player himself is looking at
559 playerDir = MiscGameplayFunctions.GetHeadingVector(player);
560 dir = GetGame().GetCurrentCameraDirection();
561 MiscGameplayFunctions.GetHeadBonePos(player, pos);
562 }
563
565 if (vector.Dot(dir, playerDir) < 0.5)
566 {
567 return false;
568 }
569
570 m_RayStart = pos;
571 m_RayEnd = m_RayStart + GetRange() * dir;
572
573 // raycast
576
578 {
579 target = hitObjects[0];
580 m_ForceUntargetable = false;
581
584 if (playerTarget && playerTarget.IsInVehicle())
585 {
586 if (vector.DistanceSq(pos, hitPos) > Math.SqrFloat(GetRange() * 0.5))
587 {
588 m_ForceUntargetable = true;
589 target = null;
591 hitZone = -1;
592 }
593 }
594
595 return true;
596 }
597
598 return false;
599 }
bool m_ForceUntargetable
Misc - cache.
Definition DayZPlayerImplementMeleeCombat.c:62
float GetRange()
Definition DayZPlayerImplementMeleeCombat.c:321
static const vector Zero
Definition EnConvert.c:110
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271
static proto float SqrFloat(float f)
Returns squared value.

Перекрестные ссылки vector::DistanceSq(), vector::Dot(), GetGame(), GetRange(), m_DZPlayer, m_ForceUntargetable, m_RayEnd, m_RayStart, DayZPhysics::RaycastRV(), Math::SqrFloat() и vector::Zero.

Используется в HitZoneSelectionRaycastHelper().

◆ HitZoneSelectionRaycastHelper()

bool HitZoneSelectionRaycastHelper ( out vector hitPos,
out int hitZone,
out Object target )
protected
536 {
538 // Not sure if desired, as it can give some results that feel a little odd
539 // But it will depend entirely on the player and situation..
540 // I guess the crosshair is hidden while melee anyways though
541 // || ( m_DZPlayer.IsInThirdPerson() && HitZoneSelectionRaycast(hitPos, hitZone, target, true);
542 }
bool HitZoneSelectionRaycast(out vector hitPos, out int hitZone, out Object target, bool useCamera)
Definition DayZPlayerImplementMeleeCombat.c:544

Перекрестные ссылки HitZoneSelectionRaycast().

Используется в TargetSelection().

◆ Init()

void Init ( DayZPlayerImplement player)
private
96 {
98
100
101 m_HitZoneName = "";
102 m_HitZoneIdx = -1;
103 m_FinisherType = -1;
105
106 m_SprintAttack = false;
107 m_WasHit = false;
108
110 m_TargetType = EMeleeTargetType.ALIGNABLE;
112 #ifdef DIAG_DEVELOPER
114 #endif
115
117
118 m_TargetableObjects = new array<typename>; //checks against CONFIG hierarchy
122
124 m_NonAlignableObjects.Insert(Building);
130
132 m_BlacklistedDamageZones.Insert("Brain");
133 }
bool m_WasHit
If most recent attack was.
Definition DayZPlayerImplementMeleeCombat.c:64
ref array< string > m_BlacklistedDamageZones
List of blacklisted damage zone names (cannot use indices due to the possible changes when p3d compon...
Definition DayZPlayerImplementMeleeCombat.c:51
ref MeleeTargeting m_MeleeTargeting
Target selecting "component".
Definition DayZPlayerImplementMeleeCombat.c:37
ref array< Object > m_AllTargetObjects
All potential targets found during most recent TargetSelection.
Definition DayZPlayerImplementMeleeCombat.c:42
EMeleeTargetType m_TargetType
DEPRECATED: Was added but never used..?
Definition DayZPlayerImplementMeleeCombat.c:41
EMeleeTargetType
Definition EMeleeTargetType.c:2
Definition Fence.c:2
Definition InventoryItem.c:496
Definition InventoryItem.c:413
Definition AnimalBase.c:2
Definition DayZPlayerImplement.c:111
Definition CarTent.c:2

Перекрестные ссылки m_AllTargetObjects, m_BlacklistedDamageZones, m_DebugForcedFinisherType, m_DZPlayer, m_FinisherType, m_HitPositionWS, m_HitZoneIdx, m_HitZoneName, m_MeleeTargeting, m_NonAlignableObjects, m_SprintAttack, m_TargetableObjects, m_TargetObject, m_TargetType, m_WasHit и vector::Zero.

◆ InternalResetTarget()

void InternalResetTarget ( )
protected
511 {
514 m_HitZoneIdx = -1;
515 m_HitZoneName = "";
516 SetFinisherType(-1);
517 }
void SetFinisherType(int pFinisherType)
Definition DayZPlayerImplementMeleeCombat.c:182

Перекрестные ссылки m_HitPositionWS, m_HitZoneIdx, m_HitZoneName, m_TargetObject, SetFinisherType() и vector::Zero.

Используется в ResetTarget() и TargetSelection().

◆ IsEntityBehindEntityInAngle()

bool IsEntityBehindEntityInAngle ( EntityAI source,
EntityAI target,
float angle )
private
693 {
694 vector targetDirection = target.GetDirection();
697 {
698 targetDirection = Vector(targetZombie.GetOrientationSynced(),0,0);
699 targetDirection = targetDirection.AnglesToVector();
700 }
701 vector toSourceDirection = (source.GetPosition() - target.GetPosition());
702
703 targetDirection[1] = 0;
704 toSourceDirection[1] = 0;
705
706 targetDirection.Normalize();
707 toSourceDirection.Normalize();
708
711
712 int hitDir = Math.Acos(cosFi) * Math.RAD2DEG;
713
714 if (cross[1] < 0)
715 hitDir = -hitDir;
716
717 return hitDir <= (-180 + angle) || hitDir >= (180 - angle);
718 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition ZombieFemaleBase.c:2
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Acos(float c)
Returns angle in radians from cosinus.
static const float RAD2DEG
Definition EnMath.c:16

Перекрестные ссылки Math::Acos(), Class::CastTo(), vector::Dot(), Math::RAD2DEG и Vector().

Используется в TrySelectFinisherType().

◆ IsObstructed()

bool IsObstructed ( Object object)
protected

DEPRECATED - New function in MeleeTargeting.

not possible to trace when this happens (zero length raycast)

669 {
670 // check direct visibility of object (obstruction check)
673 float hitFraction;
677
678 if (object)
679 {
680 MiscGameplayFunctions.GetHeadBonePos(player, start);
681 end = start + MiscGameplayFunctions.GetHeadingVector(player) * vector.Distance(player.GetPosition(), object.GetPosition());
682
683 if ( end == start )
684 return true;
685
687 }
688
689 return false;
690 }
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)

Перекрестные ссылки vector::Distance(), m_DZPlayer и DayZPhysics::RayCastBullet().

◆ Reset()

void Reset ( InventoryItem weapon,
EMeleeHitType hitMask,
bool wasHitEvent = false )
private
193 {
196 m_TargetType = EMeleeTargetType.ALIGNABLE;
201
202 #ifdef DIAG_DEVELOPER
204 #endif
205 m_AllTargetObjects.Clear();
206 }
int SelectWeaponMode(InventoryItem weapon)
Definition DayZPlayerImplementMeleeCombat.c:269

Перекрестные ссылки GetWeaponRange(), m_AllTargetObjects, m_HitType, m_SprintAttack, m_TargetType, m_WasHit, m_Weapon, m_WeaponMode, m_WeaponRange и SelectWeaponMode().

◆ ResetTarget()

void ResetTarget ( )
private
209 {
210 #ifdef DIAG_DEVELOPER
215 #endif
216
218 }
void InternalResetTarget()
Definition DayZPlayerImplementMeleeCombat.c:510

Перекрестные ссылки InternalResetTarget(), m_HitPositionWS, m_HitZoneIdx, m_HitZoneName и m_TargetObject.

◆ SelectWeaponMode()

int SelectWeaponMode ( InventoryItem weapon)
protected

melee with firearm

melee weapon attacks - gets mode from the item

bare hand melee mode selection

default bare-hand light attack

270 {
271 if (weapon)
272 {
274 if (weapon.IsInherited(Weapon))
275 {
276 switch (m_HitType)
277 {
278 case EMeleeHitType.WPN_HIT:
279 return 0;
280 case EMeleeHitType.WPN_HIT_BUTTSTOCK:
281 return 1;
282 case EMeleeHitType.WPN_STAB:
283 return 2;
284 }
285 }
286 else
287 {
289 switch (m_HitType)
290 {
291 case EMeleeHitType.LIGHT:
292 return weapon.GetMeleeMode();
293 case EMeleeHitType.HEAVY:
294 return weapon.GetMeleeHeavyMode();
295 case EMeleeHitType.SPRINT:
296 return weapon.GetMeleeSprintMode();
297 }
298 }
299 }
300
302 switch (m_HitType)
303 {
304 case EMeleeHitType.HEAVY:
305 return 1;
306 case EMeleeHitType.SPRINT:
307 return 2;
308 }
309
310 return 0;
311 }
script counterpart to engine's class Weapon
Definition InventoryItem.c:49

Перекрестные ссылки m_HitType.

Используется в Reset().

◆ SetFinisherType()

void SetFinisherType ( int pFinisherType)
private
183 {
185 }

Перекрестные ссылки m_FinisherType.

Используется в InternalResetTarget() и Update().

◆ SetHitPos()

void SetHitPos ( vector pHitPos)
private
173 {
175 }

Перекрестные ссылки m_HitPositionWS.

◆ SetHitZoneIdx()

void SetHitZoneIdx ( int pHitZone)
private
147 {
149 }

Перекрестные ссылки m_HitZoneIdx.

◆ SetTarget()

void SetTarget ( Object obj,
vector hitPos,
int hitZone )
protected
520 {
521 if (obj)
522 {
523 m_TargetObject = obj;
526 m_HitZoneName = m_TargetObject.GetDamageZoneNameByComponentIndex(m_HitZoneIdx);
527 }
528 }

Перекрестные ссылки m_HitPositionWS, m_HitZoneIdx, m_HitZoneName и m_TargetObject.

Используется в TargetSelection().

◆ SetTargetObject()

void SetTargetObject ( Object pTarget)
private
157 {
159 }

Перекрестные ссылки m_TargetObject.

◆ TargetSelection()

void TargetSelection ( )
protected
335 {
336 // Prepare common variables
338 vector pos = m_DZPlayer.GetPosition();
339 vector rayStart = m_DZPlayer.GetBonePositionWS(m_DZPlayer.GetBoneIndexByName("Head"));
340
342 m_DZPlayer.GetCurrentCameraTransform(cameraPos, cameraDir, cameraRot);
343 vector dir = MiscGameplayFunctions.GetHeadingVector(player);
344 dir[1] = cameraDir[1];
345
346 // Calculate max distances
347 float dist = GetRange();
348 float angle = GetAngle();
349 float dist2 = Math.SqrFloat(dist);
350
351 // There's generally 2 TargetSelection calls per animation
352 // First to obtain target to move towards during animation
353 // Second one is to see if that target is still in range before applying damage to it
354 // m_WasHit means the hit event occured, so this is the second call
355
356 if (m_WasHit && GetFinisherType() == -1)
357 {
358 // See if the component is still in range
360 {
362 // This result should still be cached, so no need to fill it in again
363 return;
364 }
365 }
366
367 // Find a new target
369
372 int hitZone;
373
374 // First pass - Prefer what the player is looking at (only aligneable ones, we will try for nonaligneable later)
376 {
378 {
380 return;
381 }
382
384 {
386
388 return;
389 }
390 }
391
392 // Second pass - Try to obtain something aligneable closeby the player watching direction
394
395 if (targetData)
396 {
397 SetTarget(targetData.Obj, targetData.HitPos, targetData.HitComponent);
398 return;
399 }
400
401 // Third pass - We found no aligneable target, check if the target that we are directly looking at is nonalignable (big)
403 {
405
407 return;
408 }
409 }
void SetTarget(Object obj, vector hitPos, int hitZone)
Definition DayZPlayerImplementMeleeCombat.c:519
const float TARGETING_MIN_HEIGHT
Second Pass: How deep the cone goes in meters from player position.
Definition DayZPlayerImplementMeleeCombat.c:24
const float TARGETING_MAX_HEIGHT
Second Pass: How high the cone goes in meters from player position.
Definition DayZPlayerImplementMeleeCombat.c:25
float GetAngle()
Definition DayZPlayerImplementMeleeCombat.c:326
bool HitZoneSelectionRaycastHelper(out vector hitPos, out int hitZone, out Object target)
Definition DayZPlayerImplementMeleeCombat.c:535
int GetFinisherType()
Definition DayZPlayerImplementMeleeCombat.c:177
const float TARGETING_RAY_RADIUS_EX
Second Pass: Max distance from ray projected from player looking direction.
Definition DayZPlayerImplementMeleeCombat.c:26
bool CanObjectBeTargeted(Object obj, bool checkNonAligneAble=false)
Definition DayZPlayerImplementMeleeCombat.c:530
ref array< typename > TargetableObjects void MeleeTargetSettings(vector coneOrigin, float coneLength, float coneHalfAngle, float coneMinHeight, float coneMaxHeight, vector rayStart, vector dir, float maxDist, EntityAI pToIgnore, array< typename > targetableObjects)
Definition MeleeTargeting.c:36
Definition MeleeTargeting.c:2

Перекрестные ссылки CanObjectBeTargeted(), vector::DistanceSq(), GetAngle(), GetFinisherType(), GetRange(), HitZoneSelectionRaycastHelper(), InternalResetTarget(), m_AllTargetObjects, m_BlacklistedDamageZones, m_DZPlayer, m_ForceUntargetable, m_HitZoneName, m_MeleeTargeting, m_TargetableObjects, m_TargetObject, m_WasHit, MeleeTargetSettings(), SetTarget(), Math::SqrFloat(), TARGETING_MAX_HEIGHT, TARGETING_MIN_HEIGHT и TARGETING_RAY_RADIUS_EX.

Используется в Update().

◆ TrySelectFinisherType()

int TrySelectFinisherType ( InventoryItem weapon,
EntityAI target )
protected

General condition for finisher attacks.

Аргументы
weaponWeapon used in the attack
targetTarget entity
Возвращает
int - type of finisher (-1 == no finisher)

perform only for finisher suitable weapons

check if attacker is in right pos and angle against victim

Check if the infected is aware of the player

prone checks

firearm

418 {
419 if (m_WasHit)
420 return -1;
421
422 if (target)
423 {
424 vector dir = target.GetPosition() - m_DZPlayer.GetPosition();
425
428
429 float moveFraction = m_DZPlayer.CollisionMoveTest(dir, vector.Zero, 1.0, target, hitEntity, hitPos, hitNormal);
430 if (moveFraction < 1.0)
431 return -1;
432 }
433
435 if (target && target.CanBeBackstabbed() && weapon && (weapon.IsMeleeFinisher() || m_HitType == EMeleeHitType.WPN_STAB) && !weapon.IsRuined() )
436 {
437 bool playGenericFinisherAnimation = false;
440 {
443 {
444 return -1;
445 }
446
447 int mindState = targetZombie.GetMindStateSynced();
449 if (mindState >= DayZInfectedConstants.MINDSTATE_DISTURBED)
450 {
451 return -1;
452 }
453 }
454
457 if (targetZombie)
458 {
460 }
461 else if (targetPlayer)
462 {
464 }
465 else
466 {
468 }
469
471 if (weapon.IsWeapon())
472 {
473 return EMeleeHitType.WPN_STAB_FINISHER;
474 }
476 {
477 return EMeleeHitType.FINISHER_GENERIC;
478 }
479 else //specific hit depending on the component hit (gotten from the target)
480 {
482 }
483 }
484
485 return -1;
486 }
DayZInfectedConstants
Definition DayZInfected.c:2
bool IsEntityBehindEntityInAngle(EntityAI source, EntityAI target, float angle)
Definition DayZPlayerImplementMeleeCombat.c:692
int DetermineSpecificFinisherType(ItemBase weapon)
Definition DayZPlayerImplementMeleeCombat.c:488
Definition EnEntity.c:165

Перекрестные ссылки DetermineSpecificFinisherType(), IsEntityBehindEntityInAngle(), m_DebugForcedFinisherType, m_DZPlayer, m_HitType, m_WasHit и vector::Zero.

Используется в Update().

◆ Update()

void Update ( InventoryItem weapon,
EMeleeHitType hitMask,
bool wasHitEvent = false )
private

Store target into input packet

221 {
223
224 #ifndef SERVER
226 {
227 //Error("DayZPlayerImplementMeleeCombat - ScriptInputUserData already posted");
228 return;
229 }
230
233
235 if (GetGame().IsMultiplayer())
236 {
239 ctx.Write(m_TargetObject);
240 ctx.Write(m_HitPositionWS);
241 ctx.Write(m_HitZoneIdx);
242 ctx.Write(m_FinisherType);
243 ctx.Send();
244 }
245 #endif
246 }
const int INPUT_UDT_MELEE_TARGET
Definition _constants.c:6
void Reset()
Definition Inventory.c:1106
EntityAI GetTargetEntity()
Definition DayZPlayerImplementMeleeCombat.c:151
void TargetSelection()
Definition DayZPlayerImplementMeleeCombat.c:334
int TrySelectFinisherType(InventoryItem weapon, EntityAI target)
General condition for finisher attacks.
Definition DayZPlayerImplementMeleeCombat.c:417
Definition gameplay.c:121
proto static native bool CanStoreInputUserData()

Перекрестные ссылки ScriptInputUserData::CanStoreInputUserData(), GetGame(), GetTargetEntity(), INPUT_UDT_MELEE_TARGET, m_FinisherType, m_HitPositionWS, m_HitZoneIdx, m_TargetObject, Reset(), SetFinisherType(), TargetSelection() и TrySelectFinisherType().

◆ ~DayZPlayerImplementMeleeCombat()

Переменные

◆ DEFAULT_HIT_ZONE

const string DEFAULT_HIT_ZONE = "Torso"
protected

DEPRECATED: "HitZoneSelection".

Используется в HitZoneSelection().

◆ m_AllTargetObjects

ref array<Object> m_AllTargetObjects
protected

All potential targets found during most recent TargetSelection.

Используется в DayZInfected::ChaseAttackLogic(), DayZInfected::FightAttackLogic(), DayZInfected::Init(), Init(), Reset() и TargetSelection().

◆ m_BlacklistedDamageZones

ref array<string> m_BlacklistedDamageZones
protected

List of blacklisted damage zone names (cannot use indices due to the possible changes when p3d components are recalculated)

Используется в Init() и TargetSelection().

◆ m_DebugForcedFinisherType

int m_DebugForcedFinisherType
private

◆ m_DZPlayer

◆ m_FinisherType

int m_FinisherType
protected

Используется в GetFinisherType(), Init(), SetFinisherType() и Update().

◆ m_ForceUntargetable

bool m_ForceUntargetable
protected

Misc - cache.

Forcing current target as untargetable

Используется в HitZoneSelectionRaycast() и TargetSelection().

◆ m_HitPositionWS

vector m_HitPositionWS
protected

Most recent target position.

Используется в GetHitPos(), HitZoneSelection(), Init(), InternalResetTarget(), ResetTarget(), SetHitPos(), SetTarget() и Update().

◆ m_HitType

◆ m_HitZoneIdx

int m_HitZoneIdx
protected

Hit result - cache.

Most recent target HitZone index

Используется в GetHitZoneIdx(), HitZoneSelection(), Init(), InternalResetTarget(), ResetTarget(), SetHitZoneIdx(), SetTarget() и Update().

◆ m_HitZoneName

string m_HitZoneName
protected

Most recent target HitZone name.

Используется в HitZoneSelection(), Init(), InternalResetTarget(), ResetTarget(), SetTarget() и TargetSelection().

◆ m_MeleeTargeting

ref MeleeTargeting m_MeleeTargeting
protected

Target selecting "component".

Contains logic for Second Pass

Используется в Init() и TargetSelection().

◆ m_NonAlignableObjects

ref array<typename> m_NonAlignableObjects
protected

Typenames of objects that can be targeted, but are not a priority (3rd Pass)

Используется в CanObjectBeTargeted(), HitZoneSelection() и Init().

◆ m_RayEnd

vector m_RayEnd
protected

End position of most recent HitZoneSelectionRaycast.

Используется в HitZoneSelection() и HitZoneSelectionRaycast().

◆ m_RayEndShort

vector m_RayEndShort
protected

DEPRECATED: "HitZoneSelection".

Используется в HitZoneSelection().

◆ m_RayStart

vector m_RayStart
protected

Start position of most recent HitZoneSelectionRaycast.

Используется в HitZoneSelection() и HitZoneSelectionRaycast().

◆ m_SprintAttack

bool m_SprintAttack
protected

If most recent attack was a sprint attack.

Используется в GetAngle(), Init() и Reset().

◆ m_TargetableObjects

ref array<typename> m_TargetableObjects
protected

Typenames of all directly/preferred targetable objects (1st Pass + 2nd Pass)

Используется в CanObjectBeTargeted(), DayZInfected::ChaseAttackLogic(), DayZInfected::FightAttackLogic(), DayZInfected::Init(), Init() и TargetSelection().

◆ m_TargetObject

◆ m_TargetType

EMeleeTargetType m_TargetType
protected

DEPRECATED: Was added but never used..?

Используется в Init() и Reset().

◆ m_WasHit

bool m_WasHit
protected

If most recent attack was.

Используется в Init(), Reset(), TargetSelection() и TrySelectFinisherType().

◆ m_Weapon

InventoryItem m_Weapon
protected

◆ m_WeaponMode

int m_WeaponMode
protected

WeaponMode used during most recent Update.

Используется в GetWeaponMode() и Reset().

◆ m_WeaponRange

float m_WeaponRange
protected

WeaponRange used during most recent Update.

Используется в GetRange() и Reset().

◆ RANGE_EXTENDER_NORMAL

const float RANGE_EXTENDER_NORMAL = 0.65
protected

General range extension.

Используется в GetRange().

◆ RANGE_EXTENDER_SPRINT

const float RANGE_EXTENDER_SPRINT = 1.35
protected

General range extension while in sprint.

◆ TARGETING_ANGLE_NORMAL

enum EMeleeHitType TARGETING_ANGLE_NORMAL = 30.0

Target selection settings.

Second Pass: Half angle of cone

Используется в GetAngle().

◆ TARGETING_ANGLE_SPRINT

const float TARGETING_ANGLE_SPRINT = 15.0
protected

Second Pass: Half angle of cone during sprint.

Используется в GetAngle().

◆ TARGETING_MAX_HEIGHT

const float TARGETING_MAX_HEIGHT = 2.0
protected

Second Pass: How high the cone goes in meters from player position.

Используется в TargetSelection().

◆ TARGETING_MIN_HEIGHT

const float TARGETING_MIN_HEIGHT = -2.0
protected

Second Pass: How deep the cone goes in meters from player position.

Используется в TargetSelection().

◆ TARGETING_RAY_DIST

const float TARGETING_RAY_DIST = 5.0
protected

DEPRECATED: "HitZoneSelection".

Используется в HitZoneSelection().

◆ TARGETING_RAY_DIST_SHORT

const float TARGETING_RAY_DIST_SHORT = 2.0
protected

DEPRECATED: "HitZoneSelection".

Используется в HitZoneSelection().

◆ TARGETING_RAY_RADIUS

const float TARGETING_RAY_RADIUS = 0.25
protected

DEPRECATED: "HitZoneSelection".

Используется в HitZoneSelection().

◆ TARGETING_RAY_RADIUS_EX

const float TARGETING_RAY_RADIUS_EX = 0.5
protected

Second Pass: Max distance from ray projected from player looking direction.

Используется в TargetSelection().