Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
dayzplayermeleefightlogic_lightheavy.c File Reference

Go to the source code of this file.

Enumerations

enum  EFightLogicCooldownCategory { EVADE = 0 }
 Light / Heavy punches. More...

Functions

void ~DayZPlayerMeleeFightLogic_LightHeavy ()
bool CanFight ()
void DamageHands (DayZPlayer DZPlayer, ClothingBase gloves, InventoryItem itemInHands)
void DayZPlayerMeleeFightLogic_LightHeavy (DayZPlayerImplement player)
string DetermineFinisherAmmo (int finisher_type)
 Picks a specific finisher ammo fot the hit type. This gets synchronized and guides further behaviour of the target.
int DetermineFinisherAnimation (int finisher_type)
 Picks a specific finisher animation. Not used for mounted bayonet stabs.
int DetermineSpecificFinisherType (ItemBase weapon, int component)
void DisableControls ()
bool DummyHitSelector (EMeleeHitType hitType, out string ammoType)
 evaluation of hit player vs. player
void EnableControls ()
bool EvaluateFinisherAttack (InventoryItem weapon, Object target)
 Check and evaluate stealth kill, if applicable.
void EvaluateHit (InventoryItem weapon)
void EvaluateHit_Common (InventoryItem weapon, Object target, bool forcedDummy=false, int forcedWeaponMode=-1)
void EvaluateHit_Infected (InventoryItem weapon, Object target)
void EvaluateHit_NonAlignableObjects (InventoryItem weapon, Object target)
void EvaluateHit_Player (InventoryItem weapon, Object target)
float GetAttackTypeByDistanceToTarget (EntityAI pTarget, EMeleeTargetType pTargetType=EMeleeTargetType.ALIGNABLE)
EMeleeHitType GetAttackTypeByWeaponAttachments (EntityAI pEntity)
EMeleeHitType GetAttackTypeFromInputs (HumanInputController pInputs)
bool GetCurrentHitType ()
int GetFinisherType (InventoryItem weapon, EntityAI target)
void GetTargetData (out EntityAI target, out EMeleeTargetType targetType)
bool HandleComboHit (int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
 combo hits - when we are already in Melee command and clicking UseButton
bool HandleFightLogic (int pCurrentCommandID, HumanInputController pInputs, EntityAI pEntityInHands, HumanMovementState pMovementState, out bool pContinueAttack)
bool HandleHitEvent (int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
 Handle the event that our melee hit something.
bool HandleInitialFirearmMelee (int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
 NOTE: Only singular (or first) hits, combo attacks are handled in combo.
bool HandleInitialMeleeErc (int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
 First attack in raised erc (light or heavy if modifier is used). Also added support for finishers.
bool HandleProneKick (int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
 kick from raised pne
bool HandleSprintAttack (int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
 sprint attack in erc stance
void Init (DayZPlayerImplement player)
bool IsBehindEntity (int angle, DayZPlayer source, Object target)
 DEPRECATED - moved into DayZPlayerImplementMeleeCombat.
bool IsEvading ()
bool IsHitTypeFinisher (int type)
bool IsInBlock ()
bool IsShortDistance (EntityAI pTarget, float pDistanceSq)
void RegisterCooldowns ()
void ResetCooldown (EFightLogicCooldownCategory cooldownCategory)
void SetBlock (bool block)
void SetCooldown (float time, EFightLogicCooldownCategory cooldownCategory)
bool WeaponDestroyedCheck (InventoryItem weapon, out string ammo)

Variables

const float CLOSE_TARGET_DISTANCE = 1.5
const string DUMMY_HEAVY_AMMO = "Dummy_Heavy"
const string DUMMY_LIGHT_AMMO = "Dummy_Light"
 dummy ammo types
enum EFightLogicCooldownCategory EVADE_COOLDOWN = 0.5
 cooldown timers settings
ref map< int, ref Timerm_CooldownTimers
DayZPlayerImplement m_DZPlayer
 DEPRECATED.
EMeleeHitType m_HitType
bool m_IsEvading
bool m_IsFinisher
bool m_IsInBlock
bool m_IsInComboRange
ref DayZPlayerImplementMeleeCombat m_MeleeCombat
Mission m_Mission
PlayerBase m_Player
bool m_WasPreviousHitProcessed

Enumeration Type Documentation

◆ EFightLogicCooldownCategory

Light / Heavy punches.

Enumerator
EVADE 

Definition at line 2 of file dayzplayermeleefightlogic_lightheavy.c.

Function Documentation

◆ ~DayZPlayerMeleeFightLogic_LightHeavy()

Definition at line 51 of file dayzplayermeleefightlogic_lightheavy.c.

◆ CanFight()

bool CanFight ( )
protected

Definition at line 73 of file dayzplayermeleefightlogic_lightheavy.c.

◆ DamageHands()

void DamageHands ( DayZPlayer DZPlayer,
ClothingBase gloves,
InventoryItem itemInHands )
protected

◆ DayZPlayerMeleeFightLogic_LightHeavy()

void DayZPlayerMeleeFightLogic_LightHeavy ( DayZPlayerImplement player)
protected

◆ DetermineFinisherAmmo()

string DetermineFinisherAmmo ( int finisher_type)
protected

Picks a specific finisher ammo fot the hit type. This gets synchronized and guides further behaviour of the target.

Definition at line 918 of file dayzplayermeleefightlogic_lightheavy.c.

Referenced by EvaluateFinisherAttack().

◆ DetermineFinisherAnimation()

int DetermineFinisherAnimation ( int finisher_type)
protected

Picks a specific finisher animation. Not used for mounted bayonet stabs.

Definition at line 899 of file dayzplayermeleefightlogic_lightheavy.c.

References HumanCommandMelee2::HIT_TYPE_FINISHER, and HumanCommandMelee2::HIT_TYPE_FINISHER_NECK.

Referenced by HandleInitialMeleeErc().

◆ DetermineSpecificFinisherType()

int DetermineSpecificFinisherType ( ItemBase weapon,
int component )
protected

Definition at line 956 of file dayzplayermeleefightlogic_lightheavy.c.

References component.

◆ DisableControls()

◆ DummyHitSelector()

bool DummyHitSelector ( EMeleeHitType hitType,
out string ammoType )
protected

evaluation of hit player vs. player

in case of kick (on back or push from erc) change the ammo type to dummy

Definition at line 768 of file dayzplayermeleefightlogic_lightheavy.c.

References DUMMY_HEAVY_AMMO, and DUMMY_LIGHT_AMMO.

Referenced by EvaluateHit_Common().

◆ EnableControls()

void EnableControls ( )
protected

Referenced by HandleHitEvent().

◆ EvaluateFinisherAttack()

bool EvaluateFinisherAttack ( InventoryItem weapon,
Object target )
protected

Check and evaluate stealth kill, if applicable.

Definition at line 645 of file dayzplayermeleefightlogic_lightheavy.c.

References DetermineFinisherAmmo(), g_Game, and m_MeleeCombat.

Referenced by EvaluateHit_Infected().

◆ EvaluateHit()

◆ EvaluateHit_Common()

void EvaluateHit_Common ( InventoryItem weapon,
Object target,
bool forcedDummy = false,
int forcedWeaponMode = -1 )
protected

check if we need to use dummy hit

normal hit with applied damage to targeted component

play hit animation for dummy hits

override hit pos by pos defined in type

Definition at line 660 of file dayzplayermeleefightlogic_lightheavy.c.

References DummyHitSelector(), g_Game, m_HitType, m_MeleeCombat, and WeaponDestroyedCheck().

Referenced by EvaluateHit(), EvaluateHit_Infected(), and EvaluateHit_Player().

◆ EvaluateHit_Infected()

void EvaluateHit_Infected ( InventoryItem weapon,
Object target )
protected

Definition at line 637 of file dayzplayermeleefightlogic_lightheavy.c.

References EvaluateFinisherAttack(), and EvaluateHit_Common().

Referenced by EvaluateHit().

◆ EvaluateHit_NonAlignableObjects()

void EvaluateHit_NonAlignableObjects ( InventoryItem weapon,
Object target )
protected

Definition at line 705 of file dayzplayermeleefightlogic_lightheavy.c.

References m_MeleeCombat, and WeaponDestroyedCheck().

Referenced by EvaluateHit().

◆ EvaluateHit_Player()

void EvaluateHit_Player ( InventoryItem weapon,
Object target )
protected

Melee Hit/Impact modifiers

if the oponnent is in Melee Block shift the damage down

Definition at line 604 of file dayzplayermeleefightlogic_lightheavy.c.

References Math::AbsFloat(), Math3D::AngleFromPosition(), EvaluateHit_Common(), m_MeleeCombat, GameConstants::PVP_MAX_BLOCKABLE_ANGLE, and Math::RAD2DEG.

Referenced by EvaluateHit().

◆ GetAttackTypeByDistanceToTarget()

float GetAttackTypeByDistanceToTarget ( EntityAI pTarget,
EMeleeTargetType pTargetType = EMeleeTargetType.ALIGNABLE )
protected

target in short distance - in place attack

target is far from the player - forward movement attack

Definition at line 120 of file dayzplayermeleefightlogic_lightheavy.c.

References CLOSE_TARGET_DISTANCE, IsShortDistance(), and Math::SqrFloat().

Referenced by HandleComboHit(), HandleInitialFirearmMelee(), HandleInitialMeleeErc(), HandleProneKick(), and HandleSprintAttack().

◆ GetAttackTypeByWeaponAttachments()

EMeleeHitType GetAttackTypeByWeaponAttachments ( EntityAI pEntity)
protected

use stabbing if the bayonet/knife is attached to firearm

Definition at line 100 of file dayzplayermeleefightlogic_lightheavy.c.

Referenced by HandleComboHit(), and HandleInitialFirearmMelee().

◆ GetAttackTypeFromInputs()

EMeleeHitType GetAttackTypeFromInputs ( HumanInputController pInputs)
protected

◆ GetCurrentHitType()

bool GetCurrentHitType ( )
protected

Definition at line 68 of file dayzplayermeleefightlogic_lightheavy.c.

References m_HitType.

◆ GetFinisherType()

int GetFinisherType ( InventoryItem weapon,
EntityAI target )
protected

Definition at line 946 of file dayzplayermeleefightlogic_lightheavy.c.

◆ GetTargetData()

void GetTargetData ( out EntityAI target,
out EMeleeTargetType targetType )
protected

default

nullify target for nonalignable objects (big objects)

Definition at line 744 of file dayzplayermeleefightlogic_lightheavy.c.

References m_MeleeCombat.

Referenced by HandleComboHit(), HandleInitialFirearmMelee(), HandleInitialMeleeErc(), HandleProneKick(), and HandleSprintAttack().

◆ HandleComboHit()

bool HandleComboHit ( int pCurrentCommandID,
HumanInputController pInputs,
InventoryItem itemInHands,
HumanMovementState pMovementState,
out bool pContinueAttack )
protected

combo hits - when we are already in Melee command and clicking UseButton

select if the next attack will be light or heavy (based on input/attachment modifier)

no suitable attack - skip that

No combos for the finisher command

wait for the previous hit commit before hitting again if the next attack is heavy and the previous wasn't - otherwise the previous light attack will turn into heavy

targetting

continue 'combo' - left hand attacks

broken legs shock

stamina depletion per attack

Definition at line 504 of file dayzplayermeleefightlogic_lightheavy.c.

References PlayerConstants::BROKEN_LEGS_HEAVY_MELEE_SHOCK, PlayerConstants::BROKEN_LEGS_LIGHT_MELEE_SHOCK, DisableControls(), GetAttackTypeByDistanceToTarget(), GetAttackTypeByWeaponAttachments(), GetAttackTypeFromInputs(), GetTargetData(), m_HitType, m_MeleeCombat, and m_WasPreviousHitProcessed.

Referenced by HandleFightLogic().

◆ HandleFightLogic()

bool HandleFightLogic ( int pCurrentCommandID,
HumanInputController pInputs,
EntityAI pEntityInHands,
HumanMovementState pMovementState,
out bool pContinueAttack )
protected

Check if we need to damage

Actually pressing a button to start a melee attack

do not perform attacks when blocking

if the item in hands cannot be used as melee weapon

Currently not performing any attacks, so here we start the initial

melee with firearm

first attack in raised erc (light or heavy if modifier is used). Also added support for finishers

kick from raised pne

sprint attack in erc stance

combo hits - when we are already in Melee command and clicking UseButton

evade and blocking logic

evades in raised erc stance while moving

not enough stamina to do evades

stand up when crouching and raised pressed

blocks in raised erc/pro stance (bare hand or with melee weapon only)

Definition at line 137 of file dayzplayermeleefightlogic_lightheavy.c.

References PlayerConstants::BROKEN_LEGS_LIGHT_MELEE_SHOCK, DayZPlayerUtils(), EVADE_COOLDOWN, HumanCommandMove::ForceStance(), HumanCommandMove::GetCurrentInputAngle(), HandleComboHit(), HandleHitEvent(), HandleInitialFirearmMelee(), HandleInitialMeleeErc(), HandleProneKick(), HandleSprintAttack(), HumanInputController::IsAttackButtonDown(), HumanInventoryWithFSM::IsIdle(), HumanInputController::IsMeleeLREvade(), HumanInputController::IsMeleeWeaponAttack(), HumanInputController::IsWeaponRaised(), m_IsEvading, m_IsInBlock, m_IsInComboRange, HumanMovementState::m_iStanceIdx, SetBlock(), SetCooldown(), HumanCommandMove::SetMeleeBlock(), and HumanCommandMove::StartMeleeEvadeA().

◆ HandleHitEvent()

bool HandleHitEvent ( int pCurrentCommandID,
HumanInputController pInputs,
InventoryItem itemInHands,
HumanMovementState pMovementState,
out bool pContinueAttack )
protected

Handle the event that our melee hit something.

Check if we need to damage

on anim event Hit received

re-target (enemy can have moved out of range or disappeared)

evaluate hit - selection of cfg 'ammo' type

Definition at line 282 of file dayzplayermeleefightlogic_lightheavy.c.

References DamageHands(), EnableControls(), EvaluateHit(), m_HitType, m_MeleeCombat, m_WasPreviousHitProcessed, and HumanCommandMelee2::WasHit().

Referenced by HandleFightLogic().

◆ HandleInitialFirearmMelee()

bool HandleInitialFirearmMelee ( int pCurrentCommandID,
HumanInputController pInputs,
InventoryItem itemInHands,
HumanMovementState pMovementState,
out bool pContinueAttack )
protected

NOTE: Only singular (or first) hits, combo attacks are handled in combo.

don't allow bash to interfere with actions like chambering or ejecting bullets

perform firearm melee from raised erect or continue with attack after character stand up from crouch

exit if there is no suitable attack

char stand up when performing firearm melee from crouch

Definition at line 337 of file dayzplayermeleefightlogic_lightheavy.c.

References DisableControls(), HumanCommandMove::ForceStance(), GetAttackTypeByDistanceToTarget(), GetAttackTypeByWeaponAttachments(), HumanCommandMove::GetCurrentMovementSpeed(), GetTargetData(), m_HitType, HumanMovementState::m_iStanceIdx, and m_MeleeCombat.

Referenced by HandleFightLogic().

◆ HandleInitialMeleeErc()

bool HandleInitialMeleeErc ( int pCurrentCommandID,
HumanInputController pInputs,
InventoryItem itemInHands,
HumanMovementState pMovementState,
out bool pContinueAttack )
protected

◆ HandleProneKick()

bool HandleProneKick ( int pCurrentCommandID,
HumanInputController pInputs,
InventoryItem itemInHands,
HumanMovementState pMovementState,
out bool pContinueAttack )
protected

kick from raised pne

check if player is on back (situation where the player is raised in prone and on back is not in anim graph)

Definition at line 452 of file dayzplayermeleefightlogic_lightheavy.c.

References DisableControls(), GetAttackTypeByDistanceToTarget(), HumanCommandWeapons::GetBaseAimingAngleLR(), GetTargetData(), m_HitType, and m_MeleeCombat.

Referenced by HandleFightLogic().

◆ HandleSprintAttack()

bool HandleSprintAttack ( int pCurrentCommandID,
HumanInputController pInputs,
InventoryItem itemInHands,
HumanMovementState pMovementState,
out bool pContinueAttack )
protected

sprint attack in erc stance

targetting

command

Definition at line 482 of file dayzplayermeleefightlogic_lightheavy.c.

References DisableControls(), GetAttackTypeByDistanceToTarget(), GetTargetData(), m_HitType, and m_MeleeCombat.

Referenced by HandleFightLogic().

◆ Init()

◆ IsBehindEntity()

bool IsBehindEntity ( int angle,
DayZPlayer source,
Object target )
protected

DEPRECATED - moved into DayZPlayerImplementMeleeCombat.

Definition at line 785 of file dayzplayermeleefightlogic_lightheavy.c.

◆ IsEvading()

bool IsEvading ( )
protected

Definition at line 63 of file dayzplayermeleefightlogic_lightheavy.c.

References m_IsEvading.

◆ IsHitTypeFinisher()

bool IsHitTypeFinisher ( int type)
protected

Definition at line 951 of file dayzplayermeleefightlogic_lightheavy.c.

◆ IsInBlock()

bool IsInBlock ( )
protected

Definition at line 53 of file dayzplayermeleefightlogic_lightheavy.c.

References m_IsInBlock.

◆ IsShortDistance()

bool IsShortDistance ( EntityAI pTarget,
float pDistanceSq )
protected

◆ RegisterCooldowns()

void RegisterCooldowns ( )
protected

Definition at line 84 of file dayzplayermeleefightlogic_lightheavy.c.

References CALL_CATEGORY_SYSTEM, and m_CooldownTimers.

Referenced by Init().

◆ ResetCooldown()

void ResetCooldown ( EFightLogicCooldownCategory cooldownCategory)
protected

Definition at line 803 of file dayzplayermeleefightlogic_lightheavy.c.

References m_IsEvading.

◆ SetBlock()

void SetBlock ( bool block)
protected

Definition at line 58 of file dayzplayermeleefightlogic_lightheavy.c.

References m_IsInBlock.

Referenced by HandleFightLogic().

◆ SetCooldown()

void SetCooldown ( float time,
EFightLogicCooldownCategory cooldownCategory )
protected

stops currently running cooldown timer (for specific category)

param for ResetCooldown

Definition at line 790 of file dayzplayermeleefightlogic_lightheavy.c.

References m_CooldownTimers.

◆ WeaponDestroyedCheck()

bool WeaponDestroyedCheck ( InventoryItem weapon,
out string ammo )
protected

Variable Documentation

◆ CLOSE_TARGET_DISTANCE

const float CLOSE_TARGET_DISTANCE = 1.5

◆ DUMMY_HEAVY_AMMO

const string DUMMY_HEAVY_AMMO = "Dummy_Heavy"

Definition at line 17 of file dayzplayermeleefightlogic_lightheavy.c.

Referenced by DummyHitSelector().

◆ DUMMY_LIGHT_AMMO

const string DUMMY_LIGHT_AMMO = "Dummy_Light"

dummy ammo types

Definition at line 16 of file dayzplayermeleefightlogic_lightheavy.c.

Referenced by DummyHitSelector().

◆ EVADE_COOLDOWN

enum EFightLogicCooldownCategory EVADE_COOLDOWN = 0.5

cooldown timers settings

Referenced by HandleFightLogic().

◆ m_CooldownTimers

ref map<int, ref Timer> m_CooldownTimers
protected

Definition at line 22 of file dayzplayermeleefightlogic_lightheavy.c.

Referenced by RegisterCooldowns(), and SetCooldown().

◆ m_DZPlayer

DayZPlayerImplement m_DZPlayer
protected

DEPRECATED.

Definition at line 943 of file dayzplayermeleefightlogic_lightheavy.c.

◆ m_HitType

EMeleeHitType m_HitType
protected

Definition at line 21 of file dayzplayermeleefightlogic_lightheavy.c.

◆ m_IsEvading

bool m_IsEvading
protected

◆ m_IsFinisher

bool m_IsFinisher
protected

Definition at line 944 of file dayzplayermeleefightlogic_lightheavy.c.

◆ m_IsInBlock

bool m_IsInBlock
protected

Definition at line 25 of file dayzplayermeleefightlogic_lightheavy.c.

Referenced by HandleFightLogic(), Init(), IsInBlock(), and SetBlock().

◆ m_IsInComboRange

bool m_IsInComboRange
protected

Definition at line 28 of file dayzplayermeleefightlogic_lightheavy.c.

Referenced by HandleFightLogic().

◆ m_MeleeCombat

◆ m_Mission

Mission m_Mission
protected

Definition at line 23 of file dayzplayermeleefightlogic_lightheavy.c.

Referenced by Init().

◆ m_Player

PlayerBase m_Player
protected

Definition at line 19 of file dayzplayermeleefightlogic_lightheavy.c.

◆ m_WasPreviousHitProcessed

bool m_WasPreviousHitProcessed
protected