Detect infinite resources by minimum yield, not infinite_resource

On Factorio 2.0 (with Space Exploration + Krastorio 2), crude oil and
mineral water report infinite_resource=false and a nil initial_amount,
but only infinite resources have a minimum_resource_amount > 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lazzexus 2026-10-13 07:46:23 +02:00
parent 3d8673fe03
commit 4aba8d67f3

View file

@ -198,9 +198,10 @@ export class EntityUpdatesHandler {
data.amounts[`${entity.position.x}`] ??= {}
data.amounts[`${entity.position.x}`][`${entity.position.y}`] = entity.amount
// initial_amount can be nil even for infinite resources (e.g. crude oil), so also
// check the prototype. An initial amount marks the resource as infinite.
if (entity.prototype.infinite_resource) {
// initial_amount and infinite_resource aren't reliable for infinite resources (e.g.
// crude oil reports infinite_resource=false), but only infinite resources have a
// minimum yield. An initial amount marks the resource as infinite.
if (entity.prototype.infinite_resource || (entity.prototype.minimum_resource_amount ?? 0) > 0) {
data.initialAmounts ??= {}
data.initialAmounts[`${entity.position.x}`] ??= {}
data.initialAmounts[`${entity.position.x}`][`${entity.position.y}`] =