Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actioninstallsparkplug.c
Go to the documentation of this file.
1 /*
2  This is a generic user action for attaching sparkplug on any EntityAI object. The receiver must have a "sparkplug" selection in its View Geometry that the action_data.m_Player can look at.
3 */
4 
5 
7 {
9  {
10  }
11 
12  override void CreateConditionComponents()
13  {
16  m_Text = "#attach";
17  }
18 
19  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
20  {
21  EntityAI target_EAI = EntityAI.Cast( target.GetObject() );
22  string selection = target_EAI.GetActionComponentName(target.GetComponentIndex());
23 
24  if ( selection == "sparkplug" && target_EAI.GetInventory().CanAddAttachment(item) )
25  {
26  return true;
27  }
28 
29  return false;
30  }
31 
32  override void OnExecuteServer( ActionData action_data )
33  {
34  EntityAI target_EAI = EntityAI.Cast( action_data.m_Target.GetObject() ); // cast to ItemBase
35  target_EAI.LocalTakeEntityAsAttachment (action_data.m_MainItem);
36  }
37  override void OnExecuteClient( ActionData action_data )
38  {
39  EntityAI target_EAI = EntityAI.Cast( action_data.m_Target.GetObject() ); // cast to ItemBase
40  target_EAI.LocalTakeEntityAsAttachment (action_data.m_MainItem);
41  }
42 };
ItemBase
Definition: inventoryitem.c:730
ActionInsertSparkplug
Definition: actioninstallsparkplug.c:6
UAMaxDistances
Definition: actionconstants.c:104
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
CCTNonRuined
Definition: cctnonruined.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
ActionSingleUseBase
Definition: actionsingleusebase.c:41
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
EntityAI
Definition: building.c:5