I'm requesting clarification on how the "restock" timer works for entries in types.xml, and also point out a potential bug or unintended behavior.
Sumrak has stated on Discord with regards to the restock timer:
restock - if set to 0, CE tries to respawn type in bulks, if set to positive value, it is time in seconds before ONE item of this type is spawned again.
So for instance, if I have "GorkaHelmetVisor" set to a 600s (10m) restock:
<type name="GorkaHelmetVisor"> <nominal>8</nominal> <lifetime>5600</lifetime> <restock>600</restock> <min>3</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/> <category name="clothes"/> <tag name="shelves"/> <usage name="Military"/> <value name="Tier2"/> <value name="Tier3"/> </type>
Then I should anticipate that once the minimum quantity (3) is reached, ONE "GorkaHelmetVisor" should be placed into the spawn queue every 600s (10m) until it's back to the maximum quantity (8). Correct?
However, after turning on some additional CE logging, this does not appear to be what is happening:
12:59:56 [CE][LootRespawner] (PRIDummy) :: [RESPAWN CANDIDATE] GorkaHelmetVisor missing:5 [cnt:3, nom:8, min:3] 12:59:56 Adding GorkaHelmetVisor at [4708,6652] 12:59:56 Adding GorkaHelmetVisor at [8189,8387] 12:59:56 Adding GorkaHelmetVisor at [9683,8484] 12:59:56 Adding GorkaHelmetVisor at [6080,5349] 12:59:56 Adding GorkaHelmetVisor at [6162,8183] 12:59:56 [CE][LootRespawner] (PRIDummy) :: GorkaHelmetVisor respawned:5, tests:5 missing:0
All 5 GorkaHelmetVisor spawned at the same time.
Also, it seems like this "bulk" spawning can often result in items spawning in close geographical proximity. Take this AK74 configuration:
<type name="AK74"> <nominal>5</nominal> <lifetime>10800</lifetime> <restock>3600</restock> <min>2</min> <quantmin>-1</quantmin> <quantmax>-1</quantmax> <cost>100</cost> <flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="1" crafted="0" deloot="0" /> <category name="weapons" /> <usage name="Military" /> <usage name="Crash" /> <value name="Tier2" /> <value name="Tier3" /> </type>
Based on this configuration, when we reach the minimum 2 AK74 on the map, 1 AK74 should be placed into the spawn queue every 3600s (1h) until the max of 5 on the map is reached.
However, we once again see bulk spawning:
13:12:03 [CE][LootRespawner] (PRIDummy) :: [RESPAWN CANDIDATE] AK74 missing:3 [cnt:3, nom:6, min:3] 13:12:03 Adding AK74 at [5878,6701] 13:12:03 Adding AK74 at [6036,8154] 13:12:03 Adding AK74 at [5988,8105] 13:12:03 [CE][LootRespawner] (PRIDummy) :: AK74 respawned:3, tests:3 missing:0
Also, these spawns are in close geographical proximity, despite having access to Military spawn locations in all of tiers 2 and 3 (Livonia):
It seems like it's not doing a great job of randomizing the spawn points it chooses, at least not when the items spawn in "bulk" (and they always do).
All of this would seem like unintended behavior based on the explanation of the restock timer that we have. If this is working as intended, can you please clarify how this is supposed to work so we know what to expect? Otherwise, maybe this is a bug? Thanks.