Skip to content

Commit

Permalink
Add option to prevent bringing items into other systems #997
Browse files Browse the repository at this point in the history
  • Loading branch information
xen-42 committed Nov 27, 2024
1 parent acc2cfc commit 6e254cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions NewHorizons/External/Configs/StarSystemConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public class StarSystemConfig
/// </summary>
public string name;

/// <summary>
/// When changing star systems are you allowed to bring items into this system?
/// </summary>
[DefaultValue(true)]
public bool allowOutsideItems = true;

/// <summary>
/// In this system should the player be able to rotate their map camera freely or be stuck above the plane of the solar system?
/// </summary>
Expand Down
6 changes: 5 additions & 1 deletion NewHorizons/Handlers/HeldItemHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ private static void TrackPath(string path)
_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)
{
Expand Down

0 comments on commit 6e254cd

Please sign in to comment.