DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ SlotToAnimType()

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

См. определение в файле HandAnimated_Guards.c строка 1

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 {
22 return -1;
23 }
24
25 int val = -1;
26 if ( invloc1.GetItem() && invloc1.GetItem().GetInventoryHandAnimation(invloc1,val) )
27 {
28 return val;
29 }
30
31 if (invloc1.GetType() == InventoryLocationType.ATTACHMENT /*|| src.GetType() == InventoryLocationType.HANDS*/)
32 {
33 //return WeaponHideShowTypes.HIDESHOW_SLOT_KNIFEBACK;
34 switch (invloc1.GetSlot())
35 {
36 case InventorySlots.SHOULDER:
37 {
38 if (invloc1.GetItem() && invloc1.GetItem().IsWeapon())
39 {
40 return WeaponHideShowTypes.HIDESHOW_SLOT_RFLLEFTBACK;
41 }
42 else if (invloc1.GetItem() && invloc1.GetItem().IsOneHandedBehaviour())
43 {
44 return WeaponHideShowTypes.HIDESHOW_SLOT_1HDLEFTBACK;
45 }
46 return WeaponHideShowTypes.HIDESHOW_SLOT_2HDLEFTBACK;
47 }
48 case InventorySlots.MELEE:
49 {
50 if (invloc1.GetItem() && invloc1.GetItem().IsWeapon())
51 {
52 return WeaponHideShowTypes.HIDESHOW_SLOT_RFLRIGHTBACK;
53 }
54 else if (invloc1.GetItem() && invloc1.GetItem().IsOneHandedBehaviour())
55 {
56 return WeaponHideShowTypes.HIDESHOW_SLOT_1HDRIGHTBACK;
57 }
58 return WeaponHideShowTypes.HIDESHOW_SLOT_2HDRIGHTBACK;
59 }
60 case InventorySlots.PISTOL:
61 {
62 EntityAI parent_item = invloc1.GetParent(); // belt
63 Man owner;
64 if (parent_item)
65 owner = parent_item.GetHierarchyRootPlayer(); // player
66 if (!owner)
67 return -1;
68
69 EntityAI item1 = owner.GetInventory().FindAttachment(InventorySlots.HIPS);
70 EntityAI item2 = parent_item.GetHierarchyParent();
71 if (owner && item1 == item2) // is the pistol in a belt holster?
72 {
73 return WeaponHideShowTypes.HIDESHOW_SLOT_PISTOLBELT;
74 }
75 return WeaponHideShowTypes.HIDESHOW_SLOT_PISTOLCHEST;
76 }
77 case InventorySlots.KNIFE:
78 return WeaponHideShowTypes.HIDESHOW_SLOT_KNIFEBACK;
79
80 /*case InventorySlots.VEST:
81 case InventorySlots.FEET:
82 case InventorySlots.BODY:
83 case InventorySlots.LEGS:
84 case InventorySlots.BACK:
85 case InventorySlots.HIPS:
86 case InventorySlots.HEADGEAR:
87 return WeaponHideShowTypes.HIDESHOW_SLOT_INVENTORY;*/
88
89 default:
90 return WeaponHideShowTypes.HIDESHOW_SLOT_INVENTORY;
91 //Print("[hndfsm] SlotToAnimType - not animated slot in src_loc=" + InventoryLocation.DumpToStringNullSafe(invloc1));
92 };
93 //
94 //if (InventorySlots.GetSlotIdFromString("Pistol"))
95 }
96 else if (invloc1.GetType() == InventoryLocationType.CARGO)
97 {
98 if ( invloc1.GetItem() && (invloc1.GetItem().GetInventory().HasInventorySlot(InventorySlots.SHOULDER) || invloc1.GetItem().GetInventory().HasInventorySlot(InventorySlots.MELEE)) )
99 {
100 //Print("Special inventory anim");
101 if (invloc1.GetItem() && invloc1.GetItem().IsWeapon())
102 {
103 return WeaponHideShowTypes.HIDESHOW_SLOT_RFLRIGHTBACK;
104 }
105 else if (invloc1.GetItem() && invloc1.GetItem().IsOneHandedBehaviour())
106 {
107 return WeaponHideShowTypes.HIDESHOW_SLOT_1HDRIGHTBACK;
108 }
109 return WeaponHideShowTypes.HIDESHOW_SLOT_2HDRIGHTBACK;
110 }
111 //Print("Default inventory anim");
112 return WeaponHideShowTypes.HIDESHOW_SLOT_INVENTORY; //default item animation
113 }
114 return -1;
115}
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
Определения Building.c:6
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
proto native int GetType()
returns type of InventoryLocation
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
provides access to slot configuration
Определения InventorySlots.c:6
WeaponHideShowTypes
Определения human.c:930

Перекрестные ссылки InventoryLocation::Copy(), InventoryLocation::GetItem(), InventoryLocation::GetParent(), InventoryLocation::GetSlot() и InventoryLocation::GetType().

Используется в SelectAnimationOfForceSwapInHands(), SelectAnimationOfMoveFromHands() и SelectAnimationOfTakeToHands().