DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionFillObject.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
6 }
7};
8
10{
11 protected int m_ActionState;
12
13 protected const int EMPTY = 0;
14 protected const int FILLED = 1;
15
17 {
19 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
20 m_FullBody = true;
21 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
23 }
24
26 {
27
30 }
31
32 override void OnActionInfoUpdate( PlayerBase player, ActionTarget target, ItemBase item )
33 {
34 HescoBox hesco = HescoBox.Cast(target.GetObject());
35
36 if( hesco.GetState() == HescoBox.UNFOLDED )
37 {
38 m_Text = "#empty";
39 }
40 else
41 {
42 m_Text = "#fill";
43 }
44 }
45
46 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
47 {
48 if ( player.IsPlacingLocal() )
49 return false;
50
51 HescoBox hesco;
52 if ( Class.CastTo(hesco,target.GetObject()) )
53 {
54 if ( hesco.CanBeFilledAtPosition( player.GetPosition() ) )
55 {
56 if ( hesco.GetState() == HescoBox.UNFOLDED )
57 {
59 return true;
60 }
61 else if( hesco.GetState() == HescoBox.FILLED)
62 {
64 return true;
65 }
66 }
67 }
68
69 return false;
70 }
71
72 override void OnFinishProgressServer( ActionData action_data )
73 {
74 HescoBox hesco;
75
76 if ( Class.CastTo(hesco,action_data.m_Target.GetObject()) )
77 {
78 const float ITEM_DAMAGE = 0.05;
79 action_data.m_MainItem.DecreaseHealth ( "", "", action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus( ITEM_DAMAGE, this.GetSpecialtyWeight() )*100 );
80
81 if ( hesco.GetState() == HescoBox.UNFOLDED )
82 {
83 hesco.Fill();
84 }
85 else if ( hesco.GetState() == HescoBox.FILLED )
86 {
87 hesco.Unfold();
88 }
89 }
90
91 action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
92 }
93
94 override void OnFinishProgressClient( ActionData action_data )
95 {
96 HescoBox hesco;
97
98 if ( Class.CastTo(hesco,action_data.m_Target.GetObject()) )
99 {
100 if ( hesco.GetState() == HescoBox.UNFOLDED )
101 {
102 hesco.Fill();
103 }
104 else if ( hesco.GetState() == HescoBox.FILLED )
105 {
106 hesco.Unfold();
107 }
108 }
109 }
110};
protected float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
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
protected ActionData m_ActionData
ItemBase m_MainItem
Definition ActionBase.c:28
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
ref ActionTarget m_Target
Definition ActionBase.c:32
override void CreateActionComponent()
override void OnFinishProgressServer(ActionData action_data)
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
protected const int FILLED
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnFinishProgressClient(ActionData action_data)
protected int m_ActionState
protected const int EMPTY
Super root of all classes in Enforce script.
Definition EnScript.c:11
void Unfold()
Definition Spotlight.c:280
const float DEFAULT
const float DEFAULT_FILL
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.