From 199802150bd6ae7cc3d3394fdc2b3583baeff6c1 Mon Sep 17 00:00:00 2001 From: 42 <33488710+FortyTwoFortyTwo@users.noreply.github.com> Date: Fri, 5 Jul 2019 22:37:25 +0100 Subject: [PATCH] Update TF2_IgnitePlayer to support setting duration of fire (#1038) Related to #713 --- extensions/tf2/natives.cpp | 11 +++++++++-- plugins/include/tf2.inc | 7 +++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/extensions/tf2/natives.cpp b/extensions/tf2/natives.cpp index 9495e1dd5e..fc2e366841 100644 --- a/extensions/tf2/natives.cpp +++ b/extensions/tf2/natives.cpp @@ -92,7 +92,7 @@ cell_t TF2_MakeBleed(IPluginContext *pContext, const cell_t *params) return 1; } -// native TF2_Burn(client, target) +// native TF2_Burn(client, target, duration) cell_t TF2_Burn(IPluginContext *pContext, const cell_t *params) { static ICallWrapper *pWrapper = NULL; @@ -126,10 +126,17 @@ cell_t TF2_Burn(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Client index %d is not valid", params[2]); } + float fDuration = 10.0; + // Compatibility fix for the newly-added duration + if (params[0] >= 3) + { + fDuration = sp_ctof(params[3]); + } + void *obj = (void *)((uint8_t *)pEntity + playerSharedOffset->actual_offset); ArgBuffer //duration - vstk(obj, pTarget, nullptr, 10.0f); + vstk(obj, pTarget, nullptr, fDuration); pWrapper->Execute(vstk, nullptr); return 1; diff --git a/plugins/include/tf2.inc b/plugins/include/tf2.inc index 81071e24b4..4e1e3add05 100644 --- a/plugins/include/tf2.inc +++ b/plugins/include/tf2.inc @@ -245,13 +245,16 @@ enum TFObjectMode }; /** - * Sets a client on fire for 10 seconds. + * Sets a client on fire. + * + * @note Fire duration is capped to 10 seconds. * * @param client Player's index. * @param attacker Attacker's index. + * @param duration Duration of fire (in seconds). * @error Invalid client index, client not in game, or no mod support. */ -native void TF2_IgnitePlayer(int client, int attacker); +native void TF2_IgnitePlayer(int client, int attacker, float duration=10.0); /** * Respawns a client