]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/items.qh
Proper handling of expiring items.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / items.qh
1 #pragma once
2
3 /// \file
4 /// \brief Header file that describes the functions related to game items.
5 /// \copyright GNU GPLv2 or any later version.
6
7 /// \brief Creates a new item.
8 /// \param[in] class_name Class name of the item.
9 /// \param[in] position Position of the item.
10 /// \return Item on success, NULL otherwise.
11 entity Item_Create(string class_name, vector position);
12
13 /// \brief Initializes the item according to classname.
14 /// \param[in,out] item Item to initialize.
15 /// \param[in] class_name Class name to use.
16 /// \return No return.
17 /// \nore This function is useful if you want to set some item properties before
18 /// initialization.
19 void Item_Initialize(entity item, string class_name);
20
21 /// \brief Creates a loot item.
22 /// \param[in] class_name Class name of the item.
23 /// \param[in] position Position of the item.
24 /// \param[in] velocity of the item.
25 /// \param[in] time_to_live Amount of time after which the item will disappear.
26 /// \return Item on success, NULL otherwise.
27 entity Item_CreateLoot(string class_name, vector position, vector vel,
28         float time_to_live);
29
30 /// \brief Initializes the loot item.
31 /// \param[in] class_name Class name of the item.
32 /// \param[in] position Position of the item.
33 /// \param[in] velocity of the item.
34 /// \param[in] time_to_live Amount of time after which the item will disappear.
35 /// \return True on success, false otherwise.
36 /// \nore This function is useful if you want to set some item properties before
37 /// initialization.
38 bool Item_InitializeLoot(entity item, string class_name, vector position,
39         vector vel, float time_to_live);
40
41 /// \brief Returns whether the item is loot.
42 /// \param[in] item Item to check.
43 /// \return True if the item is loot, false otherwise.
44 bool Item_IsLoot(entity item);
45
46 /// \brief Sets the item loot status.
47 /// \param[in,out] item Item to adjust.
48 /// \param[in] loot Whether item is loot.
49 /// \return No return.
50 void Item_SetLoot(entity item, bool loot);
51
52 /// \brief Returns whether the item is expiring (i.e. its strength, shield and
53 /// superweapon timers expire while it is on the ground).
54 /// \param[in] item Item to check.
55 /// \return True if the item is expiring, false otherwise.
56 bool Item_IsExpiring(entity item);
57
58 /// \brief Sets the item expiring status (i.e. whether its strength, shield
59 /// and superweapon timers expire while it is on the ground).
60 /// \param[in,out] item Item to adjust.
61 /// \param[in] expiring Whether item is expiring.
62 /// \return No return.
63 void Item_SetExpiring(entity item, bool expiring);