How do I reference use action?
Reply on sbox.game-
I'm a new dev and have mostly worked with Unity before now. I'm trying to make my first project in S&Box but the API ref hasn't been extremely clear to me.
I want to reference the "use" player actions results, but I don't know how exactly to input the "PlayerController.IEvents" the API talks about.
I'm specifically trying to set up a way to detect when the player is facing an "NPC" object, so I can then open a dialogue box.
Any advice would be appreciated. -
Hi !
If I where you I would check this : https://github.com/Facepunch/sandbox/tree/main/Code/Items/Pickups
It is the pickup logic of the Sandbox Game made by Facepunch.
Since it is open source you can download and open it in the editor to understand how it works.
enjoy! -
public void OnMouseEvent( MouseEvent e )
{
if ( e.LeftMouseButton )
{
Log.Info( $"Mouse Down at {e.LocalPosition}" );
}
if ( e.IsDoubleClick )
{
Log.Info( "Double click!" );
}
}