]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/playertemplates.qh
Merge branch 'Lyberta/GenmodFix' into Lyberta/master
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / playertemplates.qh
1 /// \file
2 /// \brief Header file that describes the player templates system.
3 /// \author Lyberta
4 /// \copyright GNU GPLv3 or any later version.
5
6 #pragma once
7
8 /// \brief Returns the full name of the player template cvar.
9 /// \param[in] template Name of the template.
10 /// \param[in] variable Name of the variable.
11 /// \return Full name of the variable.
12 string PlayerTemplate_GetFullCvarName(string template, string variable);
13
14 /// \brief Returns the name of the cvar that is used for default value.
15 /// \param[in] Name of the player template variable.
16 /// \return Name of the cvar that is used for default value.
17 string PlayerTemplate_GetDefaultCvarName(string variable);
18
19 /// \brief Returns the default floating point value of the player template
20 /// variable.
21 /// \param[in] variable Name of the variable.
22 /// \return Default floating point value of the player template variable.
23 float PlayerTemplate_GetDefaultFloatValue(string variable);
24
25 /// \brief Returns the default string value of the player template variable.
26 /// \param[in] variable Name of the variable.
27 /// \return Default string value of the player template variable.
28 string PlayerTemplate_GetDefaultStringValue(string variable);
29
30 /// \brief Gets the floating point value of the variable from the given
31 /// template.
32 /// \param[in] template Name of the template.
33 /// \param[in] variable Name of the variable.
34 /// \return Value of the variable.
35 float PlayerTemplate_GetFloatValue(string template, string variable);
36
37 /// \brief Gets the string value of the variable from the given template.
38 /// \param[in] template Name of the template.
39 /// \param[in] variable Name of the variable.
40 /// \return Value of the variable.
41 string PlayerTemplate_GetStringValue(string template, string variable);
42
43 /// \brief Gives player items according to the given template's variable.
44 /// \param[in] player Player to give items to.
45 /// \param[in] template Name of the template.
46 /// \param[in] variable Name of the variable.
47 /// \return Enum value to pass to mutator hook.
48 float PlayerTemplate_GivePlayerItem(entity player, string template,
49         string variable);
50
51 // =========================== Hook handlers =================================
52
53 /// \brief Setups the player during spawn according to the given template.
54 /// \param[in,out] player Player to setup.
55 /// \param[in] template Name of the template.
56 /// \return No return.
57 void PlayerTemplateHook_PlayerSpawn(entity player, string template);
58
59 /// \brief Forbids weapon dropping according to the given template.
60 /// \param[in] template Name of the template.
61 /// \return Value to pass to mutator hook.
62 bool PlayerTemplateHook_ForbidThrowCurrentWeapon(string template);
63
64 /// \brief Regenerates player health according to the given template.
65 /// \param[in] player Player to regenerate.
66 /// \param[in] template Name of the template.
67 /// \return Value to pass to mutator hook.
68 float PlayerTemplateHook_PlayerRegen(entity player, string template);
69
70 /// \brief Gives player items according to the given template.
71 /// \param[in,out] player Player to give items to.
72 /// \param[in] item Item which player has picked up.
73 /// \param[in] template Name of the template.
74 /// \return Enum value to pass to mutator hook.
75 float PlayerTemplateHook_ItemTouch(entity player, entity item, string template);
76
77 /// \brief Changes the damage done using templates' attack and defense scales.
78 /// \param[in] attacke Attacker entity.
79 /// \param[in] attackertemplate Template of the attacker.
80 /// \param[in] victim Victim entity.
81 /// \param[in] victimtemplate Template of the victim.
82 /// \param[in] deathtype Type of the damage.
83 /// \param[in] damage Damage to adjust.
84 /// \return Adjusted damage.
85 float PlayerTemplateHook_Damage_Calculate(entity attacker,
86         string attackertemplate, entity victim, string victimtemplate,
87         float deathtype, float damage);
88
89 /// \brief Strips the player of their weapons if the player is not allowed to
90 /// drop them.
91 /// \param[in,out] player Player to work with.
92 /// \param[in] template Name of the template.
93 /// \return No return.
94 /// \note You must hook with CBC_ORDER_FIRST in order for this to be effective.
95 void PlayerTemplateHook_PlayerDies(entity player, string template);