From 3ed7c04c3ce3232bd05e6d3676d691701dc936e3 Mon Sep 17 00:00:00 2001 From: Neloreck Date: Sat, 4 Jan 2025 01:50:24 +0200 Subject: [PATCH] For non-weapon items respect spawn count value. --- src/xrGame/alife_object.cpp | 7 +++++++ src/xrServerEntities/xrServer_Objects_ALife.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/xrGame/alife_object.cpp b/src/xrGame/alife_object.cpp index 2adcadde197..924b77b53c1 100644 --- a/src/xrGame/alife_object.cpp +++ b/src/xrGame/alife_object.cpp @@ -125,6 +125,13 @@ void CSE_ALifeObject::spawn_supplies(LPCSTR ini_string) alife().spawn_item(ammoSec, o_Position, m_tNodeID, m_tGraphID, ID); } } + // If not weapon item, handle count as literal count, not ammo (useful for grenades and consumables). + else + { + for (u32 i = 1; i <= spawnCount - 1; ++i) + alife().spawn_item(itmSection, o_Position, m_tNodeID, m_tGraphID, ID); + } + if (const auto IItem = smart_cast(E)) IItem->m_fCondition = fCond; } diff --git a/src/xrServerEntities/xrServer_Objects_ALife.h b/src/xrServerEntities/xrServer_Objects_ALife.h index 0605978aea6..5c3d6326255 100644 --- a/src/xrServerEntities/xrServer_Objects_ALife.h +++ b/src/xrServerEntities/xrServer_Objects_ALife.h @@ -168,6 +168,7 @@ class CSE_ALifeObject : public CSE_Abstract, public CRandom virtual u32 ef_weapon_type() const; virtual u32 ef_detector_type() const; #ifdef XRGAME_EXPORTS + virtual bool is_spawn_supplies_flag_set(LPCSTR, LPCSTR); virtual void spawn_supplies(LPCSTR); virtual void spawn_supplies(); CALifeSimulator& alife() const;