set g_player_template_example_random_start_rockets "default" "How much rockets does the player get with random start rocket-based weapon"
set g_player_template_example_random_start_cells "default" "How much cells does the player get with random start cell-based weapon"
+set g_player_template_example_drop_weapons "default" "Whether the player can drop weapons by throwing them or by dying"
+
// Item pickup section
// Variables in this section define what happens during item pickup.
// Player can get health, armor and/or ammo on top of or instead of an item.
{
return "g_random_start_plasma";
}
+ case "drop_weapons":
+ {
+ return "g_weapon_throwable";
+ }
case "health_regen_factor":
{
return "g_balance_health_regen";
case "random_start_rockets":
case "random_start_cells":
case "random_start_plasma":
+ case "drop_weapons":
case "health_regen_factor":
case "health_regen_linear":
case "health_rot_factor":
}
}
+bool PlayerTemplate_ForbidThrowCurrentWeapon(string template)
+{
+ return !PlayerTemplate_GetFloatValue(template, "drop_weapons");
+}
+
float PlayerTemplate_PlayerRegen(entity player, string template)
{
if (template == "default")
damage /= PlayerTemplate_GetFloatValue(victimtemplate, "defense_scale");
return damage;
}
+
+void PlayerTemplate_PlayerDies(entity player, string template)
+{
+ if (template == "default")
+ {
+ return;
+ }
+ if (PlayerTemplate_GetFloatValue(template, "drop_weapons"))
+ {
+ return;
+ }
+ player.weapons = WEPSET(Null);
+}
// =========================== Hook handlers =================================
/// \brief Setups the player during spawn according to the given template.
-/// \param[in] player Player to setup.
+/// \param[in,out] player Player to setup.
/// \param[in] template Name of the template.
/// \return No return.
void PlayerTemplate_PlayerSpawn(entity player, string template);
+/// \brief Forbids weapon dropping according to the given template.
+/// \param[in] template Name of the template.
+/// \return Value to pass to mutator hook.
+bool PlayerTemplate_ForbidThrowCurrentWeapon(string template);
+
/// \brief Regenerates player health according to the given template.
/// \param[in] player Player to regenerate.
/// \param[in] template Name of the template.
float PlayerTemplate_PlayerRegen(entity player, string template);
/// \brief Gives player items according to the given template.
-/// \param[in] player Player to give items to.
+/// \param[in,out] player Player to give items to.
/// \param[in] item Item which player has picked up.
/// \param[in] template Name of the template.
/// \return Enum value to pass to mutator hook.
/// \return Adjusted damage.
float PlayerTemplate_Damage_Calculate(entity attacker, string attackertemplate,
entity victim, string victimtemplate, float deathtype, 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 PlayerTemplate_PlayerDies(entity player, string template);