DayZ 1.24
Loading...
Searching...
No Matches
HandAnimated_Guards.c File Reference

Go to the source code of this file.

Classes

class  HandGuardBase
 TODO(kumarjac): This guard is unused but it has a fault and doesn't conform with maximimal/minimal checks on "Juncture"/"Remote". More...
 
class  HandSelectAnimationOfForceSwapInHandsEvent
 

Functions

int SlotToAnimType (notnull Man player, notnull InventoryLocation src, InventoryLocation dst=null)
 
bool SelectAnimationOfTakeToHands (notnull Man player, notnull InventoryLocation src, notnull InventoryLocation dst, out int animType)
 
bool SelectAnimationOfMoveFromHands (notnull Man player, notnull InventoryLocation src, notnull InventoryLocation dst, out int animType)
 
bool SelectAnimationOfForceSwapInHands (notnull Man player, notnull InventoryLocation old_src, notnull InventoryLocation new_src, notnull InventoryLocation old_dst, notnull InventoryLocation new_dst, out int animType1, out int animType2)
 

Function Documentation

◆ SelectAnimationOfForceSwapInHands()

bool SelectAnimationOfForceSwapInHands ( notnull Man player,
notnull InventoryLocation old_src,
notnull InventoryLocation new_src,
notnull InventoryLocation old_dst,
notnull InventoryLocation new_dst,
out int animType1,
out int animType2 )

Definition at line 137 of file HandAnimated_Guards.c.

138{
139 if (player.IsInTransport())
140 return false;
141
143
144 if (old_src.GetItem().GetHierarchyRootPlayer() == player || new_src.GetItem().GetHierarchyRootPlayer() == player)
145 {
148 //Print("animType1 = " + animType1);
149 //Print("animType2 = " + animType2);
150 if (animType1 != -1 && animType2 != -1)
151 {
152 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] SelectAnimationOfForceSwapInHands guard - selected animType1=" + animType1 + " animType2=" + animType2 + " for old_item=" + old_src.GetItem() + " for new_item=" + new_src.GetItem());
153 return true;
154 }
155 /*else if (animType1 != -1 || animType2 != -1) //HACK
156 {
157 animType1 = -1;
158 animType2 = -1;
159 return false;
160 }*/
161 }
162 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] SelectAnimationOfForceSwapInHands - no animation");
163 return false;
164}
int SlotToAnimType(notnull Man player, notnull InventoryLocation src, InventoryLocation dst=null)
void hndDebugPrint(string s)
Definition HandFSM.c:1
InventoryLocation.
static string DumpToStringNullSafe(InventoryLocation loc)
static bool IsInventoryHFSMLogEnable()
Definition Debug.c:749

References InventoryLocation::DumpToStringNullSafe(), hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), and SlotToAnimType().

Referenced by HandGuardBase::ProcessSwapEvent().

◆ SelectAnimationOfMoveFromHands()

bool SelectAnimationOfMoveFromHands ( notnull Man player,
notnull InventoryLocation src,
notnull InventoryLocation dst,
out int animType )

Definition at line 119 of file HandAnimated_Guards.c.

120{
121 if (player.IsInTransport())
122 return false;
123
124 if (src.GetItem().GetHierarchyRootPlayer() == player)
125 {
127 if (animType != -1)
128 {
129 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] SelectAnimationOfMoveFromHands guard - selected animType=" + animType + " for item=" + src.GetItem());
130 return true;
131 }
132 }
133 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] SelectAnimationOfMoveFromHands - no animation");
134 return false;
135}

References hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), and SlotToAnimType().

Referenced by HandGuardBase::GuardCondition().

◆ SelectAnimationOfTakeToHands()

bool SelectAnimationOfTakeToHands ( notnull Man player,
notnull InventoryLocation src,
notnull InventoryLocation dst,
out int animType )

Definition at line 99 of file HandAnimated_Guards.c.

100{
101 if (player.IsInTransport())
102 return false;
103 if (src.GetType() == InventoryLocationType.GROUND)
104 return false;
105
106 if (src.GetItem().GetHierarchyRootPlayer() == player)
107 {
109 if (animType != -1)
110 {
111 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] SelectAnimationOfTakeToHands - selected animType=" + animType + " for item=" + src.GetItem());
112 return true;
113 }
114 }
115 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] SelectAnimationOfTakeToHands - no animation");
116 return false;
117}
InventoryLocationType
types of Inventory Location

References hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), and SlotToAnimType().

Referenced by HandGuardBase::GuardCondition().

◆ SlotToAnimType()

int SlotToAnimType ( notnull Man player,
notnull InventoryLocation src,
InventoryLocation dst = null )

Definition at line 1 of file HandAnimated_Guards.c.

