Fixed wire connections & nodes resetting when copypasting them
This commit is contained in:
@@ -538,11 +538,28 @@ namespace Barotrauma.Items.Components
|
|||||||
RemoveComponentSpecific();
|
RemoveComponentSpecific();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void RemoveComponentSpecific()
|
/// <summary>
|
||||||
|
/// Remove the component so that it doesn't appear to exist in the game world (stop sounds, remove bodies etc)
|
||||||
|
/// but don't reset anything that's required for cloning the item
|
||||||
|
/// </summary>
|
||||||
|
public void ShallowRemove()
|
||||||
{
|
{
|
||||||
|
if (loopingSound != null)
|
||||||
|
{
|
||||||
|
Sounds.SoundManager.Stop(loopingSoundIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShallowRemoveComponentSpecific();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void ShallowRemoveComponentSpecific()
|
||||||
|
{
|
||||||
|
RemoveComponentSpecific();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void RemoveComponentSpecific()
|
||||||
|
{ }
|
||||||
|
|
||||||
public bool HasRequiredSkills(Character character)
|
public bool HasRequiredSkills(Character character)
|
||||||
{
|
{
|
||||||
Skill temp;
|
Skill temp;
|
||||||
|
|||||||
@@ -157,6 +157,10 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void ShallowRemoveComponentSpecific()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||||
{
|
{
|
||||||
foreach (Connection c in Connections)
|
foreach (Connection c in Connections)
|
||||||
|
|||||||
@@ -686,7 +686,20 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
Drawable = nodes.Any();
|
Drawable = nodes.Any();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ShallowRemoveComponentSpecific()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
if (connections[i] == null) continue;
|
||||||
|
int wireIndex = connections[i].FindWireIndex(item);
|
||||||
|
|
||||||
|
if (wireIndex > -1)
|
||||||
|
{
|
||||||
|
connections[i].AddLink(wireIndex, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void RemoveComponentSpecific()
|
protected override void RemoveComponentSpecific()
|
||||||
|
|||||||
@@ -1996,6 +1996,10 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove the item so that it doesn't appear to exist in the game world (stop sounds, remove bodies etc)
|
||||||
|
/// but don't reset anything that's required for cloning the item
|
||||||
|
/// </summary>
|
||||||
public override void ShallowRemove()
|
public override void ShallowRemove()
|
||||||
{
|
{
|
||||||
base.ShallowRemove();
|
base.ShallowRemove();
|
||||||
@@ -2004,7 +2008,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
foreach (ItemComponent ic in components)
|
foreach (ItemComponent ic in components)
|
||||||
{
|
{
|
||||||
ic.Remove();
|
ic.ShallowRemove();
|
||||||
}
|
}
|
||||||
ItemList.Remove(this);
|
ItemList.Remove(this);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user