Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Engineers ringing a mex that already has one or more mass storages will queue a T3 upgrade before building the other mass storages. #6508

Open
IndexLibrorumProhibitorum opened this issue Nov 4, 2024 · 3 comments

Comments

@IndexLibrorumProhibitorum

Describe the Bug

Using the relevant game setting, it is possible to take a group of engineers and by assisting a mex, queue up the upgrade to T2. When that mex is assisted again, the engineers will queue 4 mass storages around around the mex. Once those mass storages are built, another assist will queue the T3 upgrade for that mex.

However, if a mex already has a mass storage, which may happen because the building of queued storages was aborted, the engineers will queue and start a T3 upgrade before they've finished ringing the storages.

This causes T3 mexes to be inadvertendly started way before they should. It is not uncommon to see a group of engineers going around trying to ring all mexes, but then accidentally upgrading one mex to T3 while several mexes still awaiting mass storage rings.

The logic should check if the mex is fully ringed before being allowed to queue a T3 upgrade.

Reproduce the bug

Build one mass extractor to T2 and add one mass storage. Assist the mex with engineers, and observe that they'll start the T3 upgrade rather than build the rings.

Screenshots

No response

Additional context

No response

@Garanas
Copy link
Member

Garanas commented Nov 4, 2024

This is not a bug, this is intended. When one or more storages are connected to an extractor then it will queue the upgrade.

In the UI script we can not compute what structures are adjacent to what structures. The criteria we use now is whether the mass extractor has more income then what is defined in its blueprint. If that is the case, then we assume it is already capped and we'll issue the upgrade too.

The reason for this is simple: not all extractors can be fully ringed with storages. The terrain could be blocking it. Or another structure is adjacent that does not provide a resource bonus to the extractor. But the only information we have in the UI is the mass income that is mentioned before.

@lL1l1
Copy link
Contributor

lL1l1 commented Nov 4, 2024

You could sync what adjacencies a mex has, and also mark an adjacent slot as occupied if storage can't be built there when the max is placed. This would solve everything except two cases:

  • a building not giving adjacency but also blocking the storage because its placed 1 unit off
  • mexes that are larger than 2x2 units

You could check for blocked spaces with:

--- Returns true if the structure can be built at the given location. May return false positives
---@param blueprintID string As an example: `ueb0101`
---@param location Vector
---@return boolean
function CAiBrain:CanBuildStructureAt(blueprintID, location)

function CanBuildInSpot(originUnit, unitId, pos)

Syncing adjacency could also be useful for that UI idea of displaying how much of a discount is being given/bonus is received.

@Garanas
Copy link
Member

Garanas commented Nov 7, 2024

Syncing adjacency could also be useful for that UI idea of displaying how much of a discount is being given/bonus is received.

We can already do this I think by comparing the blueprint value(s) with the actual produced/consumed values.

I'm personally not in favor of the increased complexity of syncing values between Sim/UI. There is the AdjacentoTo and NotAdjacentTo events if I am not mistaken, the checks and syncs would need to happen there. I'd also use GetStat and SetStat over syncing values via the Sync. We could do this for all structures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants