Skip to content

Commit

Permalink
fix: Attempts to fix sector list.
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman committed Jan 24, 2024
1 parent 497ea87 commit ee54277
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 42 deletions.
23 changes: 2 additions & 21 deletions Projects/Server/Items/BaseMulti.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ public override int ItemID
{
if (base.ItemID != value)
{
var facet = Parent == null ? Map : null;

facet?.OnLeave(this);

Map?.OnLeave(this);
base.ItemID = value;

facet?.OnEnter(this);
Map?.OnEnter(this);
}
}
}
Expand Down Expand Up @@ -69,21 +65,6 @@ public override int LabelNumber

public virtual MultiComponentList Components => MultiData.GetComponents(ItemID);

[Obsolete("Replace with calls to OnLeave and OnEnter surrounding component invalidation.", true)]
public virtual void RefreshComponents()
{
if (Parent == null)
{
var facet = Map;

if (facet != null)
{
facet.OnLeave(this);
facet.OnEnter(this);
}
}
}

public override int GetMaxUpdateRange() => 22;

public override int GetUpdateRange(Mobile m) => 22;
Expand Down
24 changes: 13 additions & 11 deletions Projects/Server/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -599,18 +599,16 @@ public IEntity Parent

var oldParent = m_Parent;

if (m_Map != null && oldParent == null && value != null)
{
m_Map.OnLeave(this);
}

m_Parent = value;

if (m_Map != null)
if (m_Map != null && oldParent != null && value == null)
{
if (oldParent != null && m_Parent == null)
{
m_Map.OnEnter(this);
}
else if (m_Parent != null)
{
m_Map.OnLeave(this);
}
m_Map.OnEnter(this);
}
}
}
Expand Down Expand Up @@ -1207,9 +1205,13 @@ public Map Map
{
var old = m_Map;

if (m_Map != null && m_Parent == null)
if (m_Map != null)
{
m_Map.OnLeave(this);
if (m_Parent == null)
{
m_Map.OnLeave(this);
}

SendRemovePacket();
}

Expand Down
20 changes: 10 additions & 10 deletions Projects/Server/Maps/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,27 +568,27 @@ public void OnClientChange(NetState oldState, NetState newState, Mobile m)
}
}

public void OnEnter(Mobile m)
internal void OnEnter(Mobile m)
{
OnEnter(m.Location, m);
}

public void OnEnter(Point3D p, Mobile m)
internal void OnEnter(Point3D p, Mobile m)
{
if (this != Internal)
{
GetSector(p).OnEnter(m);
}
}

public void OnEnter(Item item)
internal void OnEnter(Item item)
{
OnEnter(item.Location, item);
}

public void OnEnter(Point3D p, Item item)
internal void OnEnter(Point3D p, Item item)
{
if (this == Internal)
if (this == Internal || item.Parent != null)
{
return;
}
Expand All @@ -606,27 +606,27 @@ public void OnEnter(Point3D p, Item item)
}
}

public void OnLeave(Mobile m)
internal void OnLeave(Mobile m)
{
OnLeave(m.Location, m);
}

public void OnLeave(Point3D p, Mobile m)
internal void OnLeave(Point3D p, Mobile m)
{
if (this != Internal)
{
GetSector(p).OnLeave(m);
}
}

public void OnLeave(Item item)
internal void OnLeave(Item item)
{
OnLeave(item.Location, item);
}

public void OnLeave(Point3D p, Item item)
internal void OnLeave(Point3D p, Item item)
{
if (this == Internal)
if (this == Internal || item.Parent != null)
{
return;
}
Expand Down
1 change: 1 addition & 0 deletions Projects/UOContent/World Saves/AutoSave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static bool SavesEnabled

public static void Configure()
{
SavesEnabled = ServerConfiguration.GetOrUpdateSetting("autosave.enabled", true);
Delay = ServerConfiguration.GetOrUpdateSetting("autosave.saveDelay", TimeSpan.FromMinutes(5.0));
Warning = ServerConfiguration.GetOrUpdateSetting("autosave.warningDelay", TimeSpan.Zero);
}
Expand Down

0 comments on commit ee54277

Please sign in to comment.