Fixed wire connections & nodes resetting when copypasting them
This commit is contained in:
@@ -538,11 +538,28 @@ namespace Barotrauma.Items.Components
|
||||
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)
|
||||
{
|
||||
Skill temp;
|
||||
|
||||
@@ -156,6 +156,10 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ShallowRemoveComponentSpecific()
|
||||
{
|
||||
}
|
||||
|
||||
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
IsActive = false;
|
||||
}
|
||||
|
||||
|
||||
public Connection OtherConnection(Connection connection)
|
||||
{
|
||||
if (connection == null) return null;
|
||||
@@ -686,7 +686,20 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
@@ -1996,6 +1996,10 @@ namespace Barotrauma
|
||||
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()
|
||||
{
|
||||
base.ShallowRemove();
|
||||
@@ -2004,7 +2008,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (ItemComponent ic in components)
|
||||
{
|
||||
ic.Remove();
|
||||
ic.ShallowRemove();
|
||||
}
|
||||
ItemList.Remove(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user