From: Lyberta Date: Sat, 25 Nov 2017 02:06:45 +0000 (+0300) Subject: Added no_align option to Item_Create. X-Git-Tag: xonotic-v0.8.5~2426^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2a94d3eb1427c1eea158f728c64b87a2d44b3674;p=xonotic%2Fxonotic-data.pk3dir.git Added no_align option to Item_Create. --- diff --git a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc index 43ff0a5e3..b4a15fb80 100644 --- a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc +++ b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc @@ -222,7 +222,7 @@ entity RandomItems_ReplaceMapItem(entity item) entity new_item; if (!expr_evaluate(autocvar_g_overkill)) { - new_item = Item_Create(strzone(new_classname), item.origin); + new_item = Item_Create(strzone(new_classname), item.origin, true); random_items_is_spawning = false; if (new_item == NULL) { diff --git a/qcsrc/server/items.qc b/qcsrc/server/items.qc index 0bbf499b5..29a8609bc 100644 --- a/qcsrc/server/items.qc +++ b/qcsrc/server/items.qc @@ -13,12 +13,13 @@ /// this item is on the ground. .bool m_isexpiring; -entity Item_Create(string class_name, vector position) +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)) { diff --git a/qcsrc/server/items.qh b/qcsrc/server/items.qh index a1e3a3131..af55eebd4 100644 --- a/qcsrc/server/items.qh +++ b/qcsrc/server/items.qh @@ -7,8 +7,10 @@ /// \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); +entity Item_Create(string class_name, vector position, bool no_align); /// \brief Initializes the item according to classname. /// \param[in,out] item Item to initialize.