]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/items/spawning.qh
Add a more optimised and generic function to initialise items (loot or permanent)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / items / spawning.qh
index b52449e7158dffab62269d6b17d32a6a7cdcc439..4915830ab02d83a83345ef68b1a660941a8342cc 100644 (file)
@@ -6,12 +6,21 @@
 
 bool startitem_failed;
 
+/// \brief lifetime < 0 means permanent (not loot), lifetime > 0 overrides the default
+.float lifetime;
+
 /// \brief Returns the item definition corresponding to the given class name.
 /// \param[in] class_name Class name to search for.
 /// \return Item definition corresponding to the given class name or NULL is not
 /// found.
 entity Item_FindDefinition(string class_name);
 
+/// \brief Returns the item definition corresponding to the given internal name.
+/// \param[in] item_name Internal netname to search for.
+/// \return Item definition corresponding to the given internal name or NULL is not
+/// found.
+entity Item_DefinitionFromInternalName(string item_name);
+
 /// \brief Checks whether the items with the specified class name are allowed to
 /// spawn.
 /// \param[in] class_name Item class name to check.
@@ -62,6 +71,15 @@ entity Item_CreateLoot(string class_name, vector position, vector vel,
 bool Item_InitializeLoot(entity item, string class_name, vector position,
        vector vel, float time_to_live);
 
+/// \brief An optimised and generic way to initialise items (loot or permanent)
+/// \param[in] item The item entity to initialise
+/// \return True on success, false otherwise.
+/// \nore required field: itemdef (faster, preferred) OR classname
+/// optional fields: origin, velocity, lifetime, noalign
+/// lifetime < 0 means permanent (not loot), lifetime > 0 overrides the default
+/// permanent items only: noalign means the item is suspended (won't drop to floor)
+bool Item_Initialise(entity item);
+
 /// \brief Returns whether the item is loot.
 /// \param[in] item Item to check.
 /// \return True if the item is loot, false otherwise.