DayZ 1.24
Loading...
Searching...
No Matches
ActionSwapItemToHand.c
Go to the documentation of this file.
1/*class ActionSwapItemToHands: ActionInteractBase
2 {
3 string m_ItemName = "";
4
5 void ActionSwapItemToHands()
6 {
7 m_MessageSuccess = "";
8 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
9 m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS;
10
11 m_HUDCursorIcon = CursorIcons.LootCorpse;
12 }
13
14 override void CreateConditionComponents()
15 {
16 m_ConditionItem = new CCINone;
17 m_ConditionTarget = new CCTDummy();
18 }
19
20 override bool HasProneException()
21 {
22 return true;
23 }
24
25 override int GetType()
26 {
27 return AT_SWAP_ITEM_TO_HANDS;
28 }
29
30 override string GetText()
31 {
32 return "#swap_to_hands";
33 }
34
35 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
36 {
37 EntityAI entity;
38 ItemBase ih = player.GetItemInHands();
39 if ( ih && item && Class.CastTo(entity, target.GetObject()) )
40 {
41 bool canAdd = player.GetInventory().CanAddEntityIntoHands(entity);
42
43 if ( entity && !player.GetInventory().CanAddEntityIntoInventory(entity) && entity.CanPutIntoHands(player) && !canAdd && entity.GetHierarchyRootPlayer() != player )
44 {
45 return true;
46 }
47 }
48 return false;
49 }
50
51 override void OnExecuteServer( ActionData action_data )
52 {
53 EntityAI ntarget = EntityAI.Cast(action_data.m_Target.GetObject());
54 action_data.m_Player.LocalSwapEntities(ntarget, action_data.m_Player.GetItemInHands());
55 }
56 override void OnExecuteClient( ActionData action_data )
57 {
58 EntityAI ntarget = EntityAI.Cast(action_data.m_Target.GetObject());
59 action_data.m_Player.LocalSwapEntities(ntarget, action_data.m_Player.GetItemInHands());
60 }
61 };*/