Skip to content

feat(coop_mining): fix multi-agent gold mining registration and elimi…#319

Open
sriramsowmithri9807 wants to merge 2 commits intogoogle-deepmind:mainfrom
sriramsowmithri9807:main
Open

feat(coop_mining): fix multi-agent gold mining registration and elimi…#319
sriramsowmithri9807 wants to merge 2 commits intogoogle-deepmind:mainfrom
sriramsowmithri9807:main

Conversation

@sriramsowmithri9807
Copy link

…nate duplicate rewards

  • Ensure each miner is counted only once per ore attempt.
  • Preserve immediate extraction for iron (minNumMiners == 1) and gold (minNumMiners == 2) on sufficient distinct miners.
  • Prevent over-reward by clearing miners and countdown and transitioning ore to wait state immediately after successful extraction.
  • Guard against “too many miners” by failing the attempt when the number of distinct miners already meets/exceeds the required threshold prior to the new hit.
  • Avoid conflicting state transitions by not mixing reset() and setState() in the same onHit success path.

Files changed:

  • meltingpot/lua/levels/coop_mining/components.lua

Key changes:

  • Ore:addMiner: only reset the mining window if it is already idle; prevents premature timer resets.
  • Ore:onHit: de-duplicate per-miner mining events; trigger extraction when required distinct miners are reached; ensure immediate transition to wait state after success; fail fast if miners exceed required count.

…nate duplicate rewards

- Ensure each miner is counted only once per ore attempt.
- Preserve immediate extraction for iron (minNumMiners == 1) and gold (minNumMiners == 2) on sufficient distinct miners.
- Prevent over-reward by clearing miners and countdown and transitioning ore to wait state immediately after successful extraction.
- Guard against “too many miners” by failing the attempt when the number of distinct miners already meets/exceeds the required threshold prior to the new hit.
- Avoid conflicting state transitions by not mixing reset() and setState() in the same `onHit` success path.

Files changed:
- meltingpot/lua/levels/coop_mining/components.lua

Key changes:
- Ore:addMiner: only reset the mining window if it is already idle; prevents premature timer resets.
- Ore:onHit: de-duplicate per-miner mining events; trigger extraction when required distinct miners are reached; ensure immediate transition to wait state after success; fail fast if miners exceed required count.
Copy link
Contributor

@duenez duenez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I don't have permission to approve this anymore... @jzleibo @jagapiou

@jagapiou
Copy link
Member

jagapiou commented Jan 5, 2026

Thanks Edgar, I'll assign for Joel. @jzleibo should probably release a new minor version once this goes in.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants