Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/ghosticons #26

Merged
merged 2 commits into from Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions JM/CF/Defines/CFDefines.c
Expand Up @@ -2,6 +2,8 @@
#define CF_MODULE_CONFIG
//#define CF_MODULE_PERMISSIONS

#define CF_GHOSTICONS_V2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be changed to
#define CF_GHOSTICONS


#ifdef CF_MODULE_LAYOUT_BINDING
#define CF_MODEL_VIEW_BINDING
#endif
@@ -0,0 +1,35 @@
modded class AttachmentCategoriesContainer
{
override void LoadAttachmentCategoriesIcon(SlotsContainer items_cont, string icon_name, int slot_number)
{
SlotsIcon icon = items_cont.GetSlotIcon(slot_number);
ImageWidget image_widget = icon.GetGhostSlot();
image_widget.Show(true);

string path = "CfgSlots" + " Slot_" + InventorySlots.GetSlotName(icon.GetSlotID());

if ( GetGame().ConfigIsExisting( path + " modGhostIcon" ) && GetGame().ConfigGetText( path + " modGhostIcon", icon_name ) && icon_name != "" )
{
image_widget.LoadImageFile(0, icon_name);

if (m_Body.Count() > (slot_number + 2))
{
ClosableContainer c = ClosableContainer.Cast(m_Body.Get(slot_number + 2));
icon.GetRadialIconPanel().Show(true);
if (c && c.IsOpened())
{
icon.GetRadialIconClosed().Show(false);
icon.GetRadialIcon().Show(true);
}
else
{
icon.GetRadialIcon().Show(false);
icon.GetRadialIconClosed().Show(true);
}
}
} else
{
super.LoadAttachmentCategoriesIcon(items_cont, icon_name, slot_number);
}
}
};
@@ -0,0 +1,38 @@
modded class Attachments
{
override void InitAttachmentGrid(int att_row_index)
{
super.InitAttachmentGrid(att_row_index);

for (int i = 0; i < m_AttachmentSlotNames.Count(); i++)
{
SlotsIcon icon2 = SlotsContainer.Cast(m_AttachmentsContainer.Get((i / ITEMS_IN_ROW))).GetSlotIcon(i % ITEMS_IN_ROW);
WidgetEventHandler.GetInstance().RegisterOnDoubleClick(icon2.GetPanelWidget(), m_Parent, "DoubleClick");

string path = "CfgSlots" + " Slot_" + m_AttachmentSlotNames[i];

//Show different magazine icon for firearms and pistols
if (m_AttachmentSlotNames[i] == "magazine")
{
if (!m_Entity.IsInherited(Pistol_Base))
path = "CfgSlots" + " Slot_" + "magazine2";
}

string icon_name = "";
if (GetGame().ConfigIsExisting(path + " modGhostIcon") && GetGame().ConfigGetText(path + " modGhostIcon", icon_name) && icon_name != "")
{
icon2.GetGhostSlot().LoadImageFile(0, icon_name);

int slot_id = InventorySlots.GetSlotIdFromString(m_AttachmentSlotNames[i]);
m_AttachmentSlots.Insert(slot_id, icon2);
icon2.SetSlotID(slot_id);

EntityAI item = m_Entity.GetInventory().FindAttachment(slot_id);
if (item)
AttachmentAdded(item, m_AttachmentSlotNames[i], m_Entity);
else
icon2.Clear();
}
}
}
};