Skip to content

Commit bc897ba

Browse files
authored
Merge pull request #27 from Jacob-Mango/development
Release 1.2
2 parents 5621666 + a5a15de commit bc897ba

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

JM/CF/Defines/CFDefines.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define CF_MODULE_CONFIG
33
//#define CF_MODULE_PERMISSIONS
44

5+
#define CF_GHOSTICONS_V2
6+
57
#ifdef CF_MODULE_LAYOUT_BINDING
68
#define CF_MODEL_VIEW_BINDING
79
#endif
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
modded class AttachmentCategoriesContainer
2+
{
3+
override void LoadAttachmentCategoriesIcon(SlotsContainer items_cont, string icon_name, int slot_number)
4+
{
5+
SlotsIcon icon = items_cont.GetSlotIcon(slot_number);
6+
ImageWidget image_widget = icon.GetGhostSlot();
7+
image_widget.Show(true);
8+
9+
string path = "CfgSlots" + " Slot_" + InventorySlots.GetSlotName(icon.GetSlotID());
10+
11+
if ( GetGame().ConfigIsExisting( path + " modGhostIcon" ) && GetGame().ConfigGetText( path + " modGhostIcon", icon_name ) && icon_name != "" )
12+
{
13+
image_widget.LoadImageFile(0, icon_name);
14+
15+
if (m_Body.Count() > (slot_number + 2))
16+
{
17+
ClosableContainer c = ClosableContainer.Cast(m_Body.Get(slot_number + 2));
18+
icon.GetRadialIconPanel().Show(true);
19+
if (c && c.IsOpened())
20+
{
21+
icon.GetRadialIconClosed().Show(false);
22+
icon.GetRadialIcon().Show(true);
23+
}
24+
else
25+
{
26+
icon.GetRadialIcon().Show(false);
27+
icon.GetRadialIconClosed().Show(true);
28+
}
29+
}
30+
} else
31+
{
32+
super.LoadAttachmentCategoriesIcon(items_cont, icon_name, slot_number);
33+
}
34+
}
35+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
modded class Attachments
2+
{
3+
override void InitAttachmentGrid(int att_row_index)
4+
{
5+
super.InitAttachmentGrid(att_row_index);
6+
7+
for (int i = 0; i < m_AttachmentSlotNames.Count(); i++)
8+
{
9+
SlotsIcon icon2 = SlotsContainer.Cast(m_AttachmentsContainer.Get((i / ITEMS_IN_ROW))).GetSlotIcon(i % ITEMS_IN_ROW);
10+
WidgetEventHandler.GetInstance().RegisterOnDoubleClick(icon2.GetPanelWidget(), m_Parent, "DoubleClick");
11+
12+
string path = "CfgSlots" + " Slot_" + m_AttachmentSlotNames[i];
13+
14+
//Show different magazine icon for firearms and pistols
15+
if (m_AttachmentSlotNames[i] == "magazine")
16+
{
17+
if (!m_Entity.IsInherited(Pistol_Base))
18+
path = "CfgSlots" + " Slot_" + "magazine2";
19+
}
20+
21+
string icon_name = "";
22+
if (GetGame().ConfigIsExisting(path + " modGhostIcon") && GetGame().ConfigGetText(path + " modGhostIcon", icon_name) && icon_name != "")
23+
{
24+
icon2.GetGhostSlot().LoadImageFile(0, icon_name);
25+
26+
int slot_id = InventorySlots.GetSlotIdFromString(m_AttachmentSlotNames[i]);
27+
m_AttachmentSlots.Insert(slot_id, icon2);
28+
icon2.SetSlotID(slot_id);
29+
30+
EntityAI item = m_Entity.GetInventory().FindAttachment(slot_id);
31+
if (item)
32+
AttachmentAdded(item, m_AttachmentSlotNames[i], m_Entity);
33+
else
34+
icon2.Clear();
35+
}
36+
}
37+
}
38+
};

0 commit comments

Comments
 (0)