From: Lyberta Date: Fri, 1 Dec 2017 18:40:33 +0000 (+0300) Subject: Fixed noalign handling in random items and overkill. X-Git-Tag: xonotic-v0.8.5~2416^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=add003ffea424c7ae37246f0cca6b4e89835467a;p=xonotic%2Fxonotic-data.pk3dir.git Fixed noalign handling in random items and overkill. --- diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index 7462de81f..5eef8f2e3 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -205,7 +205,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn) setorigin(wep, ent.origin); setmodel(wep, MDL_OK_HMG); wep.ok_item = true; - wep.noalign = ent.noalign; + wep.noalign = Item_ShouldKeepPosition(ent); wep.cnt = ent.cnt; wep.team = ent.team; wep.respawntime = g_pickup_respawntime_superweapon; @@ -221,7 +221,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn) setorigin(wep, ent.origin); setmodel(wep, MDL_OK_RPC); wep.ok_item = true; - wep.noalign = ent.noalign; + wep.noalign = Item_ShouldKeepPosition(ent); wep.cnt = ent.cnt; wep.team = ent.team; wep.respawntime = g_pickup_respawntime_superweapon; 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 47234be29..3d3057462 100644 --- a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc +++ b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc @@ -299,7 +299,7 @@ entity RandomItems_ReplaceMapItem(entity item) if (!expr_evaluate(autocvar_g_overkill)) { new_item = Item_Create(strzone(new_classname), item.origin, - item.noalign); + Item_ShouldKeepPosition(item)); random_items_is_spawning = false; if (new_item == NULL) { @@ -311,7 +311,7 @@ entity RandomItems_ReplaceMapItem(entity item) new_item = spawn(); new_item.classname = strzone(new_classname); new_item.spawnfunc_checked = true; - new_item.noalign = item.noalign; + new_item.noalign = Item_ShouldKeepPosition(item); new_item.ok_item = true; Item_Initialize(new_item, new_classname); random_items_is_spawning = false; diff --git a/qcsrc/server/items.qc b/qcsrc/server/items.qc index 29a8609bc..7d248834f 100644 --- a/qcsrc/server/items.qc +++ b/qcsrc/server/items.qc @@ -84,6 +84,11 @@ 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; diff --git a/qcsrc/server/items.qh b/qcsrc/server/items.qh index af55eebd4..1abcf64e0 100644 --- a/qcsrc/server/items.qh +++ b/qcsrc/server/items.qh @@ -51,6 +51,13 @@ bool Item_IsLoot(entity item); /// \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.