Fixes parent references. (#15)
This commit is contained in:
parent
01d0fb75b8
commit
90ffe0ea3c
20 changed files with 55 additions and 93 deletions
|
|
@ -45,17 +45,13 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public virtual object FindParent(Mobile from)
|
||||
public virtual IEntity FindParent(Mobile from)
|
||||
{
|
||||
Mobile m = HeldBy;
|
||||
if (HeldBy?.Holding == this)
|
||||
return HeldBy;
|
||||
|
||||
if (m != null && m.Holding == this)
|
||||
return m;
|
||||
|
||||
object obj = RootParent;
|
||||
|
||||
if (obj != null)
|
||||
return obj;
|
||||
if (RootParent != null)
|
||||
return RootParent;
|
||||
|
||||
if (Map == Map.Internal)
|
||||
return from;
|
||||
|
|
@ -74,7 +70,7 @@ namespace Server.Items
|
|||
ThrowTarget targ = from.Target as ThrowTarget;
|
||||
Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.
|
||||
|
||||
if (targ != null && targ.Potion == this)
|
||||
if (targ?.Potion == this)
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
|
@ -107,7 +103,7 @@ namespace Server.Items
|
|||
if (Deleted)
|
||||
return;
|
||||
|
||||
object parent = FindParent(from);
|
||||
IEntity parent = FindParent(from);
|
||||
|
||||
if (timer == 0)
|
||||
{
|
||||
|
|
@ -272,4 +268,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue