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

Protected Member Functions

override void SetBuildingAnimation (ItemBase item)
 
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)
 
bool RepairCondition (PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)
 
override string GetAdminLogMessage (ActionData action_data)
 

Private Member Functions

void ActionRepairPart ()
 
override void CreateConditionComponents ()
 
override void OnActionInfoUpdate (PlayerBase player, ActionTarget target, ItemBase item)
 
override string GetText ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool ActionConditionContinue (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 
- Private Member Functions inherited from ActionDismantlePart
void SetBuildingAnimation (ItemBase item)
 
bool DismantleCondition (PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)
 
override string GetAdminLogMessage (ActionData action_data)
 

Detailed Description

Definition at line 39 of file ActionRepairPart.c.

Constructor & Destructor Documentation

◆ ActionRepairPart()

void ActionRepairPart::ActionRepairPart ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

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

Definition at line 79 of file ActionRepairPart.c.

80 {
81 //Action not allowed if player has broken legs
82 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
83 return false;
84
85 return RepairCondition(player, target, item, true);
86 }
eBrokenLegs
Definition EBrokenLegs.c:2
bool RepairCondition(PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)

References RepairCondition().

◆ ActionConditionContinue()

override bool ActionRepairPart::ActionConditionContinue ( ActionData action_data)
inlineprivate

Definition at line 88 of file ActionRepairPart.c.

89 {
90 return RepairCondition(action_data.m_Player, action_data.m_Target, action_data.m_MainItem, false);
91 }

References RepairCondition().

◆ CreateActionData()

override ActionData ActionRepairPart::CreateActionData ( )
inlineprotected

Definition at line 135 of file ActionRepairPart.c.

◆ CreateConditionComponents()

override void ActionRepairPart::CreateConditionComponents ( )
inlineprivate

◆ GetAdminLogMessage()

override string ActionRepairPart::GetAdminLogMessage ( ActionData action_data)
inlineprotected

Definition at line 227 of file ActionRepairPart.c.

228 {
229 return " repaired " + action_data.m_Target.GetObject().GetDisplayName() + " with " + action_data.m_MainItem.GetDisplayName();
230 }

◆ GetText()

override string ActionRepairPart::GetText ( )
inlineprivate

Definition at line 64 of file ActionRepairPart.c.

65 {
67 if (player)
68 {
69 ConstructionActionData construction_action_data = player.GetConstructionActionData();
71
73 return "#repair" + " " + constrution_part.GetName();
74 }
75
76 return "";
77 }
PlayerBase GetPlayer()
proto native CGame GetGame()

References GetGame(), and GetPlayer().

◆ HandleReciveData()

override void ActionRepairPart::HandleReciveData ( ActionReciveData action_recive_data,
ActionData action_data )
inlineprotected

Definition at line 172 of file ActionRepairPart.c.

◆ OnActionInfoUpdate()

override void ActionRepairPart::OnActionInfoUpdate ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 58 of file ActionRepairPart.c.

59 {
60 ConstructionActionData construction_action_data = player.GetConstructionActionData();
61 m_Text = "#repair " + construction_action_data.GetTargetPart().GetName();
62 }

References m_Text.

◆ OnFinishProgressServer()

override void ActionRepairPart::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 93 of file ActionRepairPart.c.

94 {
96 Construction construction = base_building.GetConstruction();
97
98 //repairing
99 string part_name = action_data.m_Target.GetObject().GetActionComponentName(RepairPartActionData.Cast(action_data).m_ComponentIndex);
100 string zone_name;
103
104 DamageSystem.GetDamageZoneFromComponentName(base_building, part_name, zone_name);
106
107 //consume materials
108 construction.TakeMaterialsServer(part_name, true);
109
110 //add damage to tool
111 action_data.m_MainItem.DecreaseHealth(UADamageApplied.REPAIR, false);
112
113 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
114 }
void Construction(BaseBuildingBase parent)
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.

References Class::CastTo(), Construction(), GetPlugin(), m_SpecialtyWeight, and UADamageApplied::REPAIR.

◆ ReadFromContext()

override bool ActionRepairPart::ReadFromContext ( ParamsReadContext ctx,
out ActionReciveData action_recive_data )
inlineprotected

Definition at line 153 of file ActionRepairPart.c.

154 {
158
159 super.ReadFromContext(ctx, action_recive_data);
160
161 if (HasTarget())
162 {
163 int component_index;
164 if (!ctx.Read(component_index))
165 return false;
166
167 recive_data_repair.m_ComponentIndexRecived = component_index;
168 }
169 return true;
170 }
bool HasTarget()
Definition ActionBase.c:210

References HasTarget().

◆ RepairCondition()

bool ActionRepairPart::RepairCondition ( PlayerBase player,
ActionTarget target,
ItemBase item,
bool camera_check )
inlineprotected

Definition at line 180 of file ActionRepairPart.c.

181 {
182 string zone_name;
183
184 Object target_object = target.GetObject();
185 if (target_object && target_object.CanUseConstruction())
186 {
187 string part_name = target_object.GetActionComponentName(target.GetComponentIndex());
188
190 Construction construction = base_building.GetConstruction();
192
194 {
195 //camera and position checks
196 if (!base_building.IsFacingPlayer(player, part_name) && !player.GetInputController().CameraIsFreeLook() && base_building.HasProperDistance(construction_part.GetMainPartName(), player))
197 {
198 //Camera check (client-only)
199 if (camera_check)
200 {
201 if (GetGame() && (!GetGame().IsDedicatedServer()))
202 {
203 if (base_building.IsFacingCamera(part_name))
204 return false;
205 }
206 }
207
208 //damage check
209 DamageSystem.GetDamageZoneFromComponentName(base_building, part_name, zone_name);
211 return false;
212
213 //materials check
214 if (!construction.HasMaterials(part_name, true))
215 return false;
216
217 ConstructionActionData construction_action_data = player.GetConstructionActionData();
219 return true;
220 }
221 }
222 }
223
224 return false;
225 }
const int STATE_RUINED
Definition constants.c:757
const int STATE_WORN
Definition constants.c:760

References Construction(), GetGame(), GameConstants::STATE_RUINED, and GameConstants::STATE_WORN.

Referenced by ActionCondition(), and ActionConditionContinue().

◆ SetBuildingAnimation()

override void ActionRepairPart::SetBuildingAnimation ( ItemBase item)
inlineprotected

Definition at line 116 of file ActionRepairPart.c.

117 {
118 switch (item.Type())
119 {
120 case Pickaxe:
121 case Shovel:
122 case FarmingHoe:
123 case FieldShovel:
124 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
125 break;
126 case Pliers:
127 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
128 break;
129 default:
130 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
131 break;
132 }
133 }

References AnimatedActionBase::m_CommandUID.

◆ WriteToContext()

override void ActionRepairPart::WriteToContext ( ParamsWriteContext ctx,
ActionData action_data )
inlineprotected

Definition at line 141 of file ActionRepairPart.c.

142 {
143 super.WriteToContext(ctx, action_data);
145
147 {
148 repair_action_data.m_ComponentIndex = action_data.m_Target.GetComponentIndex();
149 ctx.Write(repair_action_data.m_ComponentIndex);
150 }
151 }

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


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