Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
dayzplayerimplementmeleecombat.c File Reference

Go to the source code of this file.

Enumerations

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

Functions

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 More...
 
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 ()
 
protected int SelectWeaponMode (InventoryItem weapon)
 
protected float GetWeaponRange (InventoryItem weapon, int weaponMode)
 
protected float GetRange ()
 
protected float GetAngle ()
 
protected void TargetSelection ()
 
protected int TrySelectFinisherType (InventoryItem weapon, EntityAI target)
 General condition for finisher attacks. More...
 
protected int DetermineSpecificFinisherType (ItemBase weapon)
 
protected void InternalResetTarget ()
 
protected void SetTarget (Object obj, vector hitPos, int hitZone)
 
protected bool CanObjectBeTargeted (Object obj, bool checkNonAligneAble=false)
 
protected bool HitZoneSelectionRaycastHelper (out vector hitPos, out int hitZone, out Object target)
 
protected bool HitZoneSelectionRaycast (out vector hitPos, out int hitZone, out Object target, bool useCamera)
 
protected void HitZoneSelection ()
 DEPRECATED. More...
 
protected bool IsObstructed (Object object)
 DEPRECATED - New function in MeleeTargeting. More...
 
private bool IsEntityBehindEntityInAngle (EntityAI source, EntityAI target, float angle)
 

Variables

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

Enumeration Type Documentation

◆ EMeleeHitType

Enumerator
NONE 
LIGHT 
HEAVY 
SPRINT 
KICK 
FINISHER_LIVERSTAB 
FINISHER_NECKSTAB 
FINISHER_GENERIC 
WPN_HIT 
WPN_HIT_BUTTSTOCK 
WPN_STAB 
WPN_STAB_FINISHER 

Definition at line 1 of file dayzplayerimplementmeleecombat.c.

Function Documentation

◆ CanObjectBeTargeted()

protected bool CanObjectBeTargeted ( Object  obj,
bool  checkNonAligneAble = false 
)

Definition at line 530 of file dayzplayerimplementmeleecombat.c.

◆ CheckMeleeItem()

void CheckMeleeItem ( )

Definition at line 248 of file dayzplayerimplementmeleecombat.c.

◆ DayZPlayerImplementMeleeCombat()

void DayZPlayerImplementMeleeCombat ( DayZPlayerImplement  player)

Definition at line 90 of file dayzplayerimplementmeleecombat.c.

◆ DetermineSpecificFinisherType()

protected int DetermineSpecificFinisherType ( ItemBase  weapon)

Definition at line 488 of file dayzplayerimplementmeleecombat.c.

◆ GetAngle()

protected float GetAngle ( )

Definition at line 326 of file dayzplayerimplementmeleecombat.c.

◆ GetFinisherType()

int GetFinisherType ( )

Definition at line 177 of file dayzplayerimplementmeleecombat.c.

◆ GetHitPos()

vector GetHitPos ( )

Definition at line 167 of file dayzplayerimplementmeleecombat.c.

◆ GetHitType()

EMeleeHitType GetHitType ( )

Definition at line 141 of file dayzplayerimplementmeleecombat.c.

◆ GetHitZoneIdx()

int GetHitZoneIdx ( )

component idx

Definition at line 162 of file dayzplayerimplementmeleecombat.c.

◆ GetRange()

protected float GetRange ( )

Definition at line 321 of file dayzplayerimplementmeleecombat.c.

◆ GetTargetEntity()

EntityAI GetTargetEntity ( )

Definition at line 151 of file dayzplayerimplementmeleecombat.c.

◆ GetWeaponMode()

int GetWeaponMode ( )

Definition at line 187 of file dayzplayerimplementmeleecombat.c.

◆ GetWeaponRange()

protected float GetWeaponRange ( InventoryItem  weapon,
int  weaponMode 
)

Definition at line 313 of file dayzplayerimplementmeleecombat.c.

◆ HitZoneSelection()

protected void HitZoneSelection ( )

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

Definition at line 602 of file dayzplayerimplementmeleecombat.c.

◆ HitZoneSelectionRaycast()

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

Prevents targeting of objects behind player

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

Definition at line 544 of file dayzplayerimplementmeleecombat.c.

◆ HitZoneSelectionRaycastHelper()

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

Definition at line 535 of file dayzplayerimplementmeleecombat.c.

◆ Init()

void Init ( DayZPlayerImplement  player)

Definition at line 95 of file dayzplayerimplementmeleecombat.c.

◆ InternalResetTarget()

