#include <server/race.qh>
#include <server/gamelog.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
float autocvar_g_cts_finish_kill_delay;
bool autocvar_g_cts_selfdamage;
#endif
#ifdef SVQC
-#include <server/items.qh>
+#include <server/items/spawning.qh>
#endif
const int IT_UNLIMITED_AMMO = BIT(0); // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
#include "config.qh"
#include <server/weapons/csqcprojectile.qh>
#include <server/weapons/tracing.qh>
- #include "../items.qh"
+ #include <server/items/spawning.qh>
#include <server/autocvars.qh>
#include <server/constants.qh>
#include <server/defs.qh>
#include <server/handicap.qc>
#include <server/impulse.qc>
#include <server/ipban.qc>
-#include <server/items.qc>
#include <server/mapvoting.qc>
#include <server/matrix.qc>
#include <server/miscfunctions.qc>
#include <server/bot/_mod.inc>
#include <server/command/_mod.inc>
#include <server/compat/_mod.inc>
+#include <server/items/_mod.inc>
#include <server/mutators/_mod.inc>
#include <server/pathlib/_mod.inc>
#include <server/weapons/_mod.inc>
#include <server/handicap.qh>
#include <server/impulse.qh>
#include <server/ipban.qh>
-#include <server/items.qh>
#include <server/mapvoting.qh>
#include <server/matrix.qh>
#include <server/miscfunctions.qh>
#include <server/bot/_mod.qh>
#include <server/command/_mod.qh>
#include <server/compat/_mod.qh>
+#include <server/items/_mod.qh>
#include <server/mutators/_mod.qh>
#include <server/pathlib/_mod.qh>
#include <server/weapons/_mod.qh>
#include <server/defs.qh>
#include <server/miscfunctions.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
#include <server/resources.qh>
#include "havocbot.qh"
#include <server/defs.qh>
#include <server/miscfunctions.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
#include <server/resources.qh>
#include <common/gamemodes/_mod.qh>
#include <common/items.qh>
#include <server/defs.qh>
#include <server/miscfunctions.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
#include <common/weapons/_all.qh>
spawnfunc(item_haste);
+++ /dev/null
-#include "items.qh"
-
-/// \file
-/// \brief Source file that contains implementation of the functions related to
-/// game items.
-/// \copyright GNU GPLv2 or any later version.
-
-#include <server/mutators/_mod.qh>
-#include <common/weapons/all.qh>
-#include <common/mapobjects/subs.qh>
-
-.bool m_isloot; ///< Holds whether item is loot.
-/// \brief Holds whether strength, shield or superweapon timers expire while
-/// this item is on the ground.
-.bool m_isexpiring;
-
-entity Item_FindDefinition(string class_name)
-{
- FOREACH(Items, it.m_canonical_spawnfunc == class_name,
- {
- return it;
- });
- FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
- {
- return it.m_pickup;
- });
- return NULL;
-}
-
-bool Item_IsAllowed(string class_name)
-{
- entity definition = Item_FindDefinition(class_name);
- if (definition == NULL)
- {
- return false;
- }
- return Item_IsDefinitionAllowed(definition);
-}
-
-bool Item_IsDefinitionAllowed(entity definition)
-{
- return !MUTATOR_CALLHOOK(FilterItemDefinition, definition);
-}
-
-entity Item_Create(string class_name, vector position, bool no_align)
-{
- entity item = spawn();
- item.classname = class_name;
- item.spawnfunc_checked = true;
- setorigin(item, position);
- item.noalign = no_align;
- Item_Initialize(item, class_name);
- if (wasfreed(item))
- {
- return NULL;
- }
- return item;
-}
-
-void Item_Initialize(entity item, string class_name)
-{
- FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
- {
- weapon_defaultspawnfunc(item, it);
- return;
- });
- FOREACH(Items, it.m_canonical_spawnfunc == class_name,
- {
- StartItem(item, it);
- return;
- });
- LOG_FATALF("Item_Initialize: Invalid classname: %s", class_name);
-}
-
-entity Item_CreateLoot(string class_name, vector position, vector vel,
- float time_to_live)
-{
- entity item = spawn();
- if (!Item_InitializeLoot(item, class_name, position, vel, time_to_live))
- {
- return NULL;
- }
- return item;
-}
-
-bool Item_InitializeLoot(entity item, string class_name, vector position,
- vector vel, float time_to_live)
-{
- item.classname = class_name;
- Item_SetLoot(item, true);
- item.noalign = true;
- setorigin(item, position);
- item.pickup_anyway = true;
- item.spawnfunc_checked = true;
- Item_Initialize(item, class_name);
- if (wasfreed(item))
- {
- return false;
- }
- item.gravity = 1;
- item.velocity = vel;
- SUB_SetFade(item, time + time_to_live, 1);
- return true;
-}
-
-bool Item_IsLoot(entity item)
-{
- return item.m_isloot || item.classname == "droppedweapon";
-}
-
-void Item_SetLoot(entity item, bool loot)
-{
- item.m_isloot = loot;
-}
-
-bool Item_ShouldKeepPosition(entity item)
-{
- return item.noalign || (item.spawnflags & 1);
-}
-
-bool Item_IsExpiring(entity item)
-{
- return item.m_isexpiring;
-}
-
-void Item_SetExpiring(entity item, bool expiring)
-{
- item.m_isexpiring = expiring;
-}
-
-// Compatibility spawn functions
-
-// FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-SPAWNFUNC_ITEM(item_armor1, ITEM_ArmorSmall)
-
-SPAWNFUNC_ITEM(item_armor25, ITEM_ArmorMega)
-
-SPAWNFUNC_ITEM(item_armor_large, ITEM_ArmorMega)
-
-SPAWNFUNC_ITEM(item_health1, ITEM_HealthSmall)
-
-SPAWNFUNC_ITEM(item_health25, ITEM_HealthMedium)
-
-SPAWNFUNC_ITEM(item_health_large, ITEM_HealthBig)
-
-SPAWNFUNC_ITEM(item_health100, ITEM_HealthMega)
-
-SPAWNFUNC_ITEM(item_quad, ITEM_Strength)
+++ /dev/null
-#pragma once
-
-/// \file
-/// \brief Header file that describes the functions related to game items.
-/// \copyright GNU GPLv2 or any later version.
-
-bool startitem_failed;
-
-/// \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 Checks whether the items with the specified class name are allowed to
-/// spawn.
-/// \param[in] class_name Item class name to check.
-/// \return True items with the specified class name are allowed to spawn, false
-/// otherwise.
-bool Item_IsAllowed(string class_name);
-
-/// \brief Checks whether the items with the specified definition are allowed to
-/// spawn.
-/// \param[in] definition Item definition to check.
-/// \return True items with the specified definition are allowed to spawn, false
-/// otherwise.
-bool Item_IsDefinitionAllowed(entity definition);
-
-/// \brief Creates a new item.
-/// \param[in] class_name Class name of the item.
-/// \param[in] position Position of the item.
-/// \param[in] no_align True if item should be placed directly at specified
-/// position, false to let it drop to the ground.
-/// \return Item on success, NULL otherwise.
-entity Item_Create(string class_name, vector position, bool no_align);
-
-/// \brief Initializes the item according to class name.
-/// \param[in,out] item Item to initialize.
-/// \param[in] class_name Class name to use.
-/// \return No return.
-/// \nore This function is useful if you want to set some item properties before
-/// initialization.
-void Item_Initialize(entity item, string class_name);
-
-/// \brief Creates a loot item.
-/// \param[in] class_name Class name of the item.
-/// \param[in] position Position of the item.
-/// \param[in] velocity of the item.
-/// \param[in] time_to_live Amount of time after which the item will disappear.
-/// \return Item on success, NULL otherwise.
-entity Item_CreateLoot(string class_name, vector position, vector vel,
- float time_to_live);
-
-/// \brief Initializes the loot item.
-/// \param[in] class_name Class name of the item.
-/// \param[in] position Position of the item.
-/// \param[in] velocity of the item.
-/// \param[in] time_to_live Amount of time after which the item will disappear.
-/// \return True on success, false otherwise.
-/// \nore This function is useful if you want to set some item properties before
-/// initialization.
-bool Item_InitializeLoot(entity item, string class_name, vector position,
- vector vel, float time_to_live);
-
-/// \brief Returns whether the item is loot.
-/// \param[in] item Item to check.
-/// \return True if the item is loot, false otherwise.
-bool Item_IsLoot(entity item);
-
-/// \brief Sets the item loot status.
-/// \param[in,out] item Item to adjust.
-/// \param[in] loot Whether item is loot.
-/// \return No return.
-void Item_SetLoot(entity item, bool loot);
-
-/// \brief Returns whether item should keep its position or be dropped to the
-/// ground.
-/// \param[in] item Item to check.
-/// \return True if item should keep its position or false if it should be
-/// dropped to the ground.
-bool Item_ShouldKeepPosition(entity item);
-
-/// \brief Returns whether the item is expiring (i.e. its strength, shield and
-/// superweapon timers expire while it is on the ground).
-/// \param[in] item Item to check.
-/// \return True if the item is expiring, false otherwise.
-bool Item_IsExpiring(entity item);
-
-/// \brief Sets the item expiring status (i.e. whether its strength, shield
-/// and superweapon timers expire while it is on the ground).
-/// \param[in,out] item Item to adjust.
-/// \param[in] expiring Whether item is expiring.
-/// \return No return.
-void Item_SetExpiring(entity item, bool expiring);
--- /dev/null
+// generated file; do not modify
+#include <server/items/spawning.qc>
--- /dev/null
+// generated file; do not modify
+#include <server/items/spawning.qh>
--- /dev/null
+#include "spawning.qh"
+
+/// \file
+/// \brief Source file that contains implementation of the functions related to
+/// creation of game items.
+/// \copyright GNU GPLv2 or any later version.
+
+#include <server/mutators/_mod.qh>
+#include <common/weapons/all.qh>
+#include <common/mapobjects/subs.qh>
+
+.bool m_isloot; ///< Holds whether item is loot.
+/// \brief Holds whether strength, shield or superweapon timers expire while
+/// this item is on the ground.
+.bool m_isexpiring;
+
+entity Item_FindDefinition(string class_name)
+{
+ FOREACH(Items, it.m_canonical_spawnfunc == class_name,
+ {
+ return it;
+ });
+ FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
+ {
+ return it.m_pickup;
+ });
+ return NULL;
+}
+
+bool Item_IsAllowed(string class_name)
+{
+ entity definition = Item_FindDefinition(class_name);
+ if (definition == NULL)
+ {
+ return false;
+ }
+ return Item_IsDefinitionAllowed(definition);
+}
+
+bool Item_IsDefinitionAllowed(entity definition)
+{
+ return !MUTATOR_CALLHOOK(FilterItemDefinition, definition);
+}
+
+entity Item_Create(string class_name, vector position, bool no_align)
+{
+ entity item = spawn();
+ item.classname = class_name;
+ item.spawnfunc_checked = true;
+ setorigin(item, position);
+ item.noalign = no_align;
+ Item_Initialize(item, class_name);
+ if (wasfreed(item))
+ {
+ return NULL;
+ }
+ return item;
+}
+
+void Item_Initialize(entity item, string class_name)
+{
+ FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
+ {
+ weapon_defaultspawnfunc(item, it);
+ return;
+ });
+ FOREACH(Items, it.m_canonical_spawnfunc == class_name,
+ {
+ StartItem(item, it);
+ return;
+ });
+ LOG_FATALF("Item_Initialize: Invalid classname: %s", class_name);
+}
+
+entity Item_CreateLoot(string class_name, vector position, vector vel,
+ float time_to_live)
+{
+ entity item = spawn();
+ if (!Item_InitializeLoot(item, class_name, position, vel, time_to_live))
+ {
+ return NULL;
+ }
+ return item;
+}
+
+bool Item_InitializeLoot(entity item, string class_name, vector position,
+ vector vel, float time_to_live)
+{
+ item.classname = class_name;
+ Item_SetLoot(item, true);
+ item.noalign = true;
+ setorigin(item, position);
+ item.pickup_anyway = true;
+ item.spawnfunc_checked = true;
+ Item_Initialize(item, class_name);
+ if (wasfreed(item))
+ {
+ return false;
+ }
+ item.gravity = 1;
+ item.velocity = vel;
+ SUB_SetFade(item, time + time_to_live, 1);
+ return true;
+}
+
+bool Item_IsLoot(entity item)
+{
+ return item.m_isloot || item.classname == "droppedweapon";
+}
+
+void Item_SetLoot(entity item, bool loot)
+{
+ item.m_isloot = loot;
+}
+
+bool Item_ShouldKeepPosition(entity item)
+{
+ return item.noalign || (item.spawnflags & 1);
+}
+
+bool Item_IsExpiring(entity item)
+{
+ return item.m_isexpiring;
+}
+
+void Item_SetExpiring(entity item, bool expiring)
+{
+ item.m_isexpiring = expiring;
+}
+
+// Compatibility spawn functions
+
+// FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
+SPAWNFUNC_ITEM(item_armor1, ITEM_ArmorSmall)
+
+SPAWNFUNC_ITEM(item_armor25, ITEM_ArmorMega)
+
+SPAWNFUNC_ITEM(item_armor_large, ITEM_ArmorMega)
+
+SPAWNFUNC_ITEM(item_health1, ITEM_HealthSmall)
+
+SPAWNFUNC_ITEM(item_health25, ITEM_HealthMedium)
+
+SPAWNFUNC_ITEM(item_health_large, ITEM_HealthBig)
+
+SPAWNFUNC_ITEM(item_health100, ITEM_HealthMega)
+
+SPAWNFUNC_ITEM(item_quad, ITEM_Strength)
--- /dev/null
+#pragma once
+
+/// \file
+/// \brief Header file that describes the functions related to game items.
+/// \copyright GNU GPLv2 or any later version.
+
+bool startitem_failed;
+
+/// \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 Checks whether the items with the specified class name are allowed to
+/// spawn.
+/// \param[in] class_name Item class name to check.
+/// \return True items with the specified class name are allowed to spawn, false
+/// otherwise.
+bool Item_IsAllowed(string class_name);
+
+/// \brief Checks whether the items with the specified definition are allowed to
+/// spawn.
+/// \param[in] definition Item definition to check.
+/// \return True items with the specified definition are allowed to spawn, false
+/// otherwise.
+bool Item_IsDefinitionAllowed(entity definition);
+
+/// \brief Creates a new item.
+/// \param[in] class_name Class name of the item.
+/// \param[in] position Position of the item.
+/// \param[in] no_align True if item should be placed directly at specified
+/// position, false to let it drop to the ground.
+/// \return Item on success, NULL otherwise.
+entity Item_Create(string class_name, vector position, bool no_align);
+
+/// \brief Initializes the item according to class name.
+/// \param[in,out] item Item to initialize.
+/// \param[in] class_name Class name to use.
+/// \return No return.
+/// \nore This function is useful if you want to set some item properties before
+/// initialization.
+void Item_Initialize(entity item, string class_name);
+
+/// \brief Creates a loot item.
+/// \param[in] class_name Class name of the item.
+/// \param[in] position Position of the item.
+/// \param[in] velocity of the item.
+/// \param[in] time_to_live Amount of time after which the item will disappear.
+/// \return Item on success, NULL otherwise.
+entity Item_CreateLoot(string class_name, vector position, vector vel,
+ float time_to_live);
+
+/// \brief Initializes the loot item.
+/// \param[in] class_name Class name of the item.
+/// \param[in] position Position of the item.
+/// \param[in] velocity of the item.
+/// \param[in] time_to_live Amount of time after which the item will disappear.
+/// \return True on success, false otherwise.
+/// \nore This function is useful if you want to set some item properties before
+/// initialization.
+bool Item_InitializeLoot(entity item, string class_name, vector position,
+ vector vel, float time_to_live);
+
+/// \brief Returns whether the item is loot.
+/// \param[in] item Item to check.
+/// \return True if the item is loot, false otherwise.
+bool Item_IsLoot(entity item);
+
+/// \brief Sets the item loot status.
+/// \param[in,out] item Item to adjust.
+/// \param[in] loot Whether item is loot.
+/// \return No return.
+void Item_SetLoot(entity item, bool loot);
+
+/// \brief Returns whether item should keep its position or be dropped to the
+/// ground.
+/// \param[in] item Item to check.
+/// \return True if item should keep its position or false if it should be
+/// dropped to the ground.
+bool Item_ShouldKeepPosition(entity item);
+
+/// \brief Returns whether the item is expiring (i.e. its strength, shield and
+/// superweapon timers expire while it is on the ground).
+/// \param[in] item Item to check.
+/// \return True if the item is expiring, false otherwise.
+bool Item_IsExpiring(entity item);
+
+/// \brief Sets the item expiring status (i.e. whether its strength, shield
+/// and superweapon timers expire while it is on the ground).
+/// \param[in,out] item Item to adjust.
+/// \param[in] expiring Whether item is expiring.
+/// \return No return.
+void Item_SetExpiring(entity item, bool expiring);
#include "../common/items.qh"
#include "mapvoting.qh"
#include "resources.qh"
-#include "items.qh"
+#include <server/items/spawning.qh>
#include "player.qh"
#include "weapons/accuracy.qh"
#include "weapons/csqcprojectile.qh"
#include "weaponsystem.qh"
#include <common/items.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
#include <common/constants.qh>
#include <common/net_linked.qh>
#include <common/util.qh>
#include "../resources.qh"
#include <server/mutators/_mod.qh>
#include <common/items.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
#include <common/weapons/_all.qh>
.bool m_isreplaced; ///< Holds whether the weapon has been replaced.
#include "weaponsystem.qh"
#include "../resources.qh"
-#include "../items.qh"
+#include <server/items/spawning.qh>
#include <server/mutators/_mod.qh>
#include <common/items.qh>
#include "../g_damage.qh"