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

Private Member Functions

void ActionRestrainTarget ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override int GetStanceMask (PlayerBase player)
 
override bool ActionConditionContinue (ActionData action_data)
 
override void OnStartServer (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 
override void OnFinishProgressClient (ActionData action_data)
 
- Private Member Functions inherited from ActionContinuousBase
void OnStartAnimationLoopServer (ActionData action_data)
 
void OnStartAnimationLoopClient (ActionData action_data)
 
void OnEndAnimationLoopServer (ActionData action_data)
 
void OnEndAnimationLoopClient (ActionData action_data)
 
void OnFinishProgressServer (ActionData action_data)
 
void OnFinishProgressClient (ActionData action_data)
 

Detailed Description

Definition at line 19 of file ActionRestrainTarget.c.

Constructor & Destructor Documentation

◆ ActionRestrainTarget()

void ActionRestrainTarget::ActionRestrainTarget ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

override bool ActionRestrainTarget::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 37 of file ActionRestrainTarget.c.

38 {
39 PlayerBase other_player = PlayerBase.Cast(target.GetObject());
40 if (!other_player)
41 return false;
42 if (player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
43 return other_player.CanBeRestrained();
44 else
45 return !other_player.IsRestrained();
46
47 }
DayZPlayerInstanceType
defined in C++

◆ ActionConditionContinue()

override bool ActionRestrainTarget::ActionConditionContinue ( ActionData action_data)
inlineprivate

Definition at line 57 of file ActionRestrainTarget.c.

58 {
59 PlayerBase target_player = PlayerBase.Cast(action_data.m_Target.GetObject());
60
61 if (GetGame().IsServer() && GetGame().IsMultiplayer())
62 {
63 if (target_player.IsSurrendered() || !target_player.CanBeRestrained())
64 return false;
65 }
66 if (GetGame().IsServer())
67 {
69
70 if (callback.GetActionComponentProgress() > 0.75 && !target_player.IsRestrainPrelocked())
71 target_player.SetRestrainPrelocked(true);
72
73 return !GetGame().GetMission().IsPlayerDisconnecting(target_player);
74
75 }
76 return true;
77 }
proto native CGame GetGame()

References GetGame().

◆ CreateConditionComponents()

override void ActionRestrainTarget::CreateConditionComponents ( )
inlineprivate

Definition at line 31 of file ActionRestrainTarget.c.

32 {
35 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
Definition CCTMan.c:2
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ GetStanceMask()

override int ActionRestrainTarget::GetStanceMask ( PlayerBase player)
inlineprivate

Definition at line 49 of file ActionRestrainTarget.c.

50 {
51 if (player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_PRONE))
52 return DayZPlayerConstants.STANCEMASK_CROUCH;
53 else
54 return DayZPlayerConstants.STANCEMASK_ERECT;
55 }

◆ OnEndServer()

override void ActionRestrainTarget::OnEndServer ( ActionData action_data)
inlineprivate

Definition at line 93 of file ActionRestrainTarget.c.

94 {
95 PlayerBase target_player = PlayerBase.Cast(action_data.m_Target.GetObject());
96 if (target_player)
97 {
98 target_player.SetRestrainStarted(false);
99 target_player.SetRestrainPrelocked(false);
100 }
101 }

◆ OnFinishProgressClient()

override void ActionRestrainTarget::OnFinishProgressClient ( ActionData action_data)
inlineprivate

Definition at line 138 of file ActionRestrainTarget.c.

139 {
140 super.OnFinishProgressClient(action_data);
141
142 GetGame().GetAnalyticsClient().OnActionRestrain();
143 }

References GetGame().

◆ OnFinishProgressServer()

override void ActionRestrainTarget::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 103 of file ActionRestrainTarget.c.

104 {
105 PlayerBase target_player = PlayerBase.Cast(action_data.m_Target.GetObject());
107
108 if (CanReceiveAction(action_data.m_Target) && !target_player.IsRestrained())
109 {
110 EntityAI item_in_hands_target = target_player.GetHumanInventory().GetEntityInHands();
111 EntityAI item_in_hands_source = source_player.GetHumanInventory().GetEntityInHands();
112
114 {
115 Error("Restraining target failed, nothing in hands");
116 return;
117 }
118
119 string new_item_name = MiscGameplayFunctions.ObtainRestrainItemTargetClassname(item_in_hands_source);
121 {
122 Print("Restraining player with item in hands, first drop & then restrain");
123
125 MiscGameplayFunctions.TurnItemInHandsIntoItemEx(target_player, lambda2);
126 }
127 else
128 {
129 Print("Restraining player with empty hands");
131 source_player.LocalReplaceItemInHandsWithNewElsewhere(lambda);
132 }
133
134 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
135 }
136 }
bool CanReceiveAction(ActionTarget target)
Definition ActionBase.c:594
void RestrainTargetPlayerLambda(EntityAI old_item, string new_item_type, PlayerBase player)
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
proto void Print(void var)
Prints content of variable to console/log.

References CanReceiveAction(), Error(), m_SpecialtyWeight, Print(), and RestrainTargetPlayerLambda().

◆ OnStartServer()

override void ActionRestrainTarget::OnStartServer ( ActionData action_data)
inlineprivate

Definition at line 79 of file ActionRestrainTarget.c.

80 {
81 PlayerBase target_player = PlayerBase.Cast(action_data.m_Target.GetObject());
82 if (target_player.IsSurrendered())
83 {
85 target_player.EndSurrenderRequest(sdr);
86 }
87 else if (target_player.IsEmotePlaying())
88 target_player.m_EmoteManager.ServerRequestEmoteCancel();
89
90 target_player.SetRestrainStarted(true);
91 }

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