Skip to content

Commit 1998021

Browse files
FortyTwoFortyTwoasherkin
authored andcommitted
Update TF2_IgnitePlayer to support setting duration of fire (#1038)
Related to #713
1 parent e47c1a8 commit 1998021

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

extensions/tf2/natives.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ cell_t TF2_MakeBleed(IPluginContext *pContext, const cell_t *params)
9292
return 1;
9393
}
9494

95-
// native TF2_Burn(client, target)
95+
// native TF2_Burn(client, target, duration)
9696
cell_t TF2_Burn(IPluginContext *pContext, const cell_t *params)
9797
{
9898
static ICallWrapper *pWrapper = NULL;
@@ -126,10 +126,17 @@ cell_t TF2_Burn(IPluginContext *pContext, const cell_t *params)
126126
return pContext->ThrowNativeError("Client index %d is not valid", params[2]);
127127
}
128128

129+
float fDuration = 10.0;
130+
// Compatibility fix for the newly-added duration
131+
if (params[0] >= 3)
132+
{
133+
fDuration = sp_ctof(params[3]);
134+
}
135+
129136
void *obj = (void *)((uint8_t *)pEntity + playerSharedOffset->actual_offset);
130137
ArgBuffer<void*, CBaseEntity*, CBaseEntity*,
131138
float> //duration
132-
vstk(obj, pTarget, nullptr, 10.0f);
139+
vstk(obj, pTarget, nullptr, fDuration);
133140

134141
pWrapper->Execute(vstk, nullptr);
135142
return 1;

plugins/include/tf2.inc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,16 @@ enum TFObjectMode
245245
};
246246

247247
/**
248-
* Sets a client on fire for 10 seconds.
248+
* Sets a client on fire.
249+
*
250+
* @note Fire duration is capped to 10 seconds.
249251
*
250252
* @param client Player's index.
251253
* @param attacker Attacker's index.
254+
* @param duration Duration of fire (in seconds).
252255
* @error Invalid client index, client not in game, or no mod support.
253256
*/
254-
native void TF2_IgnitePlayer(int client, int attacker);
257+
native void TF2_IgnitePlayer(int client, int attacker, float duration=10.0);
255258

256259
/**
257260
* Respawns a client

0 commit comments

Comments
 (0)