Skip to content

Commit

Permalink
Add hooks to cycle interaction modes
Browse files Browse the repository at this point in the history
NextInteractionMode() will cycle forwards and PreviousInteractionMode() will cycle backwards.
These hooks are not used by base game and have no keybinding by default. A mod can access these using GameManager.Instance.PlayerActivate and use whatever input the mod wants to trigger these.
  • Loading branch information
Interkarma committed Sep 4, 2023
1 parent f872f0a commit 2650483
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Assets/Scripts/Game/PlayerActivate.cs
Expand Up @@ -1407,6 +1407,62 @@ public void ChangeInteractionMode(PlayerActivateModes newMode, bool showText = t
DaggerfallUI.SetMidScreenText(TextManager.Instance.GetLocalizedText("interactionIsNowInMode").Replace("%s", modeText));
}

/// <summary>
/// Cycle to next interaction mode.
/// Order is Steal > Grab > Info > Talk then wraps back to Steal.
/// </summary>
public void NextInteractionMode()
{
PlayerActivateModes nextMode;
switch (currentMode)
{
case PlayerActivateModes.Steal:
nextMode = PlayerActivateModes.Grab;
break;
case PlayerActivateModes.Grab:
nextMode = PlayerActivateModes.Info;
break;
case PlayerActivateModes.Info:
nextMode = PlayerActivateModes.Talk;
break;
case PlayerActivateModes.Talk:
nextMode = PlayerActivateModes.Steal;
break;
default:
nextMode = currentMode;
break;
}
ChangeInteractionMode(nextMode);
}

/// <summary>
/// Cycle to previous interaction mode.
/// Order is Talk > Info > Grab > Steal then wraps back to Talk.
/// </summary>
public void PreviousInteractionMode()
{
PlayerActivateModes nextMode;
switch (currentMode)
{
case PlayerActivateModes.Talk:
nextMode = PlayerActivateModes.Info;
break;
case PlayerActivateModes.Info:
nextMode = PlayerActivateModes.Grab;
break;
case PlayerActivateModes.Grab:
nextMode = PlayerActivateModes.Steal;
break;
case PlayerActivateModes.Steal:
nextMode = PlayerActivateModes.Talk;
break;
default:
nextMode = currentMode;
break;
}
ChangeInteractionMode(nextMode);
}

// Output NPC info to HUD
private void PresentNPCInfo(StaticNPC npc)
{
Expand Down

0 comments on commit 2650483

Please sign in to comment.