Add files via upload

This commit is contained in:
celisej567
2021-08-05 17:54:51 +03:00
committed by GitHub
parent d58ad89d11
commit 76b55e2a87
57 changed files with 5632 additions and 0 deletions

35
code/Player.Use.cs Normal file
View File

@@ -0,0 +1,35 @@
using Sandbox;
partial class SandboxPlayer
{
public bool IsUseDisabled()
{
return ActiveChild is IUse use && use.IsUsable( this );
}
protected override Entity FindUsable()
{
if ( IsUseDisabled() )
return null;
var tr = Trace.Ray( EyePos, EyePos + EyeRot.Forward * (85 * Scale) )
.Radius( 2 )
.HitLayer( CollisionLayer.Debris )
.Ignore( this )
.Run();
if ( tr.Entity == null ) return null;
if ( tr.Entity is not IUse use ) return null;
if ( !use.IsUsable( this ) ) return null;
return tr.Entity;
}
protected override void UseFail()
{
if ( IsUseDisabled() )
return;
base.UseFail();
}
}