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;
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;
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)
{
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;
item.m_isloot = loot;
}
+bool Item_ShouldKeepPosition(entity item)
+{
+ return item.noalign || (item.spawnflags & 1);
+}
+
bool Item_IsExpiring(entity item)
{
return item.m_isexpiring;
/// \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.