DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionTurnValve.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
6 }
7}
8
10{
11 void ActionTurnValve()
12 {
13 m_CallbackClass = ActionTurnValveCB;
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_TURN_VALVE;
15 m_FullBody = true;
16 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
17 m_Text = "#STR_USRACT_TURN";
18 }
19
20 override typename GetInputType()
21 {
23 }
24
26 {
29 }
30
31 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
32 {
33 EntityAI targetEntity;
34 if (Class.CastTo(targetEntity, target.GetObject()))
35 {
36 if (targetEntity.HasTurnableValveBehavior())
37 {
38 int valveIndex = targetEntity.GetTurnableValveIndex(target.GetComponentIndex());
39 if (valveIndex != -1)
40 {
41 if (!IsInReach(player, target, UAMaxDistances.DEFAULT))
42 {
43 return false;
44 }
45
46 return targetEntity.IsValveTurnable(valveIndex);
47 }
48 }
49 }
50
51 return false;
52 }
53
54 override void OnStart(ActionData action_data)
55 {
56 super.OnStart(action_data);
57
58 action_data.m_Player.TryHideItemInHands(true);
59
60 }
61
62 override void OnEnd(ActionData action_data)
63 {
64 action_data.m_Player.TryHideItemInHands(false);
65
66 super.OnEnd(action_data);
67 }
68}
void CreateConditionComponents()
Definition ActionBase.c:218
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:927
protected string m_Text
Definition ActionBase.c:49
protected bool m_FullBody
Definition ActionBase.c:52
protected int m_StanceMask
Definition ActionBase.c:53
class ActionTargets ActionTarget
ActionTurnValveCB ActionContinuousBaseCB ActionTurnValve()
override void OnEnd()
Definition JumpEvents.c:57
protected void OnStart(Param par=null)
protected ActionData m_ActionData
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
const float DEFAULT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.