4 /// \brief Header file that describes the functions related to game items.
5 /// \copyright GNU GPLv2 or any later version.
9 /// \brief Returns the item definition corresponding to the given class name.
10 /// \param[in] class_name Class name to search for.
11 /// \return Item definition corresponding to the given class name or NULL is not
13 entity Item_FindDefinition(string class_name);
15 /// \brief Returns the item definition corresponding to the given internal name.
16 /// \param[in] item_name Internal netname to search for.
17 /// \return Item definition corresponding to the given internal name or NULL is not
19 entity Item_DefinitionFromInternalName(string item_name);
21 /// \brief Checks whether the items with the specified class name are allowed to
23 /// \param[in] class_name Item class name to check.
24 /// \return True items with the specified class name are allowed to spawn, false
26 bool Item_IsAllowed(string class_name);
28 /// \brief Checks whether the items with the specified definition are allowed to
30 /// \param[in] definition Item definition to check.
31 /// \return True items with the specified definition are allowed to spawn, false
33 bool Item_IsDefinitionAllowed(entity definition);
35 /// \brief Creates a new item.
36 /// \param[in] class_name Class name of the item.
37 /// \param[in] position Position of the item.
38 /// \param[in] no_align True if item should be placed directly at specified
39 /// position, false to let it drop to the ground.
40 /// \return Item on success, NULL otherwise.
41 entity Item_Create(string class_name, vector position, bool no_align);
43 /// \brief Initializes the item according to class name.
44 /// \param[in,out] item Item to initialize.
45 /// \param[in] class_name Class name to use.
46 /// \return No return.
47 /// \nore This function is useful if you want to set some item properties before
49 void Item_Initialize(entity item, string class_name);
51 /// \brief Creates a loot item.
52 /// \param[in] class_name Class name of the item.
53 /// \param[in] position Position of the item.
54 /// \param[in] velocity of the item.
55 /// \param[in] time_to_live Amount of time after which the item will disappear.
56 /// \return Item on success, NULL otherwise.
57 entity Item_CreateLoot(string class_name, vector position, vector vel,
60 /// \brief Initializes the loot item.
61 /// \param[in] class_name Class name of the item.
62 /// \param[in] position Position of the item.
63 /// \param[in] velocity of the item.
64 /// \param[in] time_to_live Amount of time after which the item will disappear.
65 /// \return True on success, false otherwise.
66 /// \nore This function is useful if you want to set some item properties before
68 bool Item_InitializeLoot(entity item, string class_name, vector position,
69 vector vel, float time_to_live);
71 /// \brief Returns whether the item is loot.
72 /// \param[in] item Item to check.
73 /// \return True if the item is loot, false otherwise.
74 bool Item_IsLoot(entity item);
76 /// \brief Sets the item loot status.
77 /// \param[in,out] item Item to adjust.
78 /// \param[in] loot Whether item is loot.
79 /// \return No return.
80 void Item_SetLoot(entity item, bool loot);
82 /// \brief Returns whether item should keep its position or be dropped to the
84 /// \param[in] item Item to check.
85 /// \return True if item should keep its position or false if it should be
86 /// dropped to the ground.
87 bool Item_ShouldKeepPosition(entity item);
89 /// \brief Returns whether the item is expiring (i.e. its strength, shield and
90 /// superweapon timers expire while it is on the ground).
91 /// \param[in] item Item to check.
92 /// \return True if the item is expiring, false otherwise.
93 bool Item_IsExpiring(entity item);
95 /// \brief Sets the item expiring status (i.e. whether its strength, shield
96 /// and superweapon timers expire while it is on the ground).
97 /// \param[in,out] item Item to adjust.
98 /// \param[in] expiring Whether item is expiring.
99 /// \return No return.
100 void Item_SetExpiring(entity item, bool expiring);