protected void InternalResetTarget ( )

Definition at line 510 of file dayzplayerimplementmeleecombat.c.

◆ IsEntityBehindEntityInAngle()

private bool IsEntityBehindEntityInAngle ( EntityAI  source,
EntityAI  target,
float  angle 
)

Definition at line 692 of file dayzplayerimplementmeleecombat.c.

◆ IsObstructed()

protected bool IsObstructed ( Object  object)

DEPRECATED - New function in MeleeTargeting.

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

Definition at line 668 of file dayzplayerimplementmeleecombat.c.

◆ Reset()

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

Definition at line 192 of file dayzplayerimplementmeleecombat.c.

◆ ResetTarget()

void ResetTarget ( )

Definition at line 208 of file dayzplayerimplementmeleecombat.c.

◆ SelectWeaponMode()

protected int SelectWeaponMode ( InventoryItem  weapon)

melee with firearm

melee weapon attacks - gets mode from the item

bare hand melee mode selection

default bare-hand light attack

Definition at line 269 of file dayzplayerimplementmeleecombat.c.

◆ SetFinisherType()

void SetFinisherType ( int  pFinisherType)

Definition at line 182 of file dayzplayerimplementmeleecombat.c.

◆ SetHitPos()

void SetHitPos ( vector  pHitPos)

Definition at line 172 of file dayzplayerimplementmeleecombat.c.

◆ SetHitZoneIdx()

void SetHitZoneIdx ( int  pHitZone)

Definition at line 146 of file dayzplayerimplementmeleecombat.c.

◆ SetTarget()

protected void SetTarget ( Object  obj,
vector  hitPos,
int  hitZone 
)

Definition at line 519 of file dayzplayerimplementmeleecombat.c.

◆ SetTargetObject()

void SetTargetObject ( Object  pTarget)

Definition at line 156 of file dayzplayerimplementmeleecombat.c.

◆ TargetSelection()

protected void TargetSelection ( )

Definition at line 334 of file dayzplayerimplementmeleecombat.c.

◆ TrySelectFinisherType()

protected int TrySelectFinisherType ( InventoryItem  weapon,
EntityAI  target 
)

General condition for finisher attacks.

Parameters
weaponWeapon used in the attack
targetTarget entity
Returns
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

Definition at line 417 of file dayzplayerimplementmeleecombat.c.

◆ Update()

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

Store target into input packet

Definition at line 220 of file dayzplayerimplementmeleecombat.c.

◆ ~DayZPlayerImplementMeleeCombat()

Variable Documentation

◆ DEFAULT_HIT_ZONE

const protected string DEFAULT_HIT_ZONE = "Torso"

DEPRECATED: "HitZoneSelection".

Definition at line 34 of file dayzplayerimplementmeleecombat.c.

◆ m_AllTargetObjects

protected ref array<Object> m_AllTargetObjects

All potential targets found during most recent TargetSelection.

Definition at line 42 of file dayzplayerimplementmeleecombat.c.

◆ m_BlacklistedDamageZones

protected ref array<string> m_BlacklistedDamageZones

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

Definition at line 51 of file dayzplayerimplementmeleecombat.c.

◆ m_DebugForcedFinisherType

private int m_DebugForcedFinisherType

Definition at line 84 of file dayzplayerimplementmeleecombat.c.

◆ m_DZPlayer

protected DayZPlayerImplement m_DZPlayer

Parent.

Player executing the melee

Definition at line 54 of file dayzplayerimplementmeleecombat.c.

◆ m_FinisherType

protected int m_FinisherType

Definition at line 74 of file dayzplayerimplementmeleecombat.c.

◆ m_ForceUntargetable

protected bool m_ForceUntargetable

Misc - cache.

Forcing current target as untargetable

Definition at line 62 of file dayzplayerimplementmeleecombat.c.

◆ m_HitPositionWS

protected vector m_HitPositionWS

Most recent target position.

Definition at line 76 of file dayzplayerimplementmeleecombat.c.

◆ m_HitType

protected EMeleeHitType m_HitType

Hit type of the most recent attack.

Definition at line 70 of file dayzplayerimplementmeleecombat.c.

◆ m_HitZoneIdx

protected int m_HitZoneIdx

Hit result - cache.

Most recent target HitZone index

Definition at line 73 of file dayzplayerimplementmeleecombat.c.

◆ m_HitZoneName

protected string m_HitZoneName

Most recent target HitZone name.

Definition at line 75 of file dayzplayerimplementmeleecombat.c.

