Level/CombinationLockInteractor.cs
using Opium;

public sealed class CombinationLockInteractor : BaseInteract
{
	[Property] public LockType Type { get; set; } = LockType.PadlockA;
	[Property] public string Combination { get; set; } = "1234";
	[Property] public string Solution { get; set; } = "4321";
	[Property] public Action OnUnlocked { get; set; }
	[Property, Title("Destory On Sovled")] 
	public bool DestroyOnSolved { get; set; } = false;
	[Property]
	public GameObject SpawnObject { get; set; }
	[Property]
	public GameObject SpawnLocation { get; set; }
	public string CurrentCombination { get; set; }
	public bool Edited { get; set; } = false;
	public TimeUntil NextInteract { get; set; }
	CombinationLockUI comboui;

	bool Solved { get; set; }


	public override bool ShowInteractionUI
	{
		get
		{
			if ( !Solved )
			{
				return true;
			}
			else if ( Solved )
			{
				return false;
			}
			return base.ShowInteractionUI;
		}
	}

	public override void OnUse( GameObject player )
	{
		if ( NextInteract >= 0f )
		{
			return;
		}

		if ( comboui is not null ) return;

		if ( player.Components.Get<Opium.PlayerController>() is not null )
		{
			var ui = player.Components.Get<NotesUI>( FindMode.EnabledInSelfAndDescendants );
			if ( !ui.LookingAtObject.IsValid() )
			{
				var go = ui.GameObject;

				comboui = go.Components.Create<CombinationLockUI>();
				if ( !Edited )
				{
					comboui.StartInteract( this, Type, Combination );
				}
				else
				{
					comboui.StartInteract( this, Type, CurrentCombination );
				}
			}
		}
	}

	public void StopInteract()
	{
		comboui?.Destroy();
		comboui = null;
	}

	public void CorrectCombination()
	{
		if ( Solved ) return;
		Solved = true;
		Sound.Play( "keylock.unlock", Transform.Position ).Volume = 1;
		OnUnlocked?.Invoke();
		if( SpawnObject is not null )
		{
			var obj = SpawnObject.Clone();
			obj.Transform.Position = SpawnLocation.Transform.Position;
			obj.Transform.Rotation = SpawnLocation.Transform.LocalRotation;
		}
		if( DestroyOnSolved )
		{
			GameObject.Destroy();
		}
	}

	public enum LockType
	{
		PadlockA,
		PadlockB,
		PadLockC
	}
}