2{
3 //Print("src.GetType() " + src.GetType());
5 //InventoryLocation invloc2 = new InventoryLocation;
6
7 if ((dst && dst.GetParent() && !dst.GetParent().GetHierarchyRootPlayer()) || (src && src.GetParent() && !src.GetParent().GetHierarchyRootPlayer()))
8 return -1;
9
10 if (dst && (dst.GetType() == InventoryLocationType.ATTACHMENT || dst.GetType() == InventoryLocationType.CARGO))
11 {
12 invloc1.Copy(dst);
13 //invloc2.Copy(src);
14 }
15 else if (src.GetType() == InventoryLocationType.ATTACHMENT || src.GetType() == InventoryLocationType.CARGO)
16 {
17 invloc1.Copy(src);
18 //invloc2.Copy(dst);
19 }
20 else
21 return -1;
22
23 int val = -1;
24 if (invloc1.GetItem() && invloc1.GetItem().GetInventoryHandAnimation(invloc1, val))
25 return val;
26
27 if (invloc1.GetType() == InventoryLocationType.ATTACHMENT /*|| src.GetType() == InventoryLocationType.HANDS*/)
28 {
29 //return WeaponHideShowTypes.HIDESHOW_SLOT_KNIFEBACK;
30 switch (invloc1.GetSlot())
31 {
32 case InventorySlots.SHOULDER:
33 {
34 if (invloc1.GetItem() && invloc1.GetItem().IsWeapon())
35 return WeaponHideShowTypes.HIDESHOW_SLOT_RFLLEFTBACK;
36 else if (invloc1.GetItem() && invloc1.GetItem().IsOneHandedBehaviour())
37 return WeaponHideShowTypes.HIDESHOW_SLOT_1HDLEFTBACK;
38 return WeaponHideShowTypes.HIDESHOW_SLOT_2HDLEFTBACK;
39 }
40 case InventorySlots.MELEE:
41 {
42 if (invloc1.GetItem() && invloc1.GetItem().IsWeapon())
43 return WeaponHideShowTypes.HIDESHOW_SLOT_RFLRIGHTBACK;
44 else if (invloc1.GetItem() && invloc1.GetItem().IsOneHandedBehaviour())
45 return WeaponHideShowTypes.HIDESHOW_SLOT_1HDRIGHTBACK;
46 return WeaponHideShowTypes.HIDESHOW_SLOT_2HDRIGHTBACK;
47 }
48 case InventorySlots.PISTOL:
49 {
50 EntityAI parent_item = invloc1.GetParent(); // belt
51 Man owner;
52 if (parent_item)
53 owner = parent_item.GetHierarchyRootPlayer(); // player
54 if (!owner)
55 return -1;
56
57 EntityAI item1 = owner.GetInventory().FindAttachment(InventorySlots.HIPS);
58 EntityAI item2 = parent_item.GetHierarchyParent();
59 if (owner && item1 == item2) // is the pistol in a belt holster?
60 return WeaponHideShowTypes.HIDESHOW_SLOT_PISTOLBELT;
61 return WeaponHideShowTypes.HIDESHOW_SLOT_PISTOLCHEST;
62 }
63 case InventorySlots.KNIFE:
64 return WeaponHideShowTypes.HIDESHOW_SLOT_KNIFEBACK;
65
66 /*case InventorySlots.VEST:
67 case InventorySlots.FEET:
68 case InventorySlots.BODY:
69 case InventorySlots.LEGS:
70 case InventorySlots.BACK:
71 case InventorySlots.HIPS:
72 case InventorySlots.HEADGEAR:
73 return WeaponHideShowTypes.HIDESHOW_SLOT_INVENTORY;*/
74
75 default:
76 return WeaponHideShowTypes.HIDESHOW_SLOT_INVENTORY;
77 //Print("[hndfsm] SlotToAnimType - not animated slot in src_loc=" + InventoryLocation.DumpToStringNullSafe(invloc1));
78 };
79 //
80 //if (InventorySlots.GetSlotIdFromString("Pistol"))
81 }
82 else if (invloc1.GetType() == InventoryLocationType.CARGO)
83 {
84 if (invloc1.GetItem() && (invloc1.GetItem().GetInventory().HasInventorySlot(InventorySlots.SHOULDER) || invloc1.GetItem().GetInventory().HasInventorySlot(InventorySlots.MELEE)))
85 {
86 //Print("Special inventory anim");
87 if (invloc1.GetItem() && invloc1.GetItem().IsWeapon())
88 return WeaponHideShowTypes.HIDESHOW_SLOT_RFLRIGHTBACK;
89 else if (invloc1.GetItem() && invloc1.GetItem().IsOneHandedBehaviour())
90 return WeaponHideShowTypes.HIDESHOW_SLOT_1HDRIGHTBACK;
91 return WeaponHideShowTypes.HIDESHOW_SLOT_2HDRIGHTBACK;
92 }
93 //Print("Default inventory anim");
94 return WeaponHideShowTypes.HIDESHOW_SLOT_INVENTORY; //default item animation
95 }
96 return -1;
97}
provides access to slot configuration
WeaponHideShowTypes
Definition human.c:910

Referenced by SelectAnimationOfForceSwapInHands(), SelectAnimationOfMoveFromHands(), and SelectAnimationOfTakeToHands().