fix: Moves ContextMenu out of core, streamlines code, fixes bugs (#1873)
## Summary - Removes allocation of a `List<ContextMenuEntry>` every time a context menu is created. - Moves packet/context menu creation logic out of the core - Fixes tame entry ## BREAKING CHANGE > [!Important] > **Developer Note** > ```cs > public virtual void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list) > ``` > and similar functions changed to > ```cs > public virtual void GetContextMenuEntries(Mobile from, ref PooledRefList<ContextMenuEntry> list) > ```
This commit is contained in:
parent
bb24b330e1
commit
f58117a877
88 changed files with 1206 additions and 1483 deletions
|
|
@ -264,7 +264,6 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
private int m_ChangingCombatant;
|
||||
private Mobile m_Combatant;
|
||||
private TimerExecutionToken _combatTimerToken;
|
||||
private ContextMenu m_ContextMenu;
|
||||
private bool m_Criminal;
|
||||
|
||||
private MobileDelta m_DeltaFlags;
|
||||
|
|
@ -870,16 +869,6 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
}
|
||||
}
|
||||
|
||||
public ContextMenu ContextMenu
|
||||
{
|
||||
get => m_ContextMenu;
|
||||
set
|
||||
{
|
||||
m_ContextMenu = value;
|
||||
m_NetState.SendDisplayContextMenu(m_ContextMenu);
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDupe]
|
||||
public bool Pushing { get; set; }
|
||||
|
||||
|
|
@ -6521,26 +6510,12 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
|
||||
public virtual bool CanPaperdollBeOpenedBy(Mobile from) => Body.IsHuman || Body.IsGhost || IsBodyMod;
|
||||
|
||||
public virtual void GetChildContextMenuEntries(Mobile from, List<ContextMenuEntry> list, Item item)
|
||||
public virtual void GetChildContextMenuEntries(Mobile from, ref PooledRefList<ContextMenuEntry> list, Item item)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
public virtual void GetContextMenuEntries(Mobile from, ref PooledRefList<ContextMenuEntry> list)
|
||||
{
|
||||
if (Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (CanPaperdollBeOpenedBy(from))
|
||||
{
|
||||
list.Add(new PaperdollEntry(this));
|
||||
}
|
||||
|
||||
if (from == this && Backpack != null && CanSee(Backpack) && CheckAlive(false))
|
||||
{
|
||||
list.Add(new OpenBackpackEntry(this));
|
||||
}
|
||||
}
|
||||
|
||||
public void Internalize()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue