mirror of
https://github.com/celisej567/gm_construct_port.git
synced 2026-09-19 20:11:46 +03:00
Add files via upload
This commit is contained in:
33
code/entities/LightEntity.cs
Normal file
33
code/entities/LightEntity.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Sandbox;
|
||||
|
||||
[Library( "ent_light", Title = "Light", Spawnable = true )]
|
||||
public partial class LightEntity : PointLightEntity, IUse
|
||||
{
|
||||
public override void Spawn()
|
||||
{
|
||||
base.Spawn();
|
||||
|
||||
SetModel( "models/light/light_tubular.vmdl" );
|
||||
SetupPhysicsFromModel( PhysicsMotionType.Dynamic, false );
|
||||
}
|
||||
|
||||
public bool IsUsable( Entity user )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool OnUse( Entity user )
|
||||
{
|
||||
Enabled = !Enabled;
|
||||
|
||||
PlaySound( Enabled ? "flashlight-on" : "flashlight-off" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
PhysicsGroup?.Wake();
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user