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

Private Member Functions

void ActionRepairTentPart ()
 
override void CreateConditionComponents ()
 
override bool IsUsingProxies ()
 
override bool HasTarget ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnFinishProgressServer (ActionData action_data)
 
override ActionData CreateActionData ()
 
override void WriteToContext (ParamsWriteContext ctx, ActionData action_data)
 
override bool ReadFromContext (ParamsReadContext ctx, out ActionReciveData action_recive_data)
 
override void HandleReciveData (ActionReciveData action_recive_data, 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)
 

Private Attributes

 m_LastValidType
 
string m_CurrentDamageZone = ""
 
int m_LastValidComponentIndex = -1
 

Detailed Description

Definition at line 19 of file ActionRepairTentPart.c.

Constructor & Destructor Documentation

◆ ActionRepairTentPart()

void ActionRepairTentPart::ActionRepairTentPart ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

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

Definition at line 52 of file ActionRepairTentPart.c.

53 {
54 //m_CurrentDamageZone = "";
55 Object targetObject = target.GetObject();
56 Object targetParent = target.GetParent();
57 if (!targetParent || !targetParent.IsInherited(TentBase))
58 return false;
59
61 {
65 targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections, "view");
67 if (m_LastValidType != targetObject.Type() || m_LastValidComponentIndex != target.GetComponentIndex() || m_CurrentDamageZone == "" || m_CurrentDamageZone == "Body")
68 {
69 string damageZone = "";
70
71 for (int s = 0; s < selections.Count(); s++)
72 {
73 if (DamageSystem.GetDamageZoneFromComponentName(tent, selections[s], damageZone)) //NOTE: relevant fire geometry and view geometry selection names MUST match in order to get a valid damage zone
74 {
75 //Print("#" + s + " damageZone: " + damageZone);
76 if (tent.GetHealthLevel("" + damageZone) == GameConstants.STATE_RUINED)
77 {
79 m_LastValidComponentIndex = target.GetComponentIndex();
80 break;
81 }
82 else
83 continue;
84 }
85 }
86 if (damageZone != "" && m_CurrentDamageZone != "Body") //This may seem like a duplicate but is required to work properly
87 {
89 m_LastValidComponentIndex = target.GetComponentIndex();
90 }
91 }
92
93 if (m_CurrentDamageZone != "" && m_CurrentDamageZone != "Body" && tent.GetHealthLevel("" + damageZone) == GameConstants.STATE_RUINED)
94 return true;
95 }
96
97 return false;
98 }
PluginBase GetPlugin(typename plugin_type)
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int STATE_RUINED
Definition constants.c:757

References Class::CastTo(), GetPlugin(), m_CurrentDamageZone, m_LastValidComponentIndex, m_LastValidType, and GameConstants::STATE_RUINED.

◆ CreateActionData()

override ActionData ActionRepairTentPart::CreateActionData ( )
inlineprivate

Definition at line 130 of file ActionRepairTentPart.c.

◆ CreateConditionComponents()

override void ActionRepairTentPart::CreateConditionComponents ( )
inlineprivate

Definition at line 36 of file ActionRepairTentPart.c.

37 {
38 m_ConditionItem = new CCINonRuined; //To change?
40 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ HandleReciveData()

override void ActionRepairTentPart::HandleReciveData ( ActionReciveData action_recive_data,
ActionData action_data )
inlineprivate

◆ HasTarget()

override bool ActionRepairTentPart::HasTarget ( )
inlineprivate

Definition at line 47 of file ActionRepairTentPart.c.

48 {
49 return true;
50 }

Referenced by ReadFromContext(), and WriteToContext().

◆ IsUsingProxies()

override bool ActionRepairTentPart::IsUsingProxies ( )
inlineprivate

Definition at line 42 of file ActionRepairTentPart.c.

43 {
44 return true;
45 }

◆ OnFinishProgressServer()

override void ActionRepairTentPart::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 100 of file ActionRepairTentPart.c.

101 {
102 Object targetParent = action_data.m_Target.GetParent();
103 ItemBase usedItem = action_data.m_MainItem;
104
105 string damageZone = RepairTentPartActionData.Cast(action_data).m_DamageZone;
106 if (!GetGame().IsMultiplayer())
108
109 if (targetParent && targetParent.IsInherited(TentBase) && damageZone != "")
110 {
112 float m_RepairedLevel = usedItem.GetHealthLevel();
113
114 tent.SetAllowDamage(true);
115 targetParent.SetHealth01("" + damageZone, "", targetParent.GetHealthLevelValue(m_RepairedLevel));
116 tent.ProcessInvulnerabilityCheck(tent.GetInvulnerabilityTypeString());
117
118 if (usedItem.GetQuantity() > 1)
119 {
120 //Not really clean, but will do for now
121 int val = usedItem.GetQuantity();
122 val--;
123 usedItem.SetQuantity(val);
124 }
125 else
126 usedItem.Delete();
127 }
128 }
proto native CGame GetGame()

References GetGame(), and m_CurrentDamageZone.

◆ ReadFromContext()

override bool ActionRepairTentPart::ReadFromContext ( ParamsReadContext ctx,
out ActionReciveData action_recive_data )
inlineprivate

Definition at line 148 of file ActionRepairTentPart.c.

149 {
152 super.ReadFromContext(ctx, action_recive_data);
154
155 if (HasTarget())
156 {
157 string zone;
158 if (!ctx.Read(zone))
159 return false;
160
161 recive_data_repair.m_DamageZoneRecived = zone;
162 }
163 return true;
164 }

References HasTarget().

◆ WriteToContext()

override void ActionRepairTentPart::WriteToContext ( ParamsWriteContext ctx,
ActionData action_data )
inlineprivate

Definition at line 136 of file ActionRepairTentPart.c.

137 {
138 super.WriteToContext(ctx, action_data);
140
142 {
144 ctx.Write(repair_action_data.m_DamageZone);
145 }
146 }

References Class::CastTo(), HasTarget(), and m_CurrentDamageZone.

Member Data Documentation

◆ m_CurrentDamageZone

string ActionRepairTentPart::m_CurrentDamageZone = ""
private

Definition at line 22 of file ActionRepairTentPart.c.

Referenced by ActionCondition(), OnFinishProgressServer(), and WriteToContext().

◆ m_LastValidComponentIndex

int ActionRepairTentPart::m_LastValidComponentIndex = -1
private

Definition at line 23 of file ActionRepairTentPart.c.

Referenced by ActionCondition().

◆ m_LastValidType

ActionRepairTentPart::m_LastValidType
private

Definition at line 21 of file ActionRepairTentPart.c.

Referenced by ActionCondition().


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