Description
OpenKeeper allows the player to pick up loose gold that an Imp leaves on neutral/unclaimed land.
I compared this with the original Dungeon Keeper 2. In the original game, this gold cannot be picked up with the Hand of Evil until the tile has been claimed.
In the original game, the Hand also cannot drop held gold or other objects onto neutral land. Therefore, manual dropping is not part of this reproduction. The gold reaches neutral land through the Imp mining workflow when available gold storage is full.
Steps to reproduce
- Start campaign Level 1.
- Fill the Dungeon Heart's gold storage capacity (16,000 gold), without building additional Treasury capacity.
- Have an Imp continue digging gold from terrain bordering neutral/unclaimed floor.
- Once the Imp cannot carry or store more gold, observe loose gold being left where it was mined, potentially on neutral land.
- Try to pick up that loose gold with the Hand of Evil.
Expected behavior
The loose gold cannot be picked up while its tile is neutral/unclaimed.
After an Imp claims the tile, the gold becomes pickable.
This matches the original Dungeon Keeper 2.
Actual behavior
OpenKeeper allows the loose gold to be picked up directly from neutral/unclaimed land.
Technical findings
How the gold reaches neutral land
Mining calls CreatureController.addGold(...). When the Imp cannot carry the full amount, the excess is turned into loose gold at the Imp's current coordinates.
This is distinct from dropping gold with the Hand.
OpenKeeper's drop-validation code appears intended to enforce the own-land rule when an object's CAN_BE_DROPPED_ON_ANY_LAND flag is absent. The Level 1 data for both gold objects does not contain that flag. However, manual dropping in OpenKeeper was not tested as part of this reproduction.
Pickup validation
EntityViewControl.isPickable(...) checks the entity's Interaction.pickUppable flag, but not the underlying tile.
GameWorldController.canPickUpEntity(...) checks entity ownership and interaction flags, but not tile ownership. It contains the following TODO:
// TODO: Was it so that it can be only picked up from own land?
return interaction.pickUppable && !isEntityIncapacitated(entityId, entityData);
The mined gold is created with the Imp's owner ID. Consequently, the Owner.controlId check succeeds even when the gold is physically located on neutral terrain.
Suggested fix
For loose-gold object entities, pickup should additionally require the underlying tile to be owned by the requesting player.
The rule must be enforced server-side. The client should apply the same validation so gold on neutral or enemy land is not highlighted as pickable.
The restriction should be specific to loose gold, or implemented through object-specific pickup rules. A blanket own-land restriction could unintentionally change creature and other object pickup behavior.
Suggested tests
- Loose gold on neutral land is not pickable.
- The same gold becomes pickable after the tile is claimed.
- Loose gold on enemy-owned land is not pickable.
- Loose gold on the player's land remains pickable.
- Dropping held entities on neutral land follows the DK2 own-land rule.
- Creature pickup behavior is unchanged.
- A direct network pickup request cannot bypass the tile-ownership rule.
Relevant locations
src/main/java/toniarts/openkeeper/game/controller/creature/CreatureController.java
src/main/java/toniarts/openkeeper/game/controller/GameWorldController.java
src/main/java/toniarts/openkeeper/view/control/EntityViewControl.java
src/main/java/toniarts/openkeeper/game/controller/ObjectsController.java
Description
OpenKeeper allows the player to pick up loose gold that an Imp leaves on neutral/unclaimed land.
I compared this with the original Dungeon Keeper 2. In the original game, this gold cannot be picked up with the Hand of Evil until the tile has been claimed.
In the original game, the Hand also cannot drop held gold or other objects onto neutral land. Therefore, manual dropping is not part of this reproduction. The gold reaches neutral land through the Imp mining workflow when available gold storage is full.
Steps to reproduce
Expected behavior
The loose gold cannot be picked up while its tile is neutral/unclaimed.
After an Imp claims the tile, the gold becomes pickable.
This matches the original Dungeon Keeper 2.
Actual behavior
OpenKeeper allows the loose gold to be picked up directly from neutral/unclaimed land.
Technical findings
How the gold reaches neutral land
Mining calls
CreatureController.addGold(...). When the Imp cannot carry the full amount, the excess is turned into loose gold at the Imp's current coordinates.This is distinct from dropping gold with the Hand.
OpenKeeper's drop-validation code appears intended to enforce the own-land rule when an object's
CAN_BE_DROPPED_ON_ANY_LANDflag is absent. The Level 1 data for both gold objects does not contain that flag. However, manual dropping in OpenKeeper was not tested as part of this reproduction.Pickup validation
EntityViewControl.isPickable(...)checks the entity'sInteraction.pickUppableflag, but not the underlying tile.GameWorldController.canPickUpEntity(...)checks entity ownership and interaction flags, but not tile ownership. It contains the following TODO:The mined gold is created with the Imp's owner ID. Consequently, the
Owner.controlIdcheck succeeds even when the gold is physically located on neutral terrain.Suggested fix
For loose-gold object entities, pickup should additionally require the underlying tile to be owned by the requesting player.
The rule must be enforced server-side. The client should apply the same validation so gold on neutral or enemy land is not highlighted as pickable.
The restriction should be specific to loose gold, or implemented through object-specific pickup rules. A blanket own-land restriction could unintentionally change creature and other object pickup behavior.
Suggested tests
Relevant locations
src/main/java/toniarts/openkeeper/game/controller/creature/CreatureController.javasrc/main/java/toniarts/openkeeper/game/controller/GameWorldController.javasrc/main/java/toniarts/openkeeper/view/control/EntityViewControl.javasrc/main/java/toniarts/openkeeper/game/controller/ObjectsController.java