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

42
code/tools/Remover.cs Normal file
View File

@@ -0,0 +1,42 @@
namespace Sandbox.Tools
{
[Library( "tool_remover", Title = "Remover", Description = "Remove entities", Group = "construction" )]
public partial class RemoverTool : BaseTool
{
public override void Simulate()
{
if ( !Host.IsServer )
return;
using ( Prediction.Off() )
{
if ( !Input.Pressed( InputButton.Attack1 ) )
return;
var startPos = Owner.EyePos;
var dir = Owner.EyeRot.Forward;
var tr = Trace.Ray( startPos, startPos + dir * MaxTraceDistance )
.Ignore( Owner )
.HitLayer( CollisionLayer.Debris )
.Run();
if ( !tr.Hit || !tr.Entity.IsValid() )
return;
if ( tr.Entity is Player )
return;
CreateHitEffects( tr.EndPos );
if ( tr.Entity.IsWorld )
return;
tr.Entity.Delete();
var particle = Particles.Create( "particles/physgun_freeze.vpcf" );
particle.SetPosition( 0, tr.Entity.Position );
}
}
}
}