USE'ing entities with USE_ type

Facepunch, I’m coding an entity in Lua and I need help.

The entity I’m making is placed by Valve on their maps and it USEs another entity, but it doesn’t have outputs, instead it has HL1-style target.

Mostly the target of my entity is light_spot, and I can fire inputs TurnOn and TurnOff, but sometimes it is not, so I have to USE it.

Firing a simple Use on light_spot causes the light_spot to turn on, but not to turn off. The action what light_spot should do when USEd depends on USE_type (enumerations USE_OFF, USE_ON, USE_SET and USE_TOGGLE).

Light_spot USE code:
void CLight::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if (m_iStyle >= 32) { if ( !ShouldToggle( useType, !FBitSet(m_spawnflags, SF_LIGHT_START_OFF) ) ) return; Toggle(); } } Question: How can I USE stock entity (coded in C++) with passing USE_type?

Picture explanation: http://i54.tinypic.com/2n16qg4.png

EDIT: I checked all xen_plantlight entities and they target only to light and light_spot. But I still want an answer.

This might be some use to you, Also did you add the light in the map? with the TurnOn and TurnOff in the light key values entity?

You might be able to do something like:



that:SetUseType( USE_OFF )
that:Input( "Use", ent, activator )


But I don’t know if that would do what you wanted.