Skip to content

Commit

Permalink
Adding support to ignore multiple implementations of NetTool
Browse files Browse the repository at this point in the history
> from other mods that doesn't replace original game tool
  • Loading branch information
klyte45 committed Oct 19, 2021
1 parent 380ffce commit 58dfe55
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Src/PrecisionEngineering/Data/NetToolLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public static NetToolProxy Locate()
return null;
}

if (tools.Count > 1)
{
// May other mods use NetTool as base for creating new tools (like Upgrade Untouchable) - so try to get exact class, once it's used by the game as default net tool
Debug.Log($"Multiple NetTool instances found, trying to get exact type member.");
tools = tools.Where(p => p.GetType() == toolType).ToList();
}

if (tools.Count > 1)
{
// The "First" NetTool created is the one we want, since it's the one Unity seems to use.
Expand Down

0 comments on commit 58dfe55

Please sign in to comment.