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

Private Member Functions

void ActionDetachPowerSourceFromPanel ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteClient (ActionData action_data)
 
override void OnExecuteServer (ActionData action_data)
 
void Process (ActionData action_data)
 

Detailed Description

Definition at line 2 of file ActionDetachPowerSourceFromPanel.c.

Constructor & Destructor Documentation

◆ ActionDetachPowerSourceFromPanel()

void ActionDetachPowerSourceFromPanel::ActionDetachPowerSourceFromPanel ( )
inlineprivate

Definition at line 4 of file ActionDetachPowerSourceFromPanel.c.

5 {
6 m_Text = "#detach_power_source";
7 }
string m_Text
Definition ActionBase.c:49

References m_Text.

Member Function Documentation

◆ ActionCondition()

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

Definition at line 9 of file ActionDetachPowerSourceFromPanel.c.

10 {
11 Object target_object = target.GetObject();
12
13 if (player && target_object)
14 {
15 EntityAI target_entity = EntityAI.Cast(target.GetObject());
16 string selection = target_object.GetActionComponentName(target.GetComponentIndex());
17
18
19 if (target_entity && target_entity.GetInventory() && target_entity.GetInventory().AttachmentCount() > 0 && selection == "power_source") //has any power source attachment attached
20 return true;
21 }
22
23 return false;
24 }

◆ OnExecuteClient()

override void ActionDetachPowerSourceFromPanel::OnExecuteClient ( ActionData action_data)
inlineprivate

Definition at line 26 of file ActionDetachPowerSourceFromPanel.c.

27 {
29 }

References Process().

◆ OnExecuteServer()

override void ActionDetachPowerSourceFromPanel::OnExecuteServer ( ActionData action_data)
inlineprivate

Definition at line 31 of file ActionDetachPowerSourceFromPanel.c.

32 {
34 }

References Process().

◆ Process()

void ActionDetachPowerSourceFromPanel::Process ( ActionData action_data)
inlineprivate

Definition at line 36 of file ActionDetachPowerSourceFromPanel.c.

37 {
38 EntityAI target_entity = EntityAI.Cast(action_data.m_Target.GetObject());
39
41 int attachments_count = target_entity.GetInventory().AttachmentCount();
42 for (int j = 0; j < attachments_count; j++) //find any attached power source
43 {
44 // @TODO: vezme prvni att?
45 attachment = target_entity.GetInventory().GetAttachmentFromIndex(j);
46 if (attachment)
47 break;
48 }
49
50 if (attachment)
51 action_data.m_Player.PredictiveTakeEntityToHands(attachment);
52 }

Referenced by OnExecuteClient(), and OnExecuteServer().


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