DayZ 1.30
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 if (tent.GetHealthLevel("" + damageZone) == GameConstants.STATE_RUINED )
76 {
77 m_CurrentDamageZone = damageZone;
78 m_LastValidComponentIndex = target.GetComponentIndex();
79 break;
80 }else
81 continue;
82 }
83 }
84 if ( damageZone != "" && m_CurrentDamageZone != "Body" ) //This may seem like a duplicate but is required to work properly
85 {
86 m_CurrentDamageZone = damageZone;
87 m_LastValidComponentIndex = target.GetComponentIndex();
88 }
89 }
90
91 if ( m_CurrentDamageZone != "" && m_CurrentDamageZone != "Body" && tent.GetHealthLevel("" + damageZone) == GameConstants.STATE_RUINED )
92 {
93 return true;
94 }
95 }
96
97 return false;
98 }
99
100 override void OnFinishProgressServer( ActionData action_data )
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 (!g_Game.IsMultiplayer())
107 damageZone = m_CurrentDamageZone;
108
109 if ( targetParent && targetParent.IsInherited(TentBase) && damageZone != "" )
110 {
111 TentBase tent = TentBase.Cast( targetParent );
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 }
129
131 {
132 RepairTentPartActionData action_data = new RepairTentPartActionData;
133 return action_data;
134 }
135
136 override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
137 {
138 super.WriteToContext(ctx, action_data);
139 RepairTentPartActionData repair_action_data;
140
141 if( HasTarget() && Class.CastTo(repair_action_data,action_data) )
142 {
143 repair_action_data.m_DamageZone = m_CurrentDamageZone;
144 ctx.Write(repair_action_data.m_DamageZone);
145 }
146 }
147
148 override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data )
149 {
150 if(!action_recive_data)
151 {
152 action_recive_data = new RepairTentPartActionReciveData;
153 }
154 super.ReadFromContext(ctx, action_recive_data);
155 RepairTentPartActionReciveData recive_data_repair = RepairTentPartActionReciveData.Cast(action_recive_data);
156
157 if( HasTarget() )
158 {
159 string zone;
160 if ( !ctx.Read(zone) )
161 return false;
162
163 recive_data_repair.m_DamageZoneRecived = zone;
164 }
165 return true;
166 }
167
168 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
169 {
170 super.HandleReciveData(action_recive_data, action_data);
171
172 RepairTentPartActionReciveData recive_data_repair = RepairTentPartActionReciveData.Cast(action_recive_data);
173 RepairTentPartActionData.Cast(action_data).m_DamageZone = recive_data_repair.m_DamageZoneRecived;
174 }
175};
bool m_FullBody
Определения ActionBase.c:60
string m_Text
Определения ActionBase.c:57
ref CCIBase m_ConditionItem
Определения ActionBase.c:63
float m_SpecialtyWeight
Определения ActionBase.c:77
ref CCTBase m_ConditionTarget
Определения ActionBase.c:64
int m_StanceMask
Определения ActionBase.c:61
RepairTentActionReciveData m_DamageZone
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:125
DayZGame g_Game
Определения DayZGame.c:4074
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:326
ActionData m_ActionData
Определения AnimatedActionBase.c:3
void ActionContinuousBase()
Определения ActionContinuousBase.c:124
ref ActionTarget m_Target
Определения ActionBase.c:39
ItemBase m_MainItem
Определения ActionBase.c:35
Определения ActionBase.c:22
override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
Определения ActionRepairTentPart.c:136
override void CreateConditionComponents()
Определения ActionRepairTentPart.c:36
override bool HasTarget()
Определения ActionRepairTentPart.c:47
override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
Определения ActionRepairTentPart.c:168
override ActionData CreateActionData()
Определения ActionRepairTentPart.c:130
int m_LastValidComponentIndex
Определения ActionRepairTentPart.c:23
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
Определения ActionRepairTentPart.c:148
void ActionRepairTentPart()
Определения ActionRepairTentPart.c:25
override void OnFinishProgressServer(ActionData action_data)
Определения ActionRepairTentPart.c:100
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:147
Определения CCINonRuined.c:2
Определения CCTCursorParent.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfBricks.c:64
Определения 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:114
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
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
Определения 3_Game/DayZ/constants.c:909