#include "resources.qh"
#include "mutators/events.qh"
-const string playertemplate_cvar_prefix = "g_player_template_";
+const string player_template_cvar_prefix = "g_player_template_";
string PlayerTemplate_GetFullCvarName(string template, string variable)
{
- return strcat(playertemplate_cvar_prefix, template, "_", variable);
+ return strcat(player_template_cvar_prefix, template, "_", variable);
}
string PlayerTemplate_GetDefaultCvarName(string variable)
{
return PlayerTemplate_GetDefaultFloatValue(variable);
}
- string fullname = PlayerTemplate_GetFullCvarName(template, variable);
- if (!(cvar_type(fullname) & CVAR_TYPEFLAG_EXISTS))
+ string full_name = PlayerTemplate_GetFullCvarName(template, variable);
+ if (!(cvar_type(full_name) & CVAR_TYPEFLAG_EXISTS))
{
return PlayerTemplate_GetDefaultFloatValue(variable);
}
- if (cvar_string(fullname) == "default")
+ if (cvar_string(full_name) == "default")
{
return PlayerTemplate_GetDefaultFloatValue(variable);
}
- return cvar(fullname);
+ return cvar(full_name);
}
string PlayerTemplate_GetStringValue(string template, string variable)
{
return PlayerTemplate_GetDefaultStringValue(variable);
}
- string fullname = PlayerTemplate_GetFullCvarName(template, variable);
- if (!(cvar_type(fullname) & CVAR_TYPEFLAG_EXISTS))
+ string full_name = PlayerTemplate_GetFullCvarName(template, variable);
+ if (!(cvar_type(full_name) & CVAR_TYPEFLAG_EXISTS))
{
return PlayerTemplate_GetDefaultStringValue(variable);
}
- if (cvar_string(fullname) == "default")
+ if (cvar_string(full_name) == "default")
{
return PlayerTemplate_GetDefaultStringValue(variable);
}
- return cvar_string(fullname);
+ return cvar_string(full_name);
}
float PlayerTemplate_GivePlayerItem(entity player, string template,
{
return MUT_ITEMTOUCH_CONTINUE;
}
- int numfields = tokenize_console(PlayerTemplate_GetStringValue(template,
+ int num_fields = tokenize_console(PlayerTemplate_GetStringValue(template,
variable));
- if (numfields == 0)
+ if (num_fields == 0)
{
return MUT_ITEMTOUCH_CONTINUE;
}
- for (int i = 1; i < numfields; ++i)
+ for (int i = 1; i < num_fields; ++i)
{
switch (i)
{
}
float PlayerTemplateHook_Damage_Calculate(entity attacker,
- string attackertemplate, entity victim, string victimtemplate,
- float deathtype, float damage)
+ string attacker_template, entity victim, string victim_template,
+ float death_type, float damage)
{
if (autocvar_g_instagib == 1)
{
return damage;
}
- if ((attacker == victim) && (DEATH_ISWEAPON(deathtype, WEP_BLASTER)) &&
- (PlayerTemplate_GetFloatValue(victimtemplate, "blaster_self_damage") ==
+ if ((attacker == victim) && (DEATH_ISWEAPON(death_type, WEP_BLASTER)) &&
+ (PlayerTemplate_GetFloatValue(victim_template, "blaster_self_damage") ==
0))
{
return 0;
}
- damage *= PlayerTemplate_GetFloatValue(attackertemplate, "attack_scale");
- damage /= PlayerTemplate_GetFloatValue(victimtemplate, "defense_scale");
+ damage *= PlayerTemplate_GetFloatValue(attacker_template, "attack_scale");
+ damage /= PlayerTemplate_GetFloatValue(victim_template, "defense_scale");
return damage;
}
/// \brief Setups the player during spawn according to the given template.
/// \param[in,out] player Player to setup.
/// \param[in] template Name of the template.
-/// \return No return.
void PlayerTemplateHook_PlayerSpawn(entity player, string template);
/// \brief Forbids weapon dropping according to the given template.
/// \brief Changes the damage done using templates' attack and defense scales.
/// \param[in] attacke Attacker entity.
-/// \param[in] attackertemplate Template of the attacker.
+/// \param[in] attacker_template Template of the attacker.
/// \param[in] victim Victim entity.
-/// \param[in] victimtemplate Template of the victim.
-/// \param[in] deathtype Type of the damage.
+/// \param[in] victim_template Template of the victim.
+/// \param[in] death_type Type of the damage.
/// \param[in] damage Damage to adjust.
/// \return Adjusted damage.
float PlayerTemplateHook_Damage_Calculate(entity attacker,
- string attackertemplate, entity victim, string victimtemplate,
- float deathtype, float damage);
+ string attacker_template, entity victim, string victim_template,
+ float death_type, float damage);
/// \brief Strips the player of their weapons if the player is not allowed to
/// drop them.
/// \param[in,out] player Player to work with.
/// \param[in] template Name of the template.
-/// \return No return.
/// \note You must hook with CBC_ORDER_FIRST in order for this to be effective.
void PlayerTemplateHook_PlayerDies(entity player, string template);