I see AcceptEntityOutput and HookEntityOutput on the SM API, but I don't see something like AcceptEntityOutput or HookEntityInput.
The HookEntityInput isn't too important, but what I would want to do is be able to force an entity to emit an output. In particular, in TF2, I want to trigger the trigger_capture_area's OnCapTeam* entity outputs without the control point being captured.
I found this function, CBaseEntity::FireNamedOutput and managed to find the function signature in windows. However, I have no idea what this variant_t parameter is, and passing in 0 caused a server crash (...which might not be too surprising).
So my question is, what do I pass into that variant_t parameter (which I assume is a C++ object generated when we use SetVariant* in sourcepawn?), or if there is another way, how do I trigger the entity output? Is this something that I would need a C++ extension to do and can't do with sourcepawn alone? (which would suck but it is what it is)
This is the test plugin if anyone is curious.
Spoiler
PHP Code:
public void OnPluginStart() { RegConsoleCmd("sm_test", Test);
Handle hConfig = LoadGameConfigFile("mvm_test"); if (hConfig == INVALID_HANDLE) SetFailState("Could not find gamedata file mvm_test.txt.");
StartPrepSDKCall(SDKCall_Entity); PrepSDKCall_SetFromConf(hConfig, SDKConf_Signature, "CBaseEntity::FireNamedOutput"); PrepSDKCall_AddParameter(SDKType_String, SDKPass_ByValue); PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain); PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer); PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer); PrepSDKCall_AddParameter(SDKType_Float, SDKPass_Plain); FireNamedOutput = EndPrepSDKCall(); if (FireNamedOutput == INVALID_HANDLE) SetFailState("Could not initialize call to CBaseEntity::FireNamedOutput. You need new gamedata.");
CloseHandle(hConfig); }
public Action Test(int iClient, int nArgs) { int iEnt = -1; char Name[64]; while ((iEnt = FindEntityByClassname(iEnt, "trigger_capture_area")) != -1) { GetEntPropString(iEnt, Prop_Data, "m_iName", Name, sizeof(Name)); if (!StrEqual(Name, "cap_a")) // testing this on cp_steel's point A continue;
However, I have no idea what this variant_t parameter is, and passing in 0 caused a server crash (...which might not be too surprising).
The issue is less of passing 0, but more that it's a 20(?)-byte object and you're passing 4.
I don't think that there's currently a good way to call FireOutput from SM. If you want to file a bug, we could look at something for that, or you could do it in an extension.