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

Protected Member Functions

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

Private Member Functions

void ActionDestroyPart ()
 
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)
 
- 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)
 

Static Private Attributes

static int CYCLES = 4
 

Detailed Description

Definition at line 9 of file ActionDestroyPart.c.

Constructor & Destructor Documentation

◆ ActionDestroyPart()

void ActionDestroyPart::ActionDestroyPart ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

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

Definition at line 41 of file ActionDestroyPart.c.

42 {
43 //Action not allowed if player has broken legs
44 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
45 return false;
46
47 return DestroyCondition(player, target, item, true);
48 }
eBrokenLegs
Definition EBrokenLegs.c:2
bool DestroyCondition(PlayerBase player, ActionTarget target, ItemBase item, bool camera_check)

References DestroyCondition().

◆ ActionConditionContinue()

override bool ActionDestroyPart::ActionConditionContinue ( ActionData action_data)
inlineprivate

Definition at line 50 of file ActionDestroyPart.c.

51 {
52 return DestroyCondition(action_data.m_Player, action_data.m_Target, action_data.m_MainItem, false);
53 }

References DestroyCondition().

◆ CanBeUsedLeaning()

override bool ActionDestroyPart::CanBeUsedLeaning ( )
inlineprivate

Definition at line 36 of file ActionDestroyPart.c.

37 {
38 return false;
39 }

◆ CreateConditionComponents()

override void ActionDestroyPart::CreateConditionComponents ( )
inlineprivate

Definition at line 24 of file ActionDestroyPart.c.

25 {
28 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ DestroyCondition()

bool ActionDestroyPart::DestroyCondition ( PlayerBase player,
ActionTarget target,
ItemBase item,
bool camera_check )
inlineprotected

Definition at line 85 of file ActionDestroyPart.c.

86 {
87 Object target_object = target.GetObject();
88 if (target_object && target_object.CanUseConstruction())
89 {
90 string part_name = target_object.GetActionComponentName(target.GetComponentIndex());
91
93 Construction construction = base_building.GetConstruction();
94 ConstructionPart construction_part = construction.GetConstructionPartToDestroy(part_name);
95
97 {
98 //camera and position checks
99 if (!player.GetInputController().CameraIsFreeLook() && IsInReach(player, target, UAMaxDistances.DEFAULT) && !player.GetInputController().CameraIsFreeLook())
100 {
101 //Camera check (client-only)
102 if (camera_check)
103 {
104 if (GetGame() && (!GetGame().IsDedicatedServer()))
105 {
106 if (!base_building.IsFacingCamera(part_name))
107 return false;
108 }
109 }
110
111 ConstructionActionData construction_action_data = player.GetConstructionActionData();
113
114 return true;
115 }
116 }
117 }
118
119 return false;
120 }
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
void Construction(BaseBuildingBase parent)
const float DEFAULT
proto native CGame GetGame()

References Construction(), UAMaxDistances::DEFAULT, GetGame(), and IsInReach().

Referenced by ActionCondition(), and ActionConditionContinue().

◆ GetAdminLogMessage()

override string ActionDestroyPart::GetAdminLogMessage ( ActionData action_data)
inlineprotected

Definition at line 122 of file ActionDestroyPart.c.

123 {
124 return " destroyed " + action_data.m_Target.GetObject().GetDisplayName() + " with " + action_data.m_MainItem.GetDisplayName();
125 }

◆ OnActionInfoUpdate()

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

Definition at line 30 of file ActionDestroyPart.c.

31 {
32 ConstructionActionData construction_action_data = player.GetConstructionActionData();
33 m_Text = "#destroy " + construction_action_data.GetTargetPart();
34 }

References m_Text.

◆ OnFinishProgressServer()

override void ActionDestroyPart::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 55 of file ActionDestroyPart.c.

56 {
58 Construction construction = base_building.GetConstruction();
59 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
61
62 if (construction.CanDestroyPart(construction_part.GetPartName()))
63 {
64 //build
65 string part_name = construction_part.GetPartName();
66 string zone_name;
67 DamageSystem.GetDamageZoneFromComponentName(base_building, part_name, zone_name);
68
69 if (zone_name != "")
70 {
71 base_building.AddHealth(zone_name, "Health", -(base_building.GetMaxHealth(zone_name, "") / CYCLES));
72 if (base_building.GetHealth(zone_name, "Health") < 1)
73 construction.DestroyPartServer(action_data.m_Player, construction_part.GetPartName(), AT_DESTROY_PART);
74 }
75 else
76 construction.DestroyPartServer(action_data.m_Player, construction_part.GetPartName(), AT_DESTROY_PART);
77
78 //add damage to tool
79 action_data.m_MainItem.DecreaseHealth(UADamageApplied.DESTROY, false);
80 }
81
82 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
83 }
const int AT_DESTROY_PART
Definition _constants.c:8
const float DESTROY

References AT_DESTROY_PART, Construction(), CYCLES, UADamageApplied::DESTROY, and m_SpecialtyWeight.

Member Data Documentation

◆ CYCLES

int ActionDestroyPart::CYCLES = 4
staticprivate

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