# HG changeset patch # User FlaminSarge # Date 1363471522 14400 # Node ID f25d64a5cd7a04b90822cdc77589aac3bbb7881f # Parent 87d44c16b4d2a0ff7886d79282bd64a9b4fcbb83 Exposed third parameter of TF2's AddCond in TF2_AddCondition (bug 5641, r=psychonic). diff -r 87d44c16b4d2 -r f25d64a5cd7a extensions/tf2/natives.cpp --- a/extensions/tf2/natives.cpp Sat Mar 16 14:11:56 2013 -0400 +++ b/extensions/tf2/natives.cpp Sat Mar 16 18:05:22 2013 -0400 @@ -236,7 +236,7 @@ { static ICallWrapper *pWrapper = NULL; - // CTFPlayerShared::AddCond(int, float) + // CTFPlayerShared::AddCond(int, float, CBaseEntity *) if (!pWrapper) { REGISTER_NATIVE_ADDR("AddCondition", @@ -259,6 +259,13 @@ return pContext->ThrowNativeError("Client index %d is not valid", params[1]); } + CBaseEntity *pInflictor = NULL; + // Compatibility fix for the new inflictor parameter; TF2 seems to only use player entities in it + if (params[0] >= 4 && params[4] > 0 && !(pInflictor = UTIL_GetCBaseEntity(params[4], true))) + { + return pContext->ThrowNativeError("Inflictor index %d is not valid", params[4]); + } + void *obj = (void *)((uint8_t *)pEntity + playerSharedOffset->actual_offset); unsigned char vstk[sizeof(void *) + sizeof(int) + sizeof(float) + sizeof(CBaseEntity *)]; @@ -270,7 +277,7 @@ vptr += sizeof(int); *(float *)vptr = *(float *)¶ms[3]; vptr += sizeof(float); - *(CBaseEntity **)vptr = NULL; + *(CBaseEntity **)vptr = pInflictor; pWrapper->Execute(vstk, NULL); diff -r 87d44c16b4d2 -r f25d64a5cd7a plugins/include/tf2.inc --- a/plugins/include/tf2.inc Sat Mar 16 14:11:56 2013 -0400 +++ b/plugins/include/tf2.inc Sat Mar 16 18:05:22 2013 -0400 @@ -202,10 +202,11 @@ * @param client Player's index. * @param condition Integer identifier of condition to apply. * @param duration Duration of condition (does not apply to all conditions). + * @param inflictor Condition inflictor's index (0 for no inflictor). * @noreturn * @error Invalid client index, client not in game, or no mod support. */ -native TF2_AddCondition(client, TFCond:condition, Float:duration); +native TF2_AddCondition(client, TFCond:condition, Float:duration, inflictor=0); /** * Removes a condition from a player