◆ m_MeleeTargeting

protected ref MeleeTargeting m_MeleeTargeting

Target selecting "component".

Contains logic for Second Pass

Definition at line 37 of file dayzplayerimplementmeleecombat.c.

◆ m_NonAlignableObjects

protected ref array<typename> m_NonAlignableObjects

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

Definition at line 50 of file dayzplayerimplementmeleecombat.c.

◆ m_RayEnd

protected vector m_RayEnd

End position of most recent HitZoneSelectionRaycast.

Definition at line 67 of file dayzplayerimplementmeleecombat.c.

◆ m_RayEndShort

protected vector m_RayEndShort

DEPRECATED: "HitZoneSelection".

Definition at line 68 of file dayzplayerimplementmeleecombat.c.

◆ m_RayStart

protected vector m_RayStart

Start position of most recent HitZoneSelectionRaycast.

Definition at line 66 of file dayzplayerimplementmeleecombat.c.

◆ m_SprintAttack

protected bool m_SprintAttack

If most recent attack was a sprint attack.

Definition at line 63 of file dayzplayerimplementmeleecombat.c.

◆ m_TargetableObjects

protected ref array<typename> m_TargetableObjects

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

Definition at line 49 of file dayzplayerimplementmeleecombat.c.

◆ m_TargetObject

protected Object m_TargetObject

Targets - types.

Main target found during most recent TargetSelection

Definition at line 40 of file dayzplayerimplementmeleecombat.c.

◆ m_TargetType

protected EMeleeTargetType m_TargetType

DEPRECATED: Was added but never used..?

Definition at line 41 of file dayzplayerimplementmeleecombat.c.

◆ m_WasHit

protected bool m_WasHit

If most recent attack was.

Definition at line 64 of file dayzplayerimplementmeleecombat.c.

◆ m_Weapon

protected InventoryItem m_Weapon

Weapons - cache.

Weapon used during most recent Update

Definition at line 57 of file dayzplayerimplementmeleecombat.c.

◆ m_WeaponMode

protected int m_WeaponMode

WeaponMode used during most recent Update.

Definition at line 58 of file dayzplayerimplementmeleecombat.c.

◆ m_WeaponRange

protected float m_WeaponRange

WeaponRange used during most recent Update.

Definition at line 59 of file dayzplayerimplementmeleecombat.c.

◆ RANGE_EXTENDER_NORMAL

const protected float RANGE_EXTENDER_NORMAL = 0.65

General range extension.

Definition at line 31 of file dayzplayerimplementmeleecombat.c.

◆ RANGE_EXTENDER_SPRINT

const protected float RANGE_EXTENDER_SPRINT = 1.35

General range extension while in sprint.

Definition at line 32 of file dayzplayerimplementmeleecombat.c.

◆ TARGETING_ANGLE_NORMAL

enum EMeleeHitType TARGETING_ANGLE_NORMAL = 30.0

Target selection settings.

Second Pass: Half angle of cone

◆ TARGETING_ANGLE_SPRINT

const protected float TARGETING_ANGLE_SPRINT = 15.0

Second Pass: Half angle of cone during sprint.

Definition at line 23 of file dayzplayerimplementmeleecombat.c.

◆ TARGETING_MAX_HEIGHT

const protected float TARGETING_MAX_HEIGHT = 2.0

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

Definition at line 25 of file dayzplayerimplementmeleecombat.c.

◆ TARGETING_MIN_HEIGHT

const protected float TARGETING_MIN_HEIGHT = -2.0

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

Definition at line 24 of file dayzplayerimplementmeleecombat.c.

◆ TARGETING_RAY_DIST

const protected float TARGETING_RAY_DIST = 5.0

DEPRECATED: "HitZoneSelection".

Definition at line 28 of file dayzplayerimplementmeleecombat.c.

◆ TARGETING_RAY_DIST_SHORT

const protected float TARGETING_RAY_DIST_SHORT = 2.0

DEPRECATED: "HitZoneSelection".

Definition at line 29 of file dayzplayerimplementmeleecombat.c.

◆ TARGETING_RAY_RADIUS

const protected float TARGETING_RAY_RADIUS = 0.25

DEPRECATED: "HitZoneSelection".

Definition at line 27 of file dayzplayerimplementmeleecombat.c.

◆ TARGETING_RAY_RADIUS_EX

const protected float TARGETING_RAY_RADIUS_EX = 0.5

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

Definition at line 26 of file dayzplayerimplementmeleecombat.c.