diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs index 4440c5d5..08d0d968 100644 --- a/NewHorizons/External/Configs/StarSystemConfig.cs +++ b/NewHorizons/External/Configs/StarSystemConfig.cs @@ -21,6 +21,12 @@ namespace NewHorizons.External.Configs /// public string name; + /// + /// When changing star systems are you allowed to bring items into this system? + /// + [DefaultValue(true)] + public bool allowOutsideItems = true; + /// /// In this system should the player be able to rotate their map camera freely or be stuck above the plane of the solar system? /// diff --git a/NewHorizons/Handlers/HeldItemHandler.cs b/NewHorizons/Handlers/HeldItemHandler.cs index e166c1b9..5ff7e5bb 100644 --- a/NewHorizons/Handlers/HeldItemHandler.cs +++ b/NewHorizons/Handlers/HeldItemHandler.cs @@ -89,10 +89,14 @@ public static class HeldItemHandler _pathOfItemTakenFromSystem[Main.Instance.CurrentStarSystem].Add(path); } - private static void OnStarSystemChanging(string _) + private static void OnStarSystemChanging(string newSystem) { // Double check we're still holding it _currentlyHeldItem = Locator.GetToolModeSwapper().GetItemCarryTool().GetHeldItem()?.gameObject; + if (!Main.SystemDict[newSystem].Config.allowOutsideItems) + { + _currentlyHeldItem = null; + } if (_currentlyHeldItem != null) {