DayZ 1.24
Loading...
Searching...
No Matches
ActionFillObject.c
Go to the documentation of this file.
8
10{
11 protected int m_ActionState;
12
13 protected const int EMPTY = 0;
14 protected const int FILLED = 1;
15
24
31
33 {
34 HescoBox hesco = HescoBox.Cast(target.GetObject());
35
36 if (hesco.GetState() == HescoBox.UNFOLDED)
37 m_Text = "#empty";
38 else
39 m_Text = "#fill";
40 }
41
42 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
43 {
44 if (player.IsPlacingLocal())
45 return false;
46
47 HescoBox hesco;
48 if (Class.CastTo(hesco, target.GetObject()))
49 {
50 if (hesco.CanBeFilledAtPosition(player.GetPosition()))
51 {
52 if (hesco.GetState() == HescoBox.UNFOLDED)
53 {
55 return true;
56 }
57 else if (hesco.GetState() == HescoBox.FILLED)
58 {
60 return true;
61 }
62 }
63 }
64
65 return false;
66 }
67
69 {
70 HescoBox hesco;
71
72 if (Class.CastTo(hesco, action_data.m_Target.GetObject()))
73 {
74 const float ITEM_DAMAGE = 0.05;
75 action_data.m_MainItem.DecreaseHealth("", "", action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus(ITEM_DAMAGE, this.GetSpecialtyWeight()) * 100);
76
77 if (hesco.GetState() == HescoBox.UNFOLDED)
78 hesco.Fill();
79 else if (hesco.GetState() == HescoBox.FILLED)
80 hesco.Unfold();
81 }
82
83 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
84 }
85
87 {
88 HescoBox hesco;
89
90 if (Class.CastTo(hesco, action_data.m_Target.GetObject()))
91 {
92 if (hesco.GetState() == HescoBox.UNFOLDED)
93 hesco.Fill();
94 else if (hesco.GetState() == HescoBox.FILLED)
95 hesco.Unfold();
96 }
97 }
98};
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override void OnFinishProgressServer(ActionData action_data)
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void CreateConditionComponents()
override void OnFinishProgressClient(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
const float DEFAULT_FILL
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.