mirror of
https://github.com/celisej567/gm_construct_port.git
synced 2026-01-04 02:10:11 +03:00
34 lines
558 B
C#
34 lines
558 B
C#
using Sandbox;
|
|
|
|
[Library( "ent_lamp", Title = "Lamp", Spawnable = true )]
|
|
public partial class LampEntity : SpotLightEntity, IUse
|
|
{
|
|
public override void Spawn()
|
|
{
|
|
base.Spawn();
|
|
|
|
SetModel( "models/torch/torch.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();
|
|
}
|
|
}
|