fix: Fixes duping containers and removes copying private setter properties (#1816)
### Summary - Removes copying private setters - Fixes duping containers - Adds public `Dupe.DoDupe` functions for external scripts to hook into the existing logic.
This commit is contained in:
parent
c69d16a90e
commit
0b802dbe1b
5 changed files with 116 additions and 65 deletions
|
|
@ -3381,9 +3381,15 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
|
|||
continue;
|
||||
}
|
||||
|
||||
var setMethod = p.GetSetMethod(false);
|
||||
|
||||
try
|
||||
{
|
||||
p.SetValue(dest, p.GetValue(src, null), null);
|
||||
// Do not copy private properties
|
||||
if (setMethod != null)
|
||||
{
|
||||
p.SetValue(dest, p.GetValue(src, null), null);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -865,10 +865,12 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
}
|
||||
}
|
||||
|
||||
[IgnoreDupe]
|
||||
public bool Pushing { get; set; }
|
||||
|
||||
public virtual bool IsDeadBondedPet => false;
|
||||
|
||||
[IgnoreDupe]
|
||||
public ISpell Spell
|
||||
{
|
||||
get => m_Spell;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public static class ActivatorExtensions
|
|||
{
|
||||
var argLength = args?.Length ?? 0;
|
||||
|
||||
var types = argLength > 0 ? new Type[argLength] : Array.Empty<Type>();
|
||||
var types = argLength > 0 ? new Type[argLength] : [];
|
||||
for (int i = 0; i < types.Length; i++)
|
||||
{
|
||||
types[i] = args![i]?.GetType();
|
||||
|
|
@ -139,7 +139,7 @@ public static class ActivatorExtensions
|
|||
object[] paramArgs;
|
||||
if (paramCount == 0)
|
||||
{
|
||||
paramArgs = Array.Empty<object>();
|
||||
paramArgs = [];
|
||||
}
|
||||
else if (argLength == paramCount)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue