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

Protected Member Functions

void SetBuildingAnimation (ItemBase item)
 
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)
 
override string GetAdminLogMessage (ActionData action_data)
 

Private Member Functions

void ActionBuildPart ()
 
override void CreateConditionComponents ()
 
override void OnActionInfoUpdate (PlayerBase player, ActionTarget target, ItemBase item)
 
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 string GetSoundCategory (ActionData action_data)
 
override ActionData CreateActionData ()
 
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 25 of file ActionBuildPart.c.

Constructor & Destructor Documentation

◆ ActionBuildPart()

void ActionBuildPart::ActionBuildPart ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

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

Definition at line 58 of file ActionBuildPart.c.

59 {
60 if (player.IsPlacingLocal() || player.IsPlacingServer())
61 return false;
62
63 //Action not allowed if player has broken legs
64 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
65 return false;
66
67 //gate..
68 if (target.GetObject() && (!target.GetObject().CanUseConstructionBuild() || target.GetObject().CanUseHandConstruction()))
69 return false;
70
71 if ((!GetGame().IsDedicatedServer()))
72 {
73 if (MiscGameplayFunctions.ComplexBuildCollideCheckClient(player, target, item, m_VariantID))
74 return true;
75 return false;
76 }
77 return true;
78 }
int m_VariantID
Definition ActionBase.c:59
eBrokenLegs
Definition EBrokenLegs.c:2
proto native CGame GetGame()

References GetGame(), and m_VariantID.

◆ ActionConditionContinue()

override bool ActionBuildPart::ActionConditionContinue ( ActionData action_data)
inlineprivate

Definition at line 80 of file ActionBuildPart.c.

81 {
83 Construction construction = base_building.GetConstruction();
84 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
86
87 check_data.m_PartName = part_name;
88 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
89
90 bool canBuild = construction.CanBuildPart(part_name, action_data.m_MainItem, true);
91 if (GetGame().IsServer())
92 {
93 bool collides = construction.IsCollidingEx(check_data);
94
95 return !collides && canBuild;
96 }
97 else
98 return canBuild;
99 }
void CollisionCheckData()
void Construction(BaseBuildingBase parent)

References CollisionCheckData(), Construction(), and GetGame().

◆ CanBeUsedLeaning()

override bool ActionBuildPart::CanBeUsedLeaning ( )
inlineprivate

Definition at line 53 of file ActionBuildPart.c.

54 {
55 return false;
56 }

◆ CreateActionData()

override ActionData ActionBuildPart::CreateActionData ( )
inlineprivate

Definition at line 127 of file ActionBuildPart.c.

128 {
130 return action_data;
131 }

◆ CreateConditionComponents()

override void ActionBuildPart::CreateConditionComponents ( )
inlineprivate

Definition at line 38 of file ActionBuildPart.c.

39 {
42 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ GetAdminLogMessage()

override string ActionBuildPart::GetAdminLogMessage ( ActionData action_data)
inlineprotected

Definition at line 202 of file ActionBuildPart.c.

203 {
204 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
205 string partName = BuildPartActionData.Cast(action_data).m_PartType;
206
207 string message = string.Format("Built %1 on %2 with %3", partName, action_data.m_Target.GetObject().GetDisplayName(), action_data.m_MainItem.GetDisplayName());
208 return message;
209 }

◆ GetSoundCategory()

override string ActionBuildPart::GetSoundCategory ( ActionData action_data)
inlineprivate

Definition at line 122 of file ActionBuildPart.c.

123 {
124 return "Base_building";
125 }

◆ HandleReciveData()

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

◆ OnActionInfoUpdate()

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

Definition at line 44 of file ActionBuildPart.c.

45 {
46 ConstructionActionData construction_action_data = player.GetConstructionActionData();
48
50 m_Text = "#build " + constrution_part.GetName();
51 }

References m_Text, and m_VariantID.

◆ OnFinishProgressServer()

override void ActionBuildPart::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 101 of file ActionBuildPart.c.

102 {
103 BaseBuildingBase base_building = BaseBuildingBase.Cast(action_data.m_Target.GetObject());
104 Construction construction = base_building.GetConstruction();
105
106 string part_name = BuildPartActionData.Cast(action_data).m_PartType;
108
109 check_data.m_PartName = part_name;
110 check_data.m_AdditionalExcludes.Insert(action_data.m_Player);
111
112 if (!construction.IsCollidingEx(check_data) && construction.CanBuildPart(part_name, action_data.m_MainItem, true)) //redundant at this point?
113 {
114 //build
115 construction.BuildPartServer(action_data.m_Player, part_name, AT_BUILD_PART);
116 //add damage to tool
117 action_data.m_MainItem.DecreaseHealth(UADamageApplied.BUILD, false);
118 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
119 }
120 }
const int AT_BUILD_PART
Definition _constants.c:6

References AT_BUILD_PART, UADamageApplied::BUILD, CollisionCheckData(), Construction(), and m_SpecialtyWeight.

◆ ReadFromContext()

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

Definition at line 180 of file ActionBuildPart.c.

181 {
183 super.ReadFromContext(ctx, action_recive_data);
184
185 string part_type;
186 if (ctx.Read(part_type))
187 {
189 return true;
190 }
191 else
192 return false;
193 }

References BuildPartActionReciveData::m_PartType.

◆ SetBuildingAnimation()

void ActionBuildPart::SetBuildingAnimation ( ItemBase item)
inlineprotected

Definition at line 151 of file ActionBuildPart.c.

152 {
153 switch (item.Type())
154 {
155 case Pickaxe:
156 case Shovel:
157 case FarmingHoe:
158 case FieldShovel:
159 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DIG;
160 break;
161 case Pliers:
162 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
163 break;
164 case SledgeHammer:
165 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_MINEROCK;
166 break;
167 default:
168 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_ASSEMBLE;
169 break;
170 }
171 }

References AnimatedActionBase::m_CommandUID.

Referenced by SetupAction().

◆ SetupAction()

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

Definition at line 134 of file ActionBuildPart.c.

135 {
136 if (super.SetupAction(player, target, item, action_data, extra_data))
137 {
139
140 if (!GetGame().IsDedicatedServer())
141 {
142 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
143 BuildPartActionData.Cast(action_data).m_PartType = construction_action_data.GetBuildPartAtIndex(m_VariantID).GetPartName();
144 }
145 return true;
146 }
147
148 return false;
149 }
void SetBuildingAnimation(ItemBase item)

References GetGame(), m_VariantID, and SetBuildingAnimation().

◆ WriteToContext()

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

Definition at line 173 of file ActionBuildPart.c.

174 {
175 super.WriteToContext(ctx, action_data);
176
177 ctx.Write(BuildPartActionData.Cast(action_data).m_PartType);
178 }

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