Spielerando

A building being upgraded should not be level two before it is finished

When an upgrade starts, the building has to be something in between. Set the level too early and the player gets the benefits for free; set it too late and cancelling or double-clicking breaks it. Here is a clean way to hold the in-between time.

Why this works

The building is what it is until the work is finished, so the level should change at one moment only, at the end. Everything else reads the old level in the meantime, and cancelling has nothing to undo because nothing was changed early.

When not to use it

Skip it when an upgrade should help right away, like a repair that restores part of the strength at once, or when the building must be closed in the meantime. Then pay out the gain in steps, or add the closing rule on top.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • A diagram of every state
  • 28 lines of example code with 3 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "A building being upgraded should not be level two before it is finished" (read_entry upgrade-keeps-old-level-until-done) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP