Skip to content

Update TF2_IgnitePlayer to support set duration of fire#1038

Merged
asherkin merged 3 commits intoalliedmodders:masterfrom
FortyTwoFortyTwo:fire-duration
Jul 5, 2019
Merged

Update TF2_IgnitePlayer to support set duration of fire#1038
asherkin merged 3 commits intoalliedmodders:masterfrom
FortyTwoFortyTwo:fire-duration

Conversation

@FortyTwoFortyTwo
Copy link
Contributor

See #713

This PR adds 3rd param TF2_IgnitePlayer to allow set duration of fire, while default value kept as 10.0 so older plugins should not break.

However when i tested this, i found out fire duration is capped to 10.0 seconds, even when tempted to set higher than 10. I believe this is valve's shitty fix on infinite fire duration from some weapons, which is really unfortunate. May still be helpful to some plugins when setting fire less than 10 seconds.

Example code when testing this, setting yourself on fire with duration.

#include <sourcemod>
#include <tf2>

public void OnPluginStart()
{
	RegConsoleCmd("sm_fire", Command_Fire);
}

public Action Command_Fire(int iClient, int iArgs)
{
	if (GetCmdArgs() == 0)
	{
		TF2_IgnitePlayer(iClient, iClient);
	}
	else
	{
		char sBuffer[4];
		GetCmdArg(1, sBuffer, sizeof(sBuffer));
		float flDuration = StringToFloat(sBuffer);
		TF2_IgnitePlayer(iClient, iClient, flDuration);
	}
	return Plugin_Handled;
}

@MitchDizzle
Copy link

MitchDizzle commented Jul 5, 2019

This is a non-passive change since you're not adding a new function, you're editing an existing one which can break compiling plugins that use it.

@psychonic
Copy link
Member

It won't break compilation of existing code since the new parameter is being added with a default value. Plugins that don't have the new argument specified will implicitly use the default.

@MitchDizzle
Copy link

My bad, definitely didn't see the default value.

@FortyTwoFortyTwo
Copy link
Contributor Author

oops new to those stuff, hopefully i did this correctly

@asherkin asherkin merged commit 1998021 into alliedmodders:master Jul 5, 2019
@asherkin
Copy link
Member

asherkin commented Jul 5, 2019

Thanks for the contribution!

@FortyTwoFortyTwo FortyTwoFortyTwo deleted the fire-duration branch July 5, 2019 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants