Entity I/O
Entity I/O system (inputs/outputs) for Source2Mod.
Provides:
- Access to entity outputs (OnTrigger, OnUse, etc.)
- Hooking system for listening to outputs
- Filtering by entity + classname + output name
Equivalent to Hammer I/O system (FireOutput / AcceptInput).
Header source2mod/schema/entityio.h
InputData_t
Data passed to inputs.
Fields
| Field | Type | Description |
|---|---|---|
pActivator | CBaseEntity* | Entity that triggered the input |
pCaller | CBaseEntity* | Entity owning the output |
value | variant_t | Passed value |
nOutputID | int |
IEntityIOListener
Interface for listening to entity outputs.
OnEntityOutput
virtual Action OnEntityOutput(const char* pchOutputName, CEntityInstance* pActivator, CEntityInstance* pCaller, float flDelay, bool post);Called when an entity fires an output.
| Parameter | Type | Description |
|---|---|---|
pchOutputName | const char* | Output name (e.g. "OnTrigger") |
pActivator | CEntityInstance* | Activator entity |
pCaller | CEntityInstance* | Caller entity |
flDelay | float | Delay before execution |
post | bool | false when called before the output fires, true after |
Returns Action — Action (Action::Ignore / Action::Override / Action::Supersede)
CSingleEntityIOListener
Listener bound to a specific entity.
Inherits IEntityIOListener
Fields
| Field | Type | Description |
|---|---|---|
m_pTarget | CEntityInstance* | |
m_Callback | std::function<Action(const char*, CEntityInstance*, CEntityInstance*, float, bool)> | Callback handler |
Constructors
CSingleEntityIOListener(CEntityInstance* target, std::function<Action(const char*, CEntityInstance*, CEntityInstance*, float, bool)> cb);OnEntityOutput
Action OnEntityOutput(const char* outputName, CEntityInstance* pActivator, CEntityInstance* pCaller, float delay, bool post) override;| Parameter | Type |
|---|---|
outputName | const char* |
pActivator | CEntityInstance* |
pCaller | CEntityInstance* |
delay | float |
post | bool |
CEntityIOListenerHandle
RAII handle for entity output listeners.
Automatically unregisters listener on destruction.
Fields
| Field | Type |
|---|---|
m_pListener | CSingleEntityIOListener* |
m_szClassname | std::string |
m_szOutput | std::string |
m_bPost | bool |
Unhook
void Unhook();Removes listener.
EntityIOCallbackPair
Stores listeners per output.
Fields
| Field | Type |
|---|---|
m_vecPre | std::vector<IEntityIOListener*> |
m_vecPost | std::vector<IEntityIOListener*> |
OutputKey
Key for output lookup.
Fields
| Field | Type |
|---|---|
m_szClassName | std::string |
m_szOutputName | std::string |
OutputKeyHash
Hash function for OutputKey.
Macros
NULL
#define NULL 0Entity I/O system (inputs/outputs) for Source2Mod.
Provides:
- Access to entity outputs (OnTrigger, OnUse, etc.)
- Hooking system for listening to outputs
- Filtering by entity + classname + output name
Equivalent to Hammer I/O system (FireOutput / AcceptInput).