Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
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
8{
10 {
11 }
12
13 override void CreateConditionComponents()
14 {
17 m_Text = "#attach";
18 }
19
20 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
21 {
22 EntityAI target_EAI = EntityAI.Cast( target.GetObject() );
23 string selection = target_EAI.GetActionComponentName(target.GetComponentIndex());
24
25 if ( selection == "sparkplug" && target_EAI.GetInventory().CanAddAttachment(item) )
26 {
27 return true;
28 }
29
30 return false;
31 }
32
33 override void OnExecuteServer( ActionData action_data )
34 {
35 EntityAI target_EAI = EntityAI.Cast( action_data.m_Target.GetObject() ); // cast to ItemBase
36 target_EAI.LocalTakeEntityAsAttachment (action_data.m_MainItem);
37 }
38 override void OnExecuteClient( ActionData action_data )
39 {
40 EntityAI target_EAI = EntityAI.Cast( action_data.m_Target.GetObject() ); // cast to ItemBase
41 target_EAI.LocalTakeEntityAsAttachment (action_data.m_MainItem);
42 }
43};
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
override bool LocalTakeEntityAsAttachment(notnull EntityAI item)
Definition man.c:454