mirror of
https://github.com/celisej567/gm_construct_port.git
synced 2026-01-01 09:48:13 +03:00
34 lines
570 B
C#
34 lines
570 B
C#
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();
|
|
}
|
|
}
|