DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionRepairTentPart.c
См. документацию.
1class RepairTentPartActionReciveData : ActionReciveData
2{
4}
5
6class RepairTentPartActionData : ActionData
7{
9}
10
18
20{
24
26 {
28 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
29
30 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
31 m_FullBody = true;
32 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
33 m_Text = "#repair";
34 }
35
41
42 override bool IsUsingProxies()
43 {
44 return true;
45 }
46
47 override bool HasTarget()
48 {
49 return true;
50 }
51
52 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
53 {
54 //m_CurrentDamageZone = "";
55 Object targetObject = target.GetObject();
56 Object targetParent = target.GetParent();
57 if ( !targetParent || !targetParent.IsInherited(TentBase) )
58 return false;
59
60 if ( player && targetObject && targetParent )
61 {
62 array<string> selections = new array<string>;
63 PluginRepairing module_repairing;
64 Class.CastTo(module_repairing, GetPlugin(PluginRepairing));
65 targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections, "view");
66 TentBase tent = TentBase.Cast( targetParent );
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 {
78 m_CurrentDamageZone = damageZone;
79 m_LastValidComponentIndex = target.GetComponentIndex();
80 break;
81 }else
82 continue;
83 }
84 }
85 if ( damageZone != "" && m_CurrentDamageZone != "Body" ) //This may seem like a duplicate but is required to work properly
86 {
87 m_CurrentDamageZone = damageZone;
88 m_LastValidComponentIndex = target.GetComponentIndex();
89 }
90 }
91
92 if ( m_CurrentDamageZone != "" && m_CurrentDamageZone != "Body" && tent.GetHealthLevel("" + damageZone) == GameConstants.STATE_RUINED )
93 {
94 return true;
95 }
96 }
97
98 return false;
99 }
100
101 override void OnFinishProgressServer( ActionData action_data )
102 {
103 Object targetParent = action_data.m_Target.GetParent();
104 ItemBase usedItem = action_data.m_MainItem;
105
106 string damageZone = RepairTentPartActionData.Cast(action_data).m_DamageZone;
107 if (!GetGame().IsMultiplayer())
108 damageZone = m_CurrentDamageZone;
109
110 if ( targetParent && targetParent.IsInherited(TentBase) && damageZone != "" )
111 {
112 TentBase tent = TentBase.Cast( targetParent );
113 float m_RepairedLevel = usedItem.GetHealthLevel();
114
115 tent.SetAllowDamage(true);
116 targetParent.SetHealth01("" + damageZone, "", targetParent.GetHealthLevelValue(m_RepairedLevel));
117 tent.ProcessInvulnerabilityCheck(tent.GetInvulnerabilityTypeString());
118
119 if (usedItem.GetQuantity() > 1)
120 {
121 //Not really clean, but will do for now
122 int val = usedItem.GetQuantity();
123 val--;
124 usedItem.SetQuantity(val);
125 }
126 else
127 usedItem.Delete();
128 }
129 }
130
132 {
133 RepairTentPartActionData action_data = new RepairTentPartActionData;
134 return action_data;
135 }
136
137 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
138 {
139 super.WriteToContext(ctx, action_data);
140 RepairTentPartActionData repair_action_data;
141
142 if( HasTarget() && Class.CastTo(repair_action_data,action_data) )
143 {
144 repair_action_data.m_DamageZone = m_CurrentDamageZone;
145 ctx.Write(repair_action_data.m_DamageZone);
146 }
147 }
148
149 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data )
150 {
151 if(!action_recive_data)
152 {
153 action_recive_data = new RepairTentPartActionReciveData;
154 }
155 super.ReadFromContext(ctx, action_recive_data);
156 RepairTentPartActionReciveData recive_data_repair = RepairTentPartActionReciveData.Cast(action_recive_data);
157
158 if( HasTarget() )
159 {
160 string zone;
161 if ( !ctx.Read(zone) )
162 return false;
163
164 recive_data_repair.m_DamageZoneRecived = zone;
165 }
166 return true;
167 }
168
169 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
170 {
171 super.HandleReciveData(action_recive_data, action_data);
172
173 RepairTentPartActionReciveData recive_data_repair = RepairTentPartActionReciveData.Cast(action_recive_data);
174 RepairTentPartActionData.Cast(action_data).m_DamageZone = recive_data_repair.m_DamageZoneRecived;
175 }
176};
ActionBase ActionData
Определения ActionBase.c:30
RepairTentActionReciveData m_DamageZone
class ActionTargets ActionTarget
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
float m_SpecialtyWeight
Определения ActionBase.c:77
int m_StanceMask
Определения ActionBase.c:62
string m_Text
Определения ActionBase.c:58
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
bool m_FullBody
Определения ActionBase.c:61
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
ActionData m_ActionData
Определения AnimatedActionBase.c:3
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
Определения ActionRepairTentPart.c:137
override void CreateConditionComponents()
Определения ActionRepairTentPart.c:36
override bool HasTarget()
Определения ActionRepairTentPart.c:47
override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
Определения ActionRepairTentPart.c:169
override ActionData CreateActionData()
Определения ActionRepairTentPart.c:131
int m_LastValidComponentIndex
Определения ActionRepairTentPart.c:23
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
Определения ActionRepairTentPart.c:149
void ActionRepairTentPart()
Определения ActionRepairTentPart.c:25
override void OnFinishProgressServer(ActionData action_data)
Определения ActionRepairTentPart.c:101
string m_CurrentDamageZone
Определения ActionRepairTentPart.c:22
override bool IsUsingProxies()
Определения ActionRepairTentPart.c:42
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionRepairTentPart.c:52
override void CreateActionComponent()
Определения ActionRepairTentPart.c:13
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения CCINonRuined.c:2
Определения CCTCursorParent.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения constants.c:659
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
Определения InventoryItem.c:731
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
proto bool Write(void value_out)
proto bool Read(void value_in)
Определения CarTent.c:2
const float DEFAULT
Определения ActionConstants.c:112
const float BASEBUILDING_REPAIR_FAST
Определения ActionConstants.c:67
Определения ActionConstants.c:28
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int STATE_RUINED
Определения constants.c:846