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

Protected Member Functions

void SetBuildingAnimation (ItemBase item)
 
bool DismantleCondition (PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)
 
override string GetAdminLogMessage (ActionData action_data)
 

Private Member Functions

void ActionDismantlePart ()
 
override void CreateConditionComponents ()
 
override void OnActionInfoUpdate (PlayerBase player, ActionTarget target, ItemBase item)
 
override string GetText ()
 
override bool CanBeUsedLeaning ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool ActionConditionContinue (ActionData action_data)
 
override void OnFinishProgressServer (ActionData action_data)
 
override bool SetupAction (PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
 
- 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)
 

Detailed Description

Definition at line 26 of file ActionDismantlePart.c.

Constructor & Destructor Documentation

◆ ActionDismantlePart()

void ActionDismantlePart::ActionDismantlePart ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

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

Definition at line 71 of file ActionDismantlePart.c.

72 {
73 if (player.IsPlacingLocal())
74 return false;
75
76 //Action not allowed if player has broken legs
77 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
78 return false;
79
80 return DismantleCondition(player, target, item, true) && player.m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE;
81 }
eBrokenLegs
Definition EBrokenLegs.c:2
bool DismantleCondition(PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)

References DismantleCondition().

◆ ActionConditionContinue()

override bool ActionDismantlePart::ActionConditionContinue ( ActionData action_data)
inlineprivate

Definition at line 83 of file ActionDismantlePart.c.

84 {
85 return DismantleCondition(action_data.m_Player, action_data.m_Target, action_data.m_MainItem, false) && action_data.m_Player.m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE;
86 }

References DismantleCondition().

◆ CanBeUsedLeaning()

override bool ActionDismantlePart::CanBeUsedLeaning ( )
inlineprivate

Definition at line 66 of file ActionDismantlePart.c.

67 {
68 return false;
69 }

◆ CreateConditionComponents()

override void ActionDismantlePart::CreateConditionComponents ( )
inlineprivate

Definition at line 39 of file ActionDismantlePart.c.

40 {
42 m_ConditionTarget = new CCTNone;//CCTNonRuined( UAMaxDistances.BASEBUILDING );
43 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ DismantleCondition()

bool ActionDismantlePart::DismantleCondition ( PlayerBase player,
ActionTarget target,
ItemBase item,
bool camera_check )
inlineprotected

Definition at line 139 of file ActionDismantlePart.c.

140 {
141 if (player && !player.IsPlacingLocal() && !player.IsPlacingServer())
142 {
143 Object target_object = target.GetObject();
145 if (target_object && target_object.CanUseConstruction())
146 {
147 //invalid if is gate and is locked
148 if (Class.CastTo(target_entity, target_object) && (target_entity.FindAttachmentBySlotName("Att_CombinationLock") || target_entity.FindAttachmentBySlotName("Material_FPole_Flag")))
149 return false;
150
151 string part_name = target_object.GetActionComponentName(target.GetComponentIndex());
152
154 Construction construction = base_building.GetConstruction();
155 ConstructionPart construction_part = construction.GetConstructionPartToDismantle(part_name, item);
156
158 {
159 /*Print("DismantleCondition");
160 Print(part_name);
161 Print("construction_part.GetPartName: " + construction_part.GetPartName());
162 Print("construction_part.GetMainPartName: " + construction_part.GetMainPartName());
163 Print("-----");*/
164
165 //invalid on gate if the gate is opened
166 if (construction_part.IsGate() && base_building.IsOpened())
167 return false;
168
169 //camera and position checks
170 bool checked = false;
171
172 if (construction_part.IsBase())
173 checked = true;
174
175 if (!checked && base_building.IsPlayerInside(player, part_name) && !player.GetInputController().CameraIsFreeLook())
176 {
177 //Camera check (client-only)
178 if (camera_check)
179 {
180 if (GetGame() && (!GetGame().IsDedicatedServer()))
181 {
182 if (base_building.IsFacingCamera(part_name))
183 return false;
184 }
185 }
186
187 checked = true;
188 }
189
190 if (checked)
191 {
192 ConstructionActionData construction_action_data = player.GetConstructionActionData();
194
195 return true;
196 }
197 }
198 }
199 }
200
201 return false;
202 }
void Construction(BaseBuildingBase parent)
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), Construction(), and GetGame().

Referenced by ActionCondition(), and ActionConditionContinue().

◆ GetAdminLogMessage()

override string ActionDismantlePart::GetAdminLogMessage ( ActionData action_data)
inlineprotected

Definition at line 204 of file ActionDismantlePart.c.

205 {
206 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
208
209 string message = string.Format("Dismantled %1 from %2 with %3", construction_part.GetName(), action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
210 return message;
211 }

◆ GetText()

override string ActionDismantlePart::GetText ( )
inlineprivate

Definition at line 51 of file ActionDismantlePart.c.

52 {
54 if (player)
55 {
56 ConstructionActionData construction_action_data = player.GetConstructionActionData();
58
60 return "#dismantle" + " " + constrution_part.GetName();
61 }
62
63 return "";
64 }
PlayerBase GetPlayer()

References GetGame(), and GetPlayer().

◆ OnActionInfoUpdate()

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

Definition at line 45 of file ActionDismantlePart.c.

46 {
47 ConstructionActionData construction_action_data = player.GetConstructionActionData();
48 m_Text = "#dismantle " + construction_action_data.GetTargetPart().GetName();
49 }

References m_Text.

◆ OnFinishProgressServer()

override void ActionDismantlePart::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 88 of file ActionDismantlePart.c.

89 {
91 Construction construction = base_building.GetConstruction();
92 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
94
95 if (construction.CanDismantlePart(construction_part.GetPartName(), action_data.m_MainItem))
96 {
97 //build
98 construction.DismantlePartServer(action_data.m_Player, construction_part.GetPartName(), AT_DISMANTLE_PART);
99
100 //add damage to tool
101 action_data.m_MainItem.DecreaseHealth(UADamageApplied.DISMANTLE, false);
102 }
103
104 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
105 }
const int AT_DISMANTLE_PART
Definition _constants.c:7
const float DISMANTLE

References AT_DISMANTLE_PART, Construction(), UADamageApplied::DISMANTLE, and m_SpecialtyWeight.

◆ SetBuildingAnimation()

void ActionDismantlePart::SetBuildingAnimation ( ItemBase item)
inlineprotected

Definition at line 120 of file ActionDismantlePart.c.

121 {
122 switch (item.Type())
123 {
124 case Pickaxe:
125 case Shovel:
126 case FarmingHoe:
127 case FieldShovel:
128 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
129 break;
130 case Pliers:
131 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
132 break;
133 default:
134 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DISASSEMBLE;
135 break;
136 }
137 }

References AnimatedActionBase::m_CommandUID.

Referenced by SetupAction().

◆ SetupAction()

override bool ActionDismantlePart::SetupAction ( PlayerBase player,
ActionTarget target,
ItemBase item,
out ActionData action_data,
Param extra_data = NULL )
inlineprivate

Definition at line 108 of file ActionDismantlePart.c.

109 {
110 if (super.SetupAction(player, target, item, action_data, extra_data))
111 {
113
114 return true;
115 }
116
117 return false;
118 }
void SetBuildingAnimation(ItemBase item)

References SetBuildingAnimation